Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(resolution): Alternate to xrandr when xdpyinfo unavailable #793

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions screenfetch-dev
Original file line number Diff line number Diff line change
Expand Up @@ -1989,6 +1989,7 @@ detectshell () {


# Resolution Detection - Begin
# Egs `1920x1080`
detectres () {
xResolution="No X Server"
if [[ ${distro} == "Mac OS X" || $distro == "macOS" ]]; then
Expand All @@ -2003,6 +2004,8 @@ detectres () {
elif [[ -n ${DISPLAY} ]]; then
if type -p xdpyinfo >/dev/null 2>&1; then
xResolution=$(xdpyinfo | "${AWK}" '/^ +dimensions/ {print $2}')
elif type -p xrandr > /dev/null 2>&1; then
xResolution=$(xrandr --listmonitors | "${AWK}" '/[0-9]+\/[0-9]+x[0-9]+\/[0-9]+/ { split($3,a); gsub(/\/[[:digit:]]+|\+[0-9]/,"",a[1]); print(a[1])}')
fi
fi
verboseOut "Finding current resolution(s)...found as '$xResolution'"
Expand Down