From d836b67a1d84dc4b69c27bd590c151d90a4265c8 Mon Sep 17 00:00:00 2001 From: Dylan Date: Sat, 30 Jan 2016 00:34:48 +1100 Subject: [PATCH] Resolution: exit correctly --- fetch | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/fetch b/fetch index 6e6a440f..cb86e2ca 100755 --- a/fetch +++ b/fetch @@ -23,6 +23,7 @@ export LC_ALL=C export LANG=c export LANGUAGE=C +set -e # Config Options {{{ @@ -1040,16 +1041,22 @@ getsong () { getresolution () { case "$os" in "Linux" | *"BSD") - resolution=$(xdpyinfo 2>/dev/null | awk '/dimensions:/ {printf $2}') + if type -p xdpyinfo >/dev/null 2>&1; then + resolution=$(xdpyinfo 2>/dev/null | awk '/dimensions:/ {printf $2}') + else + resolution="Unknown" + fi ;; "Mac OS X") resolution=$(system_profiler SPDisplaysDataType |\ awk '/Resolution:/ {printf $2"x"$4" "}') ;; - esac - [ -z "$resolution" ] && resolution="Unknown" + "*") + resolution="Unknown" + ;; + esac } # }}}