From 058e0bc3e6557c634be8422a0b1e3d2fa4be5521 Mon Sep 17 00:00:00 2001 From: Dylan Date: Fri, 19 Feb 2016 20:47:13 +1100 Subject: [PATCH] Don't display Theme, Icons, Font or Window Manager if X isn't running --- fetch | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/fetch b/fetch index deb4d1d1..708f2bbc 100755 --- a/fetch +++ b/fetch @@ -540,7 +540,7 @@ getuptime () { "Mac OS X" | *"BSD") # Get boot time in seconds boot="$(sysctl -n kern.boottime)" - boot="${boot/{ sec = }" + boot="${boot/'{ sec = '}" boot=${boot/,*} # Get current date in seconds @@ -763,7 +763,7 @@ getwm () { case "$os" in "Mac OS X") wm="Quartz Compositor" ;; "Windows") wm="Explorer" ;; - *) wm="Unknown" ;; + "Linux" | *"BSD") return ;; esac fi } @@ -1176,6 +1176,9 @@ getresolution () { # Theme/Icons/Font {{{ getstyle () { + # If X isn't running don't print the theme. + [ ! -n "$DISPLAY" ] && return + # Fix weird output when the function # is run multiple times. unset gtk2theme gtk3theme