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
1 changed files with 113 additions and 125 deletions

44
fetch
View File

@ -1171,12 +1171,9 @@ getresolution () {
# Theme/Icons/Font {{{
getstyle () {
# If X isn't running don't print the theme.
[ ! -n "$DISPLAY" ] && return
# Fix weird output when the function
# is run multiple times.
unset gtk2theme gtk3theme
unset gtk2theme gtk3theme theme path
case "$1" in
theme)
@ -1185,6 +1182,8 @@ getstyle () {
gconf="gtk_theme"
xfconf="ThemeName"
kde="widgetStyle"
path="/proc/registry/HKEY_CURRENT_USER/Software/Microsoft"
path+="/Windows/CurrentVersion/Themes/CurrentTheme"
;;
icons)
@ -1204,6 +1203,7 @@ getstyle () {
;;
esac
if [ -n "$DISPLAY" ]; then
# Current DE
desktop="$XDG_CURRENT_DESKTOP"
desktop=${desktop,,}
@ -1317,15 +1317,24 @@ getstyle () {
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
if [ "$gtk_shorthand" == "on" ]; then
theme=${theme/ '[GTK2]'}
theme=${theme/ '[GTK3]'}
theme=${theme/ '[GTK2/3]'}
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 () {
@ -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
}
# }}}
# }}}