From e3780099f46c0304279fde042966741117828da4 Mon Sep 17 00:00:00 2001 From: dylan araps Date: Thu, 31 Dec 2015 12:08:35 +1100 Subject: [PATCH] Add changes from #2, thanks @ix --- fetch.sh | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/fetch.sh b/fetch.sh index 60f4bdb0..a57e62ff 100755 --- a/fetch.sh +++ b/fetch.sh @@ -127,7 +127,11 @@ title="$(whoami)@$(hostname)" # Operating System (Configurable with "-O" and "--distro" at launch) # You can manually set this if the command below doesn't work for you. -os=$(awk '/^NAME=/' /etc/*ease | sed -n 's/^NAME=//p' | tr -d '"') +if type -p crux >/dev/null 2>&1; then + os="CRUX" +else + os=$(awk '/^NAME=/' /etc/*ease | sed -n 's/^NAME=//p' | tr -d '"') +fi # Linux kernel name/version (Configurable with "-K" and "--kernel" at launch) kernel=$(uname -r) @@ -199,7 +203,11 @@ cpuspeed () { memory=$(free -m | awk '/Mem:/ {printf $3 "MB / " $2 "MB"}') # Currently playing song/artist (Configurable with "-m" and "--song" at launch) -song=$(mpc current) +if type -p mpc >/dev/null 2>&1; then + song=$(mpc current) +else + song="Unknown" +fi # Print terminal colors in a line # (Configurable with "--printcols start end" at launch) @@ -488,9 +496,11 @@ printf "\n" # Enable line wrap again [ $linewrap -eq 0 ] && tput smam -# Display the image -printf "0;1;$xoffset;$yoffset;$imgsize;$imgsize;;;;;$img\n4;\n3;" |\ - /usr/lib/w3m/w3mimgdisplay +# If w3mimgviewer is found Display the image +if type -p /usr/lib/w3m/w3mimgdisplay >/dev/null 2>&1; then + printf "0;1;$xoffset;$yoffset;$imgsize;$imgsize;;;;;$img\n4;\n3;" |\ + /usr/lib/w3m/w3mimgdisplay +fi # Show the cursor again tput cnorm