blob: 9d9cda80a59a10e784e7dddd2a1282ed268685b9 (
plain)
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
|
#!/usr/bin/env bash
# Copyright (C) 2026 deltegui
# SPDX-License-Identifier: GPL-3.0-or-later
set -euo pipefail
component_dir=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)
# shellcheck source=common.sh
source "$component_dir/common.sh"
CWAL_COMPONENT=rofi
export CWAL_COMPONENT
template="$CWAL_TEMPLATES_DIR/rofi.rasi"
destination="$HOME/.config/rofi/generated-theme.rasi"
case ${1:-} in
detect)
component_available rofi "$destination"
;;
prepare)
require_readable 'Rofi template' "$template"
require_destination_directory Rofi "$destination"
;;
generate)
component_render theme "$destination" "$template"
;;
validate)
temporary=$(component_temp_path theme)
validation=
if validation=$(rofi -no-config -theme "$temporary" -dump-theme 2>&1 >/dev/null); then
:
else
status=$?
printf '%s\n' "$validation" >&2
printf 'apply-theme: generated Rofi theme validation failed (status %d)\n' \
"$status" >&2
exit "$status"
fi
;;
install)
component_install theme "$destination"
;;
reload|summary)
if [[ $1 == summary ]]; then
printf ' Rofi: %s (used on next launch)\n' "$destination"
fi
;;
*)
printf 'Usage: %s {detect|prepare|generate|validate|install|reload|summary}\n' \
"${0##*/}" >&2
exit 2
;;
esac
|