blob: 07fca737a1dfaccf200ee8de3aa8aa9a3617eee1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
#!/bin/zsh
function colo {
# Change environment variable
export COLORSCHEME=$1
export BACKGROUND=$2
if [[ -z ${BACKGROUND} ]]; then
XRESOURCE=~/.Xresources/${COLORSCHEME}
else
XRESOURCE=~/.Xresources/${COLORSCHEME}-${BACKGROUND}
fi
# Change colors for current session
$HOME/bin/recolor < ${XRESOURCE}
# Load Xresources file for future sessions
xrdb -I$HOME ${XRESOURCE}
# Change default environment variable for future sessions
sed -i --follow-symlinks "s/^export COLORSCHEME=.*$/export COLORSCHEME=${COLORSCHEME}/g" ~/.zsh/tmp
sed -i --follow-symlinks "s/^export COLORSCHEME=.*$/export BACKGROUND=${BACKGROUND}/g" ~/.zsh/tmp
}
# Completion for colorschemes
compctl -k "($(ls ${HOME}/.Xresources))" colo
|