blob: 2ed8bf2659080157b0bf140cd37b87d6ea4cfb76 (
plain) (
blame)
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
|
#!/usr/bin/env bash
# /* ---- 💫 https://github.com/LinuxBeginnings 💫 ---- */ ##
# Script for waybar styles
IFS=$'\n\t'
# Define directories
waybar_styles="$HOME/.config/waybar/style"
waybar_style="$HOME/.config/waybar/style.css"
SCRIPTSDIR="$HOME/.config/hypr/scripts"
rofi_config="$HOME/.config/rofi/config-waybar-style.rasi"
msg=' 🎌 NOTE: Some waybar STYLES NOT fully compatible with some LAYOUTS'
# Apply selected style
apply_style() {
ln -sf "$waybar_styles/$1.css" "$waybar_style"
"${SCRIPTSDIR}/Refresh.sh" &
}
main() {
# resolve current symlink and strip .css
current_target=$(readlink -f "$waybar_style")
current_name=$(basename "$current_target" .css)
# gather all style names (without .css) into an array
mapfile -t options < <(
find -L "$waybar_styles" -maxdepth 1 -type f -name '*.css' \
-exec basename {} .css \; \
| sort
)
# mark the active style and record its index
default_row=0
MARKER="👉"
for i in "${!options[@]}"; do
if [[ "${options[i]}" == "$current_name" ]]; then
options[i]="$MARKER ${options[i]}"
default_row=$i
break
fi
done
# launch rofi with the annotated list and pre‑selected row
choice=$(printf '%s\n' "${options[@]}" \
| rofi -i -dmenu \
-config "$rofi_config" \
-mesg "$msg" \
-selected-row "$default_row"
)
[[ -z "$choice" ]] && { echo "No option selected. Exiting."; exit 0; }
# remove annotation and apply
choice=${choice#"$MARKER "}
apply_style "$choice"
}
# Kill Rofi if already running before execution
if pgrep -x "rofi" >/dev/null; then
pkill rofi
#exit 0
fi
main
|