Rewrite getgtk to also check DE
This commit is contained in:
parent
a272874833
commit
f15f5728ea
51
fetch
51
fetch
|
@ -1086,28 +1086,70 @@ getresolution () {
|
|||
|
||||
# }}}
|
||||
|
||||
# GTK Theme/Icons/Font {{{
|
||||
# GTK Theme/Icons/Font New {{{
|
||||
|
||||
getgtk () {
|
||||
case "$1" in
|
||||
theme)
|
||||
name="gtk-theme-name"
|
||||
gsettings="gtk-theme"
|
||||
gconf="gtk_theme"
|
||||
xfconf="ThemeName"
|
||||
;;
|
||||
|
||||
icons)
|
||||
name="gtk-icon-theme-name"
|
||||
gsettings="icon-theme"
|
||||
gconf="icon_theme"
|
||||
xfconf="IconThemeName"
|
||||
;;
|
||||
|
||||
font)
|
||||
name="gtk-font-name"
|
||||
gsettings="font-name"
|
||||
gconf="font_theme"
|
||||
xfconf="FontName"
|
||||
;;
|
||||
esac
|
||||
|
||||
# Current DE
|
||||
desktop="$XDG_CURRENT_DESKTOP"
|
||||
desktop=${desktop,,}
|
||||
desktop=${desktop^}
|
||||
|
||||
case "$desktop" in
|
||||
"Cinnamon")
|
||||
if type -p gsettings >/dev/null 2>&1; then
|
||||
gtk3theme=$(gsettings get org.cinnamon.desktop.interface $gsettings)
|
||||
gtk3theme=${gtk3theme//"'"}
|
||||
gtk2theme=${gtk3theme}
|
||||
fi
|
||||
;;
|
||||
|
||||
"Gnome"* | "Unity"* | "Budgie")
|
||||
if type -p gsettings >/dev/null 2>&1; then
|
||||
gtk3theme=$(gsettings get org.gnome.desktop.interface $gsettings)
|
||||
gtk3theme=${gtk3theme//"'"}
|
||||
gtk2theme=${gtk3theme}
|
||||
|
||||
elif type -p gconftool-2 >/dev/null 2>&1; then
|
||||
gtk2theme=$(gconftool-2 -g /desktop/gnome/interface/$gconf)
|
||||
fi
|
||||
;;
|
||||
|
||||
"Mate"*)
|
||||
gtk3theme=$(gsettings get org.mate.interface $gsettings)
|
||||
gtk2theme=${gtk3theme}
|
||||
;;
|
||||
|
||||
"Xfce"*)
|
||||
if type -p xfconf-query >/dev/null 2>&1; then
|
||||
gtk2Theme=$(xfconf-query -c xsettings -p /Net/$xfconf)
|
||||
fi
|
||||
;;
|
||||
|
||||
*)
|
||||
# Check for gtk2 theme
|
||||
if [ "$gtk2" == "on" ]; then
|
||||
if [ -f "$HOME/.gtkrc-2.0" ]; then
|
||||
gtk2theme=$(grep "^[^#]*$name" "$HOME/.gtkrc-2.0")
|
||||
|
||||
|
@ -1117,10 +1159,8 @@ getgtk () {
|
|||
|
||||
gtk2theme=${gtk2theme/${name}*=}
|
||||
gtk2theme=${gtk2theme//\"}
|
||||
fi
|
||||
|
||||
# Check for gtk3 theme
|
||||
if [ "$gtk3" == "on" ]; then
|
||||
if [ -f "$HOME/.config/gtk-3.0/settings.ini" ]; then
|
||||
gtk3theme=$(grep "^[^#]*$name" "$HOME/.config/gtk-3.0/settings.ini")
|
||||
|
||||
|
@ -1135,7 +1175,8 @@ getgtk () {
|
|||
gtk3theme=${gtk3theme/${name}*=}
|
||||
gtk3theme=${gtk3theme//\"}
|
||||
gtk3theme=${gtk3theme/[[:space:]]/ }
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
# Format the string based on which themes exist
|
||||
if [ "$gtk2theme" ] && [ "$gtk2theme" == "$gtk3theme" ]; then
|
||||
|
|
Reference in New Issue