Give libadwaita applications the desktop's accent
Files, Papers, Loupe and every other libadwaita application read their accent from the Settings portal, so they rendered in GNOME blue no matter which accent this desktop was set to -- correct on our own surfaces, wrong on half the screen. xdg-desktop-portal-gtk cannot serve org.freedesktop.appearance accent-color at all; the string does not appear in the 1.15.3 binary. The gnome backend serves it, so Settings now routes to gnome with gtk still listed behind it -- the frontend merges Settings backends in order, so color-scheme keeps resolving if the gnome backend is ever unavailable. GNOME's accent-color is a fixed enum of nine names rather than a color, so each of our eight accents carries its nearest member. Nearest by hue rather than by name: rose maps to red, because it is the red role in this palette. Claude-Session: https://claude.ai/code/session_01BRvzt4H8XXLPVH5MyYdk9L
This commit is contained in:
@@ -204,6 +204,46 @@ for gtk_version in 3.0 4.0; do
|
||||
fi
|
||||
done
|
||||
|
||||
# ── libadwaita accent ────────────────────────────────────────────────────────
|
||||
# Files, Papers, Loupe and every other libadwaita application read their accent
|
||||
# from the Settings portal, not from anything Panama draws, so without this they
|
||||
# render in GNOME blue no matter which accent the desktop is set to.
|
||||
#
|
||||
# GNOME's accent-color is a FIXED enum of nine names -- there is no hex here to
|
||||
# match, only a nearest member to pick -- so this maps our eight to theirs. Kept
|
||||
# in sync by hand with config/Theme.qml's `gnome` field, for the same reason
|
||||
# accent_hex() above is: there is no shared source between QML and shell.
|
||||
#
|
||||
# The portal must route Settings to the gnome backend for this to reach
|
||||
# anything; xdg-desktop-portal-gtk cannot serve accent-color at all. See
|
||||
# config/dot/xdg-desktop-portal/hyprland-portals.conf.
|
||||
gnome_accent() {
|
||||
case "$1" in
|
||||
orchid) printf 'purple' ;;
|
||||
teal) printf 'teal' ;;
|
||||
green) printf 'green' ;;
|
||||
amber) printf 'yellow' ;;
|
||||
orange) printf 'orange' ;;
|
||||
rose) printf 'red' ;;
|
||||
slate) printf 'slate' ;;
|
||||
*) printf 'blue' ;;
|
||||
esac
|
||||
}
|
||||
|
||||
status_adwaita="skipped"
|
||||
if command -v gsettings >/dev/null 2>&1; then
|
||||
adwaita_accent="$(gnome_accent "$accent")"
|
||||
# Writing the same value emits no change signal, so applications already
|
||||
# showing this accent are not asked to restyle for nothing.
|
||||
if [[ "$(gsettings get org.gnome.desktop.interface accent-color 2>/dev/null)" == "'$adwaita_accent'" ]]; then
|
||||
status_adwaita="unchanged"
|
||||
elif gsettings set org.gnome.desktop.interface accent-color "$adwaita_accent" 2>/dev/null; then
|
||||
status_adwaita="$adwaita_accent"
|
||||
else
|
||||
status_adwaita="failed"
|
||||
fi
|
||||
fi
|
||||
|
||||
kitty_dir="${XDG_CONFIG_HOME:-$HOME/.config}/kitty"
|
||||
theme_file="$kitty_dir/themes/tokyonight-moon.conf"
|
||||
[[ "$scheme" == "light" ]] && theme_file="$kitty_dir/themes/tokyonight-day.conf"
|
||||
@@ -250,4 +290,5 @@ jq -cn \
|
||||
--arg btop "$status_btop" \
|
||||
--arg tmux "$status_tmux" \
|
||||
--arg hyprlock "$status_hyprlock" \
|
||||
'{scheme: $scheme, kitty: $kitty, gtk: $gtk, btop: $btop, tmux: $tmux, hyprlock: $hyprlock}'
|
||||
--arg adwaita "$status_adwaita" \
|
||||
'{scheme: $scheme, kitty: $kitty, gtk: $gtk, btop: $btop, tmux: $tmux, hyprlock: $hyprlock, adwaita: $adwaita}'
|
||||
|
||||
Reference in New Issue
Block a user