Merge pull request #87 from dylanaraps/theme_merge

Merge `getvisualstyle` with `getstyle`.
This commit is contained in:
Dylan Araps 2016-02-19 23:41:53 +11:00
commit 60027c04b0

44
fetch
View file

@ -1171,12 +1171,9 @@ getresolution () {
# Theme/Icons/Font {{{ # Theme/Icons/Font {{{
getstyle () { getstyle () {
# If X isn't running don't print the theme.
[ ! -n "$DISPLAY" ] && return
# Fix weird output when the function # Fix weird output when the function
# is run multiple times. # is run multiple times.
unset gtk2theme gtk3theme unset gtk2theme gtk3theme theme path
case "$1" in case "$1" in
theme) theme)
@ -1185,6 +1182,8 @@ getstyle () {
gconf="gtk_theme" gconf="gtk_theme"
xfconf="ThemeName" xfconf="ThemeName"
kde="widgetStyle" kde="widgetStyle"
path="/proc/registry/HKEY_CURRENT_USER/Software/Microsoft"
path+="/Windows/CurrentVersion/Themes/CurrentTheme"
;; ;;
icons) icons)
@ -1204,6 +1203,7 @@ getstyle () {
;; ;;
esac esac
if [ -n "$DISPLAY" ]; then
# Current DE # Current DE
desktop="$XDG_CURRENT_DESKTOP" desktop="$XDG_CURRENT_DESKTOP"
desktop=${desktop,,} desktop=${desktop,,}
@ -1317,15 +1317,24 @@ getstyle () {
theme=${theme//\"} theme=${theme//\"}
theme=${theme//\'} theme=${theme//\'}
# If the final string is empty print "None"
[ -z "$theme" ] && theme="None"
# Make the output shorter by removing "[GTKX]" from the string # Make the output shorter by removing "[GTKX]" from the string
if [ "$gtk_shorthand" == "on" ]; then if [ "$gtk_shorthand" == "on" ]; then
theme=${theme/ '[GTK2]'} theme=${theme/ '[GTK2]'}
theme=${theme/ '[GTK3]'} theme=${theme/ '[GTK3]'}
theme=${theme/ '[GTK2/3]'} theme=${theme/ '[GTK2/3]'}
fi fi
else
case "$os" in
"Windows")
[ -z "$path" ] && return
theme="$(head -n1 $path 2>/dev/null)"
theme="${theme##*\\}"
theme="${theme%.*}"
theme="${theme^}"
;;
esac
fi
} }
gettheme () { gettheme () {
@ -1560,27 +1569,6 @@ getcols () {
# }}} # }}}
# Windows Visual Style {{{
getvisualstyle () {
case "$os" in
"Windows"*)
path="/proc/registry/HKEY_CURRENT_USER/Software/Microsoft"
path+="/Windows/CurrentVersion/Themes/CurrentTheme"
visualstyle="$(head -n1 $path)"
visualstyle="${visualstyle##*\\}"
visualstyle="${visualstyle%.*}"
visualstyle="${visualstyle^}"
;;
*)
visualstyle="This feature only works on Windows"
;;
esac
}
# }}}
# }}} # }}}