aboutsummaryrefslogtreecommitdiff
path: root/programs/cwal/components/gtk4.sh
blob: d77c442bee9552898ab210e9d0245e01435e8dbf (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
#!/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)
source "$component_dir/common.sh"

CWAL_COMPONENT=gtk4
export CWAL_COMPONENT

# Breeze's named colors (shared with GTK 3) plus libadwaita's named colors.
template="$CWAL_TEMPLATES_DIR/gtk.css"
adwaita_template="$CWAL_TEMPLATES_DIR/gtk4.css"
destination="$HOME/.config/gtk-4.0/generated-cwal.css"

case ${1:-} in
detect)
    component_available gtk4-launch "$destination"
    ;;
prepare)
    require_readable 'GTK template' "$template"
    require_readable 'libadwaita template' "$adwaita_template"
    require_destination_directory GTK4 "$destination"
    ;;
generate)
    component_render theme "$destination" "$template"
    component_render_stdout "$adwaita_template" >> "$(component_temp_path theme)"
    ;;
validate)
    ;;
install)
    component_install theme "$destination"
    ;;
reload)
    ;;
summary)
    printf '  GTK 4:  %s (used by new windows)\n' "$destination"
    ;;
*)
    printf 'Usage: %s {detect|prepare|generate|validate|install|reload|summary}\n' \
        "${0##*/}" >&2
    exit 2
    ;;
esac