Merge pull request #1 from ix/master

Fix capitalization and add better window manager detection.
This commit is contained in:
Dylan Araps 2015-12-31 00:24:40 +11:00
commit 16d1ebb1b2

View file

@ -23,7 +23,7 @@ title_uptime="Uptime"
title_packages="Packages" title_packages="Packages"
title_shell="Shell" title_shell="Shell"
title_windowmanager="Window Manager" title_windowmanager="Window Manager"
title_cpu="Cpu" title_cpu="CPU"
title_memory="Memory" title_memory="Memory"
title_song="Song" title_song="Song"
@ -148,10 +148,19 @@ shell="$SHELL"
# This can be detected without wmctrl by using an array of window manager # This can be detected without wmctrl by using an array of window manager
# process names and pgrep but it's really slow. # process names and pgrep but it's really slow.
# (Doubles script startup time in some cases). # (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 # or run the script with: --windowmanager wmname
# windowmanager="openbox" # 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) # Processor (Configurable with "-C", "-S" and "--cpu", "--speed" at launch)
cpu="$(awk 'BEGIN{FS=":"} /model name/ {print $2; exit}' /proc/cpuinfo |\ cpu="$(awk 'BEGIN{FS=":"} /model name/ {print $2; exit}' /proc/cpuinfo |\