-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathhyprv_util
executable file
·139 lines (116 loc) · 3.61 KB
/
hyprv_util
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
#!/bin/bash
. ~/.config/HyprV/hyprv.conf
get_theme() {
# Check which waybar theme is set
THEMEIS=$(readlink -f ~/.config/waybar/style.css | cut -d '-' -f3)
#if the theme is not dark then we need to switch to it
if [[ $THEMEIS == "dark.css" ]]; then
SWITCHTO="-dark"
MODESTR="Dark"
else
SWITCHTO=""
MODESTR="Light"
fi
}
update_theme() {
#set the xfce and GTK theme
if [[ $VER == "v4" || $VERTO == "v4-" ]]; then
xfconf-query -c xsettings -p /Net/IconThemeName -s "Papirus-Dark"
gsettings set org.gnome.desktop.interface icon-theme "Papirus-Dark"
fi
}
get_ver() {
VER="v3"
}
restart_waybar() {
#restart the waybar
pkill waybar
waybar &
get_ver
if [[ $VER == "v3" ]]; then
waybar --config ~/.config/HyprV/waybar/conf/v4-config-bottom.jsonc
fi
}
set_current_background() {
get_theme
get_ver
if [[ ! -z "$SET_BG" ]]; then
#set the current background
if [[ $THEMEIS == "dark.css" ]]; then
swww img ~/.config/HyprV/backgrounds/$VER'-background-dark.jpg'
else
swww img ~/.config/HyprV/backgrounds/$VER'-background.jpg'
fi
else
swww img $SET_BG
fi
}
switch_version() {
get_theme
get_ver
case $VER in
v1)
#we are on v1 so switch to v2
VERTO="v2-"
notify-send -h string:x-canonical-private-synchronous:sys-notify -u low "switching to HyprV2"
;;
v2)
#we are on v2 so switch to v3
VERTO="v3-"
notify-send -h string:x-canonical-private-synchronous:sys-notify -u low "switching to HyprV3"
;;
v3)
#we are on v3 so switch to v4
VERTO="v4-"
notify-send -h string:x-canonical-private-synchronous:sys-notify -u low "switching to HyprV4"
;;
v4)
#we are on v4 so switch to v1
VERTO="v1-"
notify-send -h string:x-canonical-private-synchronous:sys-notify -u low "switching to HyprV1"
;;
esac
#set the waybar config
ln -sf ~/.config/HyprV/waybar/conf/$VERTO'config.jsonc' ~/.config/waybar/config.jsonc
#set the waybar theme
ln -sf ~/.config/HyprV/waybar/style/$VERTO'style'$SWITCHTO.css ~/.config/waybar/style.css
#set the wofi theme
ln -sf ~/.config/HyprV/wofi/style/$VERTO'style'$SWITCHTO.css ~/.config/wofi/style.css
#set the background
if [ -z $SET_BG ]; then
swww img ~/.config/HyprV/backgrounds/$VERTO'background'$SWITCHTO.jpg --transition-fps 60 --transition-type wipe --transition-duration 2
else
swww img $SET_BG --transition-fps 60 --transition-type wipe --transition-duration 2
fi
#update the sddm image
cp -f ~/.config/HyprV/backgrounds/$VERTO'background'$SWITCHTO.jpg /usr/share/sddm/themes/sdt/wallpaper.jpg
}
switch_keyboard() {
hyprctl switchxkblayout $SET_KB next
}
if [[ "$1" == "vswitch" ]]; then
switch_version
update_theme
restart_waybar
elif [[ "$1" == "setbg" ]]; then
set_current_background
update_theme
restart_waybar
elif [[ "$1" == "swkb" ]]; then
switch_keyboard
restart_waybar
fi
# need to show the version and tooltip
get_ver
TOOLTIP='Default Keybinds\n'\
'SUPER + Q = Start Kitty\n'\
'SUPER + F4 = Close Window\n'\
'SUPER + L = Lock Screen\n'\
'SUPER + M = Logout menu\n'\
'SUPER + E = File Manager\n'\
'SUPER + V = Toggle Float\n'\
'SUPER + SPACE = App Launcher\n'\
'SUPER + S = Screenshot\n'\
'SUPER + T = Switch HyprV version\n'\
'ALT + V = Open clipboard manager'
echo '{"text": "'$VER'", "tooltip": "'$TOOLTIP'"}'