Handle ${GTK2_RC_FILES} with multiple values

This commit is contained in:
edward-p 2019-04-01 00:03:02 +08:00
parent cc78503b58
commit 6f1ae617ff

View file

@ -2683,8 +2683,15 @@ get_style() {
# Check for general GTK2 Theme.
if [[ -z "$gtk2_theme" ]]; then
if [[ -f "${GTK2_RC_FILES:-${HOME}/.gtkrc-2.0}" ]]; then
gtk2_theme="$(grep "^[^#]*${name}" "${GTK2_RC_FILES:-${HOME}/.gtkrc-2.0}")"
if [[ -n "${GTK2_RC_FILES}" ]]; then
for gtkrc in ${GTK2_RC_FILES//:/ }; do
_gtk2_theme="$(grep "^[^#]*${name}" "${gtkrc}")"
[[ -n "${_gtk2_theme}" ]] && gtk2_theme="${_gtk2_theme}"
done
unset _gtk2_theme
elif [[ -f "${HOME}/.gtkrc-2.0" ]]; then
gtk2_theme="$(grep "^[^#]*${name}" "${HOME}/.gtkrc-2.0")"
elif [[ -f "/etc/gtk-2.0/gtkrc" ]]; then
gtk2_theme="$(grep "^[^#]*${name}" /etc/gtk-2.0/gtkrc)"