summaryrefslogtreecommitdiff
path: root/bin/guiscripts/newwal
blob: b91355243d05daaf75ff3b20034f680fe14f0b28 (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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/bin/sh
# Dependency check
which swaybg wal identify > /dev/null || exit 1

wall="$HOME/pics/wallpaper"
walls="$HOME/pics/wallpapers"
walcache="$HOME/.cache/wal"
res="1920x1080"

# if no (valid) argument, use find any image with $res resolution
# and take a random one
test -f "${wal:=$(realpath "$1")}" ||
	wal="$(find "$walls" -type f |
		xargs identify |
		grep "$res" |
		awk '{print $1}' |
		shuf -n 1)"

ln -sf "$wal"  "$wall"
pkill swaybg # There should be only one
swaybg -i "$wall" &
wal -c
wal -i "$wall"

# foot
. "$walcache/colors.sh"
rm -f "$HOME/.config/foot/colors"
cat <<EOF | tr -d '#' > "$HOME/.config/foot/colors"
[colors]
foreground = $foreground
background = $background

regular0 = $color0
regular1 = $color1
regular2 = $color2
regular3 = $color3
regular4 = $color4
regular5 = $color5
regular6 = $color6
regular7 = $color7

bright0 = $color8
bright1 = $color9
bright2 = $color10
bright3 = $color11
bright4 = $color12
bright5 = $color13
bright6 = $color14
bright7 = $color15
EOF

cat <<EOF > $HOME/.config/tofi/themes/colors
# tofi
text-color = $foreground
prompt-color = $color4
placeholder-color = $color12
input-color = $foreground
default-result-color = $color6
selection-color = $color8
selection-match-color = $color7

background-color = ${background}f0

outline-color = $color4

border-color = $color6
EOF

# waybar
ln -sf "$walcache/colors-waybar.css" "$HOME/.config/waybar/colors.css"
pkill -USR2 waybar
pywalfox update