blob: 1ae1060faf8ed4f31a4b9cd13e2443725f82d206 (
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
|
#!/usr/bin/env bash
set -euo pipefail
# SPDX-FileCopyrightText: 2025-present Ahum Maitra theahummaitra@gmail.com
#
# SPDX-License-Identifier: GPL-3.0-or-later
# Repository url : https://github.com/TheAhumMaitra/cautious-waddle
require() {
command -v "$1" >/dev/null 2>&1 || {
printf '%s\n' "Missing dependency: $1" >&2
exit 127
}
}
require wallust
require rofi
# notify-send is optional
have_notify() { command -v notify-send >/dev/null 2>&1; }
# Prompt for theme; guard -e on cancel
set +e
choice="$(wallust theme list \
| sed -e '1d' -e 's/^- //' \
| rofi -dmenu -i -p 'Select Global Theme')"
prompt_status=$?
set -e
# Exit cleanly on cancel or empty selection
if (( prompt_status != 0 )) || [[ -z "${choice}" ]]; then
exit 0
fi
# Apply the theme and report result
if wallust theme -- "${choice}"; then
have_notify && notify-send -a ThemeChanger \
-h string:x-dunst-stack-tag:themechanger \
"Global theme changed" "Selected: ${choice}"
# Give wallust a brief moment to finish writing templates
sleep 0.15
# Prefer the same refresh path used by WallpaperSelect to avoid CSS race/fallbacks
if [ -x "$HOME/.config/hypr/scripts/Refresh.sh" ]; then
"$HOME/.config/hypr/scripts/Refresh.sh" >/dev/null 2>&1 || true
else
# Fallback: reload Waybar only
if command -v waybar-msg >/dev/null 2>&1; then
waybar-msg cmd reload >/dev/null 2>&1 || true
else
pkill -SIGUSR2 waybar >/dev/null 2>&1 || true
fi
fi
else
have_notify && notify-send -u critical -a ThemeChanger \
-h string:x-dunst-stack-tag:themechanger \
"Failed to apply theme" "${choice}"
exit 1
fi
|