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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
|
#!/usr/bin/env bash
# User interaction helpers extracted from copy.sh. Each helper echoes state or sets
# globals deliberately to minimize side effects.
# Detect keyboard layout via localectl or setxkbmap.
prompt_detect_layout() {
if command -v localectl >/dev/null 2>&1; then
local layout
layout=$(localectl status --no-pager | awk '/X11 Layout/ {print $3}')
[ -n "$layout" ] && { echo "$layout"; return; }
fi
if command -v setxkbmap >/dev/null 2>&1; then
local layout
layout=$(setxkbmap -query | awk '/layout/ {print $2}')
[ -n "$layout" ] && { echo "$layout"; return; }
fi
echo "(unset)"
}
# Confirm or set keyboard layout; writes to SystemSettings.conf.
prompt_keyboard_layout() {
local layout="$1"
local log="$2"
if [ "$layout" = "(unset)" ]; then
while true; do
printf "\n%.0s" {1..1}
print_color $WARNING "\n █▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀█
STOP AND READ
█▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄█
!!! IMPORTANT WARNING !!!
The Default Keyboard Layout could not be detected
You need to set it Manually
!!! WARNING !!!
Setting a wrong Keyboard Layout will cause Hyprland to crash
If you are not sure, just type ${YELLOW}us${RESET}
${SKYBLUE}You can change later in ~/.config/hypr/UserConfigs/UserSettings.conf${RESET}
${MAGENTA} NOTE:${RESET}
• You can also set more than 2 keyboard layouts
• For example: ${YELLOW}us, kr, gb, ru${RESET}
"
printf "\n%.0s" {1..1}
echo -n "${CAT} - Please enter the correct keyboard layout: "
read new_layout
if [ -n "$new_layout" ]; then
layout="$new_layout"
break
else
echo "${CAT} Please enter a keyboard layout."
fi
done
fi
printf "${NOTE} Detecting keyboard layout to prepare proper Hyprland Settings\n"
while true; do
printf "${INFO} Current keyboard layout is ${MAGENTA}$layout${RESET}\n"
echo -n "${CAT} Is this correct? [y/n] "
read keyboard_layout
case $keyboard_layout in
[yY])
awk -v layout="$layout" '/kb_layout/ {$0 = " kb_layout = " layout} 1' config/hypr/configs/SystemSettings.conf >temp.conf
mv temp.conf config/hypr/configs/SystemSettings.conf
echo "${NOTE} kb_layout ${MAGENTA}$layout${RESET} configured in settings." 2>&1 | tee -a "$log"
break
;;
[nN])
printf "\n%.0s" {1..2}
print_color $WARNING "
█▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀█
STOP AND READ
█▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄█
!!! IMPORTANT WARNING !!!
The Default Keyboard Layout could not be detected
You need to set it Manually
!!! WARNING !!!
Setting a wrong Keyboard Layout will cause Hyprland to crash
If you are not sure, just type ${YELLOW}us${RESET}
${SKYBLUE}You can change later in ~/.config/hypr/UserConfigs/UserSettings.conf${RESET}
${MAGENTA} NOTE:${RESET}
• You can also set more than 2 keyboard layouts
• For example: ${YELLOW}us, kr, gb, ru${RESET}
"
printf "\n%.0s" {1..1}
echo -n "${CAT} - Please enter the correct keyboard layout: "
read new_layout
awk -v new_layout="$new_layout" '/kb_layout/ {$0 = " kb_layout = " new_layout} 1' config/hypr/configs/SystemSettings.conf >temp.conf
mv temp.conf config/hypr/configs/SystemSettings.conf
echo "${OK} kb_layout $new_layout configured in settings." 2>&1 | tee -a "$log"
break
;;
*)
echo "${ERROR} Please enter either 'y' or 'n'."
;;
esac
done
}
# Prompt for resolution choice; echoes "< 1440p" or "≥ 1440p".
prompt_resolution_choice() {
local choice
while true; do
echo "${NOTE} ${SKY_BLUE} By default, KooL's Dots are configured for 1440p or 2k."
echo "${WARN} If you dont select proper resolution, Hyprlock will look FUNKY!"
echo "${INFO} If you are not sure what is your resolution, choose 1 here!"
echo "${MAGENTA}Select monitor resolution to properly configure appearance and fonts:"
echo "$YELLOW -- Enter 1. for monitor resolution less than 1440p (< 1440p)"
echo "$YELLOW -- Enter 2. for monitor resolution equal to or higher than 1440p (≥ 1440p)"
echo -n "$CAT Enter the number of your choice (1 or 2): "
read choice
case $choice in
1) echo "< 1440p"; return ;;
2) echo "≥ 1440p"; return ;;
*) echo "${ERROR} Invalid choice. Please enter 1 for < 1440p or 2 for ≥ 1440p." ;;
esac
done
}
# Prompt for 12H clock; sets waybar/hyprlock/SDDM changes when accepted.
prompt_clock_12h() {
local log="$1"
while true; do
echo -e "${NOTE} ${SKY_BLUE} By default, KooL's Dots are configured in 24H clock format."
echo -n "$CAT Do you want to change to 12H (AM/PM) clock format? (y/n): "
read answer
answer=$(echo "$answer" | tr '[:upper:]' '[:lower:]')
if [[ "$answer" == "y" ]]; then
# waybar clocks
sed -i 's#^\(\s*\)//\("format": " {:%I:%M %p}",\) #\1\2 #g' config/waybar/Modules 2>&1 | tee -a "$log"
sed -i 's#^\(\s*\)\("format": " {:%H:%M:%S}",\) #\1//\2#g' config/waybar/Modules 2>&1 | tee -a "$log"
sed -i 's#^\(\s*\)\("format": " {:%H:%M}",\) #\1//\2#g' config/waybar/Modules 2>&1 | tee -a "$log"
sed -i 's#^\(\s*\)//\("format": "{:%I:%M %p - %d/%b}",\) #\1\2#g' config/waybar/Modules 2>&1 | tee -a "$log"
sed -i 's#^\(\s*\)\("format": "{:%H:%M - %d/%b}",\) #\1//\2#g' config/waybar/Modules 2>&1 | tee -a "$log"
sed -i 's#^\(\s*\)//\("format": "{:%B | %a %d, %Y | %I:%M %p}",\) #\1\2#g' config/waybar/Modules 2>&1 | tee -a "$log"
sed -i 's#^\(\s*\)\("format": "{:%B | %a %d, %Y | %H:%M}",\) #\1//\2#g' config/waybar/Modules 2>&1 | tee -a "$log"
sed -i 's#^\(\s*\)//\("format": "{:%A, %I:%M %P}",\) #\1\2#g' config/waybar/Modules 2>&1 | tee -a "$log"
sed -i 's#^\(\s*\)\("format": "{:%a %d | %H:%M}",\) #\1//\2#g' config/waybar/Modules 2>&1 | tee -a "$log"
# hyprlock
local HYPRLOCK_FILE="config/hypr/hyprlock.conf"
if [ ! -f "$HYPRLOCK_FILE" ] && [ -f "config/hypr/hyprlock-1080p.conf" ]; then
HYPRLOCK_FILE="config/hypr/hyprlock-1080p.conf"
fi
if [ -f "$HYPRLOCK_FILE" ]; then
sed -i 's/^\s*text = cmd\[update:1000\] echo \"\$(date +\"%H\")\"/# &/' "$HYPRLOCK_FILE" 2>&1 | tee -a "$log"
sed -i 's/^\(\s*\)# *text = cmd\[update:1000\] echo \"\$(date +\"%I\")\" #AM\/PM/\1 text = cmd\[update:1000\] echo \"\$(date +\"%I\")\" #AM\/PM/' "$HYPRLOCK_FILE" 2>&1 | tee -a "$log"
sed -i 's/^\s*text = cmd\[update:1000\] echo \"\$(date +\"%S\")\"/# &/' "$HYPRLOCK_FILE" 2>&1 | tee -a "$log"
sed -i 's/^\(\s*\)# *text = cmd\[update:1000\] echo \"\$(date +\"%S %p\")\" #AM\/PM/\1 text = cmd\[update:1000\] echo \"\$(date +\"%S %p\")\" #AM\/PM/' "$HYPRLOCK_FILE" 2>&1 | tee -a "$log"
else
echo "${WARN} hyprlock template not found; skipping 12H lock format edits" 2>&1 | tee -a "$log"
fi
# SDDM themes
apply_sddm_12h_format "/usr/share/sddm/themes/simple-sddm" "$log"
apply_sddm_12h_format "/usr/share/sddm/themes/simple_sddm_2" "$log"
apply_sddm_12h_format_sequoia "/usr/share/sddm/themes/sequoia_2" "$log"
echo "${OK} 12H format set on waybar clocks succesfully." 2>&1 | tee -a "$log"
return
elif [[ "$answer" == "n" ]]; then
echo "${NOTE} You chose not to change to 12H format." 2>&1 | tee -a "$log"
return
else
echo "${ERROR} Invalid choice. Please enter y for yes or n for no."
fi
done
}
apply_sddm_12h_format() {
local sddm_directory="$1"
local log="$2"
if [ -d "$sddm_directory" ]; then
echo "Editing ${SKY_BLUE}$sddm_directory${RESET} to 12H format" 2>&1 | tee -a "$log"
sudo sed -i 's|^## HourFormat=\"hh:mm AP\"|HourFormat=\"hh:mm AP\"|' "$sddm_directory/theme.conf" 2>&1 | tee -a "$log" || true
sudo sed -i 's|^HourFormat=\"HH:mm\"|## HourFormat=\"HH:mm\"|' "$sddm_directory/theme.conf" 2>&1 | tee -a "$log" || true
fi
}
apply_sddm_12h_format_sequoia() {
local sddm_directory="$1"
local log="$2"
if [ -d "$sddm_directory" ]; then
echo "${YELLOW}sddm sequoia_2${RESET} theme exists. Editing to 12H format" 2>&1 | tee -a "$log"
sudo sed -i 's|^clockFormat=\"HH:mm\"|## clockFormat=\"HH:mm\"|' "$sddm_directory/theme.conf" 2>&1 | tee -a "$log" || true
if ! grep -q 'clockFormat=\"hh:mm AP\"' "$sddm_directory/theme.conf"; then
sudo sed -i '/^clockFormat=/a clockFormat=\"hh:mm AP\"' "$sddm_directory/theme.conf" 2>&1 | tee -a "$log" || true
fi
echo "${OK} 12H format set to SDDM successfully." 2>&1 | tee -a "$log"
fi
}
# Rainbow borders toggle; returns "disabled" or "kept".
prompt_rainbow_borders() {
local log="$1"
echo "${NOTE} ${SKY_BLUE}By default, Rainbow Borders animation is enabled"
echo "${WARN} However, this uses a bit more CPU and Memory resources."
echo -n "${CAT} Do you want to disable Rainbow Borders animation? (y/N): "
read border_choice
if [[ "$border_choice" =~ ^[Yy]$ ]]; then
mv config/hypr/UserScripts/RainbowBorders.sh config/hypr/UserScripts/RainbowBorders.bak.sh
sed -i '/exec-once = \$UserScripts\/RainbowBorders.sh/s/^/#/' config/hypr/configs/Startup_Apps.conf
sed -i '/^[[:space:]]*animation = borderangle, 1, 180, liner, loop/s/^/#/' config/hypr/configs/UserAnimations.conf
echo "${OK} Rainbow borders are now disabled." 2>&1 | tee -a "$log"
echo "disabled"
else
echo "${NOTE} No changes made. Rainbow borders remain enabled." 2>&1 | tee -a "$log"
echo "kept"
fi
}
# Express upgrade confirmation; may set EXPRESS_MODE=1.
prompt_express_upgrade() {
local express_supported="$1"
local log="$2"
if [ "$EXPRESS_MODE" -eq 1 ] && [ "$express_supported" -eq 0 ]; then
echo "${NOTE} Express mode requires installed dotfiles v${MIN_EXPRESS_VERSION} or newer. Continuing with standard upgrade prompts." 2>&1 | tee -a "$log"
EXPRESS_MODE=0
return
fi
if [ "$UPGRADE_MODE" -eq 1 ] && [ "$EXPRESS_MODE" -eq 0 ]; then
if [ "$express_supported" -eq 0 ]; then
echo "${NOTE} Express mode requires installed dotfiles v${MIN_EXPRESS_VERSION} or newer. Continuing with standard upgrade prompts." 2>&1 | tee -a "$log"
else
while true; do
echo "${NOTE} Express mode skips config restore prompts, SDDM/background questions, and trims old backups."
echo -n "${CAT} Do you want to continue with EXPRESS upgrade mode? (y/N): "
read express_choice
case "$express_choice" in
[Yy])
EXPRESS_MODE=1
echo "${INFO} Express mode enabled for this upgrade." 2>&1 | tee -a "$log"
break
;;
[Nn] | "")
echo "${NOTE} Continuing with standard upgrade prompts." 2>&1 | tee -a "$log"
break
;;
*)
echo "${WARN} Please answer y or n."
;;
esac
done
fi
fi
}
|