summaryrefslogtreecommitdiff
path: root/scripts/.local/bin/colorset
blob: 5a20b4065c16c33582030f1b86ee336c9c7a472a (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
28
#!/bin/sh

if [ $# -eq 0 ]; then
	wal -f "$WAL_THEME"
else
	wal -i "$1"
fi


# Checking for non-existant dirs
! [ -f "$SRC"/colors/dmenu ] && mkdir -p "$SRC"/colors/dmenu
! [ -f "$SRC"/colors/dwm ] && mkdir -p "$SRC"/colors/dwm
! [ -f "$SRC"/colors/st ] && mkdir -p "$SRC"/colors/st

# Setting the new colorscheme based on the wallpaper and making some color tweaks
cp -rf ~/.cache/wal/colors-wal-dmenu.h "$SRC"/colors/dmenu/colors.h
cp -rf ~/.cache/wal/colors-wal-st.h "$SRC"/colors/st/colors.h
head -7 ~/.cache/wal/colors-wal-dwm.h > "$SRC"/colors/dwm/colors.h
sed -i s/"$(grep norm_border "$SRC"/colors/dwm/colors.h | cut -d# -f 2 | cut -d\" -f 1)"/"$(grep black "$SRC"/colors/st/colors.h | head -1 | cut -d# -f 2 | cut -d\" -f 1)"/g "$SRC"/colors/dwm/colors.h

# Recompiling Suckless Programs with new colorscheme
cp -rf "$SRC"/colors/* "$SRC"

if [ $# -gt 0 ]; then
	walset "$1"
fi

cd "$SRC" && ./compileSource