themes/settheme

75 lines
1.7 KiB
Text
Raw Normal View History

2022-03-14 22:38:27 +01:00
#!/usr/bin/env bash
# Themes work with:
# dwm, st, dmenu, tabbed,
# xresources, wallpapers, vim,
# dunst, zsh (experimental), ls
[ -f ~/.local/share/themes/"$1".xdefaults ] || exit -1
2022-03-20 12:47:57 +01:00
( cd ~/.local/share/themes; cpp "$1".xdefaults > ~/.local/etc/theme)
2022-03-14 22:38:27 +01:00
if [ -f ~/.local/share/themes/"$1".dir_colors ]
then
cp ~/.local/share/themes/"$1".dir_colors ~/.local/etc/dir_colors
else
rm ~/.local/etc/dir_colors
fi
rm -rf ~/.local/share/themes/bin
[ -d ~/.local/share/themes/"$1"-bin ] && cp -r ~/.local/share/themes/{"$1"-,}bin
:<<'comment'
export PATH="$HOME/.local/share/themes/bin:$PATH"
comment
xrdb ~/.Xresources
b1="$(mktemp)"
mv ~/.local/bin/st-autocomplete $b1
echo -e "dwm\nst\ndmenu\ntabbed" |
while read t
do
2022-03-20 12:47:57 +01:00
(cd ~/.local/src/$t && (make clean ; ./xtheme ; make PREFIX=$HOME/.local install ; make clean) ; cd -)
2022-03-14 22:38:27 +01:00
done
mv $b1 ~/.local/bin/st-autocomplete
wallres=$(cat ~/.local/share/themes/"$1".xdefaults | grep -P "^wallpaper:\s*\S*$" -m 1)
[[ "$wallres" != '' ]] && \
feh --bg-fill ~/.local/share/themes/"$1"-wallpapers/$( \
echo "$wallres" \
| sed "s/^.*:\s*//" \
)*
rm -f ~/.local/share/themes/theme.vim
vimthemeres=$(cat ~/.local/share/themes/"$1".xdefaults | grep -P "^vim\*?\.?theme:\s*\S*$" -m 1)
[[ "$vimthemeres" != '' ]] && \
cp ~/.local/share/themes/{$( \
echo "$vimthemeres" \
| sed "s/^.*:\s*//" \
),theme}.vim
:<<'comment'
set background=dark
let themefile = '~/.local/share/themes/theme.vim'
if filereadable (expand (themefile))
execute 'source' themefile
else
color leet2
endif
comment
(
killall dunst
cd ~/.config/dunst
./xtheme
cat theme.h dunstrc.template | cpp > dunstrc
cd -
)
dunstify "Theme Changed
restart dwm" -t 3000