From b971e214e69edfb95fea5a8941fccfa893a3e1b9 Mon Sep 17 00:00:00 2001 From: Andrew Titmuss Date: Sat, 26 Mar 2016 07:59:24 +1100 Subject: [PATCH] added Linux support --- README.md | 2 +- neofetch | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) 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")