themes/settheme
GasparVardanyan 5f7ca1378e update
2022-03-06 20:42:38 +04:00

69 lines
1.6 KiB
Bash
Executable file

#!/bin/sh
# Themes work with:
# dwm, st, dmenu, tabbed,
# xresources, wallpapers, vim,
# dunst, zsh (experimental), ls
[ -f ~/.local/share/themes/"$1".xdefaults ] || exit -1
cp ~/.local/share/themes/"$1".xdefaults ~/.local/etc/theme
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
echo -e "dwm\nst\ndmenu\ntabbed" |
while read t
do
(cd ~/.local/src/$t && make clean && ./xtheme && make PREFIX=$HOME/.local install ; make clean ; cd -)
done
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