Rewrite getgtk to also check DE
This commit is contained in:
parent
a272874833
commit
f15f5728ea
91
fetch
91
fetch
|
@ -1086,56 +1086,97 @@ 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
|
||||
|
||||
# Check for gtk2 theme
|
||||
if [ "$gtk2" == "on" ]; then
|
||||
if [ -f "$HOME/.gtkrc-2.0" ]; then
|
||||
gtk2theme=$(grep "^[^#]*$name" "$HOME/.gtkrc-2.0")
|
||||
# Current DE
|
||||
desktop="$XDG_CURRENT_DESKTOP"
|
||||
desktop=${desktop,,}
|
||||
desktop=${desktop^}
|
||||
|
||||
elif [ -f "/etc/gtk-2.0/gtkrc" ]; then
|
||||
gtk2theme=$(grep "^[^#]*$name" /etc/gtk-2.0/gtkrc)
|
||||
fi
|
||||
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
|
||||
;;
|
||||
|
||||
gtk2theme=${gtk2theme/${name}*=}
|
||||
gtk2theme=${gtk2theme//\"}
|
||||
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}
|
||||
|
||||
# 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")
|
||||
elif type -p gconftool-2 >/dev/null 2>&1; then
|
||||
gtk2theme=$(gconftool-2 -g /desktop/gnome/interface/$gconf)
|
||||
fi
|
||||
;;
|
||||
|
||||
elif type -p gsettings >/dev/null 2>&1; then
|
||||
gtk3theme="$(gsettings get org.gnome.desktop.interface $gsettings)"
|
||||
gtk3theme=${gtk3theme//\'}
|
||||
"Mate"*)
|
||||
gtk3theme=$(gsettings get org.mate.interface $gsettings)
|
||||
gtk2theme=${gtk3theme}
|
||||
;;
|
||||
|
||||
else
|
||||
gtk3theme=$(grep "^[^#]*$name" /etc/gtk-3.0/settings.ini)
|
||||
fi
|
||||
"Xfce"*)
|
||||
if type -p xfconf-query >/dev/null 2>&1; then
|
||||
gtk2Theme=$(xfconf-query -c xsettings -p /Net/$xfconf)
|
||||
fi
|
||||
;;
|
||||
|
||||
gtk3theme=${gtk3theme/${name}*=}
|
||||
gtk3theme=${gtk3theme//\"}
|
||||
gtk3theme=${gtk3theme/[[:space:]]/ }
|
||||
fi
|
||||
*)
|
||||
# Check for gtk2 theme
|
||||
if [ -f "$HOME/.gtkrc-2.0" ]; then
|
||||
gtk2theme=$(grep "^[^#]*$name" "$HOME/.gtkrc-2.0")
|
||||
|
||||
elif [ -f "/etc/gtk-2.0/gtkrc" ]; then
|
||||
gtk2theme=$(grep "^[^#]*$name" /etc/gtk-2.0/gtkrc)
|
||||
fi
|
||||
|
||||
gtk2theme=${gtk2theme/${name}*=}
|
||||
gtk2theme=${gtk2theme//\"}
|
||||
|
||||
# Check for gtk3 theme
|
||||
if [ -f "$HOME/.config/gtk-3.0/settings.ini" ]; then
|
||||
gtk3theme=$(grep "^[^#]*$name" "$HOME/.config/gtk-3.0/settings.ini")
|
||||
|
||||
elif type -p gsettings >/dev/null 2>&1; then
|
||||
gtk3theme="$(gsettings get org.gnome.desktop.interface $gsettings)"
|
||||
gtk3theme=${gtk3theme//\'}
|
||||
|
||||
else
|
||||
gtk3theme=$(grep "^[^#]*$name" /etc/gtk-3.0/settings.ini)
|
||||
fi
|
||||
|
||||
gtk3theme=${gtk3theme/${name}*=}
|
||||
gtk3theme=${gtk3theme//\"}
|
||||
gtk3theme=${gtk3theme/[[:space:]]/ }
|
||||
;;
|
||||
esac
|
||||
|
||||
# Format the string based on which themes exist
|
||||
if [ "$gtk2theme" ] && [ "$gtk2theme" == "$gtk3theme" ]; then
|
||||
|
|
Reference in New Issue