summaryrefslogtreecommitdiff
path: root/.config/wmii-hg/theme-emacs
blob: a45901c51ca8891a5eeb41caad03af200a521178 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/hint/bash
# Get theme settings from Emacs

# emacs_unquote QUOTED_STRING
emacs_unquote() {
	local str="$*"
	if [[ $str =~ ^\"(.*)\"$ ]]; then
		str=${BASH_REMATCH[1]} # un-quote it
		str="${str//\\\\/\\}" # \\ -> \
		str="${str//\\\"/\"}" # \" -> "
		str="${str//\\n/$'\n'}" # \n -> NL
	fi
	printf '%s' "$str"
}

eval "$(emacs_unquote "$(emacsclient --eval "(when (load \"${WMII_CONFPATH}/theme-emacs.el\") (wmii-theme-for-display \"${DISPLAY}\"))")")"