diff --git a/README.md b/README.md index 37379f34..672232c0 100644 --- a/README.md +++ b/README.md @@ -89,7 +89,7 @@ your distro's logo or any ascii art of your choice! - Wallpaper: `feh`, `nitrogen` or `gsettings` - Current Song: `mpc` or `cmus` -- Resolution: `xorg-xdpyinfo` +- Resolution: `xorg-xdpyinfo` or `xrandr` - Screenshot: `scrot` \[5\] diff --git a/neofetch b/neofetch index 1597bcbb..8f2e06b2 100755 --- a/neofetch +++ b/neofetch @@ -1273,8 +1273,13 @@ getsong () { getresolution () { case "$os" in "Linux" | *"BSD") - type -p xdpyinfo >/dev/null 2>&1 && \ + if type -p xrandr >/dev/null 2>&1; then + resolution=$(xrandr --nograb --current | awk 'match($0,/[0-0]{2,3}.[0-9]{2}\*/) {printf $1 " @ " substr($0,RSTART,RLENGTH) "Hz, "}') + resolution=${resolution//\*} + + elif type -p xdpyinfo >/dev/null 2>&1 && \ resolution=$(xdpyinfo 2>/dev/null | awk '/dimensions:/ {printf $2}') + fi ;; "Mac OS X")