If the DE detection fails fallback to the generic theme detection
This commit is contained in:
parent
caf55803f3
commit
cbc33486f7
1 changed files with 33 additions and 29 deletions
62
fetch
62
fetch
|
@ -1089,6 +1089,10 @@ getresolution () {
|
|||
# GTK Theme/Icons/Font {{{
|
||||
|
||||
getgtk () {
|
||||
# Fix weird output when the function
|
||||
# is run multiple times.
|
||||
unset gtk2theme gtk3theme
|
||||
|
||||
case "$1" in
|
||||
theme)
|
||||
name="gtk-theme-name"
|
||||
|
@ -1147,37 +1151,37 @@ getgtk () {
|
|||
gtk2theme=$(xfconf-query -c xsettings -p /Net/$xfconf)
|
||||
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
|
||||
|
||||
if [ -z "$gtk2theme" ] && [ -z "$gtk3theme" ]; then
|
||||
# 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:]]/ }
|
||||
fi
|
||||
|
||||
# Toggle visibility of gtk themes.
|
||||
[ "$gtk2" == "off" ] && unset gtk2theme
|
||||
[ "$gtk3" == "off" ] && unset gtk3theme
|
||||
|
|
Loading…
Reference in a new issue