added Linux support

This commit is contained in:
Andrew Titmuss 2016-03-26 07:59:24 +11:00
parent 46a76f55c9
commit b971e214e6
2 changed files with 7 additions and 2 deletions

View file

@ -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\]

View file

@ -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")