139 lines
3.1 KiB
Bash
Executable file
139 lines
3.1 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
|
|
# Themes work with:
|
|
# dwm, st, dmenu, tabbed,
|
|
# xresources, wallpapers, vim,
|
|
# dunst, zsh (experimental),
|
|
# dircolors, qutebrowser, man
|
|
#
|
|
# TODO: qutebrowser userscripts, qt/qss
|
|
|
|
[ -f ~/.local/share/themes/"$1".xdefaults ] || exit -1
|
|
|
|
|
|
|
|
### XRESOURCES ###
|
|
( cd ~/.local/share/themes; cpp "$1".xdefaults > ~/.local/etc/theme)
|
|
xrdb ~/.Xresources
|
|
|
|
|
|
|
|
### DIRCOLORS ###
|
|
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
|
|
|
|
:<<'comment'
|
|
if [[ -x $(which dircolors) ]]; then
|
|
if [[ -f ~/.local/etc/dir_colors ]]; then
|
|
eval $(dircolors -b ~/.local/etc/dir_colors)
|
|
elif [[ -f /etc/dir_colors ]]; then
|
|
eval $(dircolors -b /etc/dir_colors)
|
|
else
|
|
eval $(dircolors -b)
|
|
fi
|
|
else
|
|
LS_COLORS='no=00:fi=00:di=00;34:ln=01;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.avi=01;35:*.fli=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.ogg=01;35:*.mp3=01;35:*.wav=01;35:';
|
|
export LS_COLORS
|
|
fi
|
|
export ZLS_COLORS=$LS_COLORS
|
|
comment
|
|
|
|
|
|
|
|
### BIN (MAN, ETC) ###
|
|
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
|
|
|
|
|
|
|
|
### DWM, ST, DMENU, TABBED ###
|
|
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
|
|
|
|
|
|
|
|
### WALLPAPER ###
|
|
wallres=$(xgetres wallpaper)
|
|
[[ "$wallres" != '' ]] && \
|
|
feh --bg-fill ~/.local/share/themes/"$1"-wallpapers/$( \
|
|
echo "$wallres" \
|
|
| sed "s/^.*:\s*//" \
|
|
)*
|
|
|
|
|
|
|
|
### VIM ###
|
|
rm -f ~/.local/share/themes/theme.vim
|
|
|
|
vimthemeres=$(xgetres vim.theme)
|
|
[[ "$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
|
|
|
|
|
|
|
|
### QUTEBROWSER ###
|
|
rm -f ~/.local/share/themes/theme-qutebrowser.py
|
|
|
|
qbthemeres=$(xgetres qutebrowser.theme)
|
|
[[ "$qbthemeres" != '' ]] &&
|
|
cp ~/.local/share/themes/{$( \
|
|
echo "$qbthemeres" \
|
|
| sed "s/^.*:\s*//" \
|
|
),theme-qutebrowser}.py
|
|
|
|
:<<'comment'
|
|
import os
|
|
themefile = os.getenv ('HOME') + '/.local/share/themes/theme-qutebrowser.py'
|
|
|
|
if os.path.exists (themefile) :
|
|
config.source (themefile)
|
|
else :
|
|
import dracula.draw
|
|
|
|
dracula.draw.blood (c, {
|
|
'spacing' : {
|
|
'vertical' : 6 ,
|
|
'horizontal' : 8 ,
|
|
}
|
|
})
|
|
comment
|
|
|
|
|
|
|
|
### DUNST ###
|
|
(
|
|
killall dunst
|
|
cd ~/.config/dunst
|
|
./xtheme
|
|
cat theme.h dunstrc.template | cpp > dunstrc
|
|
cd -
|
|
)
|
|
|
|
|
|
|
|
dunstify "Theme Changed
|
|
restart dwm" -t 3000
|