Added support for showing the user's Desktop Environment and renamded 'windowmanager' to 'wm'

This commit is contained in:
Dylan 2016-02-10 22:44:23 +11:00
parent 1ac98037d5
commit a81b4238df
2 changed files with 23 additions and 16 deletions

View File

@ -26,7 +26,8 @@ printinfo () {
info "Uptime" uptime info "Uptime" uptime
info "Packages" packages info "Packages" packages
info "Shell" shell info "Shell" shell
info "Window Manager" windowmanager info "Desktop Environment" de
info "Window Manager" wm
info "GTK Theme" gtktheme info "GTK Theme" gtktheme
info "Icons" gtkicons info "Icons" gtkicons
info "CPU" cpu info "CPU" cpu

36
fetch
View File

@ -44,7 +44,8 @@ printinfo () {
info "Uptime" uptime info "Uptime" uptime
info "Packages" packages info "Packages" packages
info "Shell" shell info "Shell" shell
info "Window Manager" windowmanager info "Desktop Environment" de
info "Window Manager" wm
info "GTK Theme" gtktheme info "GTK Theme" gtktheme
info "Icons" gtkicons info "Icons" gtkicons
info "CPU" cpu info "CPU" cpu
@ -715,33 +716,38 @@ getshell () {
# }}} # }}}
# Desktop Environment {{{
getde () {
[ "$XDG_CURRENT_DESKTOP" ] && de="$XDG_CURRENT_DESKTOP"
}
# }}}
# Window Manager {{{ # Window Manager {{{
getwindowmanager () { getwm () {
if type -p wmctrl >/dev/null 2>&1; then if type -p wmctrl >/dev/null 2>&1; then
windowmanager="$(wmctrl -m | head -n1)" wm="$(wmctrl -m | head -n1)"
windowmanager=${windowmanager/Name: } wm=${wm/Name: }
elif [ "$XDG_CURRENT_DESKTOP" ]; then
windowmanager="$XDG_CURRENT_DESKTOP"
elif [ "$XINITRC" ]; then elif [ "$XINITRC" ]; then
windowmanager=$(grep "^[^#]*exec" "$XINITRC" | tail -n 1) wm=$(grep "^[^#]*exec" "$XINITRC" | tail -n 1)
elif [ -e "$HOME/.xinitrc" ]; then elif [ -e "$HOME/.xinitrc" ]; then
windowmanager=$(grep "^[^#]*exec" "${HOME}/.xinitrc" | tail -n 1) wm=$(grep "^[^#]*exec" "${HOME}/.xinitrc" | tail -n 1)
else else
case "$os" in case "$os" in
"Mac OS X") windowmanager="Quartz Compositor" ;; "Mac OS X") wm="Quartz Compositor" ;;
"Windows") windowmanager="Explorer" ;; "Windows") wm="Explorer" ;;
*) windowmanager="Unknown" ;; *) wm="Unknown" ;;
esac esac
fi fi
windowmanager="${windowmanager/exec }" wm="${wm/exec }"
windowmanager="${windowmanager/-session}" wm="${wm/-session}"
windowmanager="${windowmanager^}" wm="${wm^}"
} }
# }}} # }}}