From e2efe752f70e0afd70bb7cf86999df2c0dd4a97a Mon Sep 17 00:00:00 2001 From: arcetera Date: Wed, 30 Dec 2015 07:48:52 -0500 Subject: [PATCH 1/2] Fix capitalization. --- fetch.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fetch.sh b/fetch.sh index ea446369..f24923d0 100755 --- a/fetch.sh +++ b/fetch.sh @@ -23,7 +23,7 @@ title_uptime="Uptime" title_packages="Packages" title_shell="Shell" title_windowmanager="Window Manager" -title_cpu="Cpu" +title_cpu="CPU" title_memory="Memory" title_song="Song" From 0b6a4cfdef5aa9ceff2a5dbb9770fdc807a40c90 Mon Sep 17 00:00:00 2001 From: arcetera Date: Wed, 30 Dec 2015 07:58:35 -0500 Subject: [PATCH 2/2] Better window manager detection. --- fetch.sh | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/fetch.sh b/fetch.sh index f24923d0..d4d57b11 100755 --- a/fetch.sh +++ b/fetch.sh @@ -148,10 +148,19 @@ shell="$SHELL" # This can be detected without wmctrl by using an array of window manager # process names and pgrep but it's really slow. # (Doubles script startup time in some cases). -# If you don't want to install wmctrl you can either edit the var below +# If you don't want to install wmctrl you can either edit the var below, +# export the "windowmanager" variable in your shell's configuration file, # or run the script with: --windowmanager wmname # windowmanager="openbox" -windowmanager=$(wmctrl -m | awk '/Name:/ {printf $2}') +if [ -z $windowmanager ]; then + if type -p wmctrl >/dev/null 2>&1; then + windowmanager=$(wmctrl -m | awk '/Name:/ {printf $2}') + elif [ -e ~/.xinitrc ]; then + windowmanager=$(grep -v "^#" "${HOME}/.xinitrc" | tail -n 1 | cut -d " " -f2) + else + windowmanager="Unknown" + fi +fi # Processor (Configurable with "-C", "-S" and "--cpu", "--speed" at launch) cpu="$(awk 'BEGIN{FS=":"} /model name/ {print $2; exit}' /proc/cpuinfo |\