-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathswitch-theme
executable file
·91 lines (78 loc) · 2.95 KB
/
switch-theme
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#! /bin/sh
#-- switch-theme --#
# A script to switch the GTK, Qt, dunst, and BetterDiscord themes.
# $1 - wallpaper filename (`mountain` resolves to ~/Pictures/Wallpapers/mountain.jpg)
# Dependencies:
# - wal
# - feh
# - wallmaker (my wallpaper maker script) (optional)
# - sassc
# - themix-theme-oomox-git
# - bspwm
# - dunst-start (my dunst script)
# ~ ADIGEN
###############
## rofi menu ##
###############
w=$1
# If no arguments were passed, return the available options. Not combined with the
# if statements below for neatness
if [ -z "$w" ]; then
ls ~/Pictures/Wallpapers | sed '/^$/d' | sed 's/\.[^.]*$//' | sed 's/.*/\u&/'
exit 0
else
# Uncapitalize first character
w=`echo $w | sed 's/.*/\l&/'`
fi
complete -W "$(ls ~/Pictures/Wallpapers | sed '/^$/d' | sed 's/\.[^.]*$//' | sed 's/.*/\u&/')" "$(basename "${0}")"
#########
## wal ##
#########
# If the wallpaper filename contains 'gradient',
# means it was generated by `wallgrad`. Set the background color
# (This is done as usually those wallpapers generate a ridiculously bright background color)
if [[ $w = "gradient" ]]; then # If the choice was 'gradient', just generate a new wallpaper
wallgrad
exit 0
elif [[ $w =~ "gradient" ]]; then # If the choice contained 'gradient', go ahead normally except set the background color
wal -i $HOME/Pictures/Wallpapers/${w}.* -b '#101622'
else
wal -i $HOME/Pictures/Wallpapers/${w}.*
fi
source ~/.cache/wal/colors.sh
#########
## feh ##
#########
#feh --bg-fill --conversion-timeout 100 $HOME/Pictures/Wallpapers/${1}.*
#$(wallmaker `cat ~/.cache/wal/wal` $HOME/Pictures/Wallpapers/generated.png 50 50 `emos` && feh --bg-fill $HOME/Pictures/Wallpapers/generated.png) &
#############
## Discord ##
#############
mkdir -p ~/.config/BetterDiscord/themes
{ echo -n '//META{"name":"wal","description":"Script generated theme mashing an existing theme with pywal colors.","author":"ADIGEN","version":"2.0","source":"https://github.com/mradigen/dotfiles/blob/main/.local/bin/switch-theme","website":"https://github.com/mradigen/dotfiles"}*//'; sassc -t compact -I $HOME/.config/wal-discord -s < $HOME/.config/wal-discord/master.scss; } > $HOME/.config/BetterDiscord/themes/wal.theme.css &&
###########
## Dunst ##
###########
DUNST_FILE=~/.config/dunst/dunstrc
# Update dunst based on pywal colors.
sed -i '/background = /s/.*/ background = "'$color0'"/' $DUNST_FILE
sed -i '/foreground = /s/.*/ foreground = "'$color7'"/' $DUNST_FILE
sed -i '/frame_color = /s/.*/ frame_color = "'$color5'"/' $DUNST_FILE
# Not needed, dunst gets autostarted from dbus anyways
#killall -q dunst; dunst & disown
killall -q dunst
##############
## GTK & Qt ##
##############
oomox-cli -o wal -t $HOME/.local/share/themes $HOME/.cache/wal/colors-oomox &&
###########
## BSPWM ##
###########
bspc config normal_border_color "$color0"
bspc config active_border_color "$color0"
bspc config focused_border_color "$color5"
bspc config presel_feedback_color "$color1"
#############
## OpenRGB ##
#############
lights