Merge pull request #87 from dylanaraps/theme_merge
Merge `getvisualstyle` with `getstyle`.
This commit is contained in:
commit
60027c04b0
44
fetch
44
fetch
|
@ -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
|
||||
}
|
||||
|
||||
# }}}
|
||||
|
||||
|
||||
# }}}
|
||||
|
||||
|
|
Reference in New Issue