wm_theme: Refactor Openbox theme detection

This commit is contained in:
Michael Straube 2019-12-12 11:54:24 +01:00
parent 5c740aa4f2
commit 00f1dadb85

View file

@ -1809,19 +1809,17 @@ get_wm_theme() {
;; ;;
"Openbox") "Openbox")
if [[ "$de" == "LXDE" && -f "${HOME}/.config/openbox/lxde-rc.xml" ]]; then case $de in
ob_file="lxde-rc" "LXDE"*) ob_file="lxde-rc" ;;
"LXQt"*) ob_file="lxqt-rc" ;;
*) ob_file="rc" ;;
esac
elif [[ "$de" == "LXQt" && -f "${HOME}/.config/openbox/lxqt-rc.xml" ]]; then ob_file="${XDG_CONFIG_HOME}/openbox/${ob_file}.xml"
ob_file="lxqt-rc"
elif [[ -f "${HOME}/.config/openbox/rc.xml" ]]; then [[ -f "$ob_file" ]] && \
ob_file="rc" wm_theme="$(awk '/<theme>/ {while (getline n) {if (match(n, /<name>/))
fi {l=n; exit}}} END {split(l, a, "[<>]"); print a[3]}' "$ob_file")"
wm_theme="$(awk '/<theme>/ {while (getline n) {if (match(n, /<name>/)) {l=n; exit}}}
END {split(l, a, "[<>]"); print a[3]}' \
"${XDG_CONFIG_HOME}/openbox/${ob_file}.xml")";
;; ;;
"PekWM") "PekWM")