Add fix-gtk4-dark.sh: repoint gtk.css symlink so GTK4/libadwaita apps go dark
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Executable
+30
@@ -0,0 +1,30 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# fix-gtk4-dark.sh — point ~/.config/gtk-4.0/gtk.css at the dark Breeze
|
||||||
|
# GTK4 stylesheet so GTK4/libadwaita apps follow the dark desktop theme.
|
||||||
|
#
|
||||||
|
# Background: KDE's GTK sync (kde-gtk-config) symlinks gtk.css to the
|
||||||
|
# LIGHT Breeze stylesheet. GTK loads that file at user priority, which
|
||||||
|
# overrides libadwaita's dark mode, so GTK4 apps render light no matter
|
||||||
|
# what. KDE may rewrite the symlink whenever "Apply" is hit on the
|
||||||
|
# GNOME/GTK Application Style settings page — re-run this script if
|
||||||
|
# GTK4 apps go light again. Restart affected apps to pick up the change.
|
||||||
|
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
dark=/usr/share/themes/Breeze/gtk-4.0/gtk-dark.css
|
||||||
|
target="$HOME/.config/gtk-4.0/gtk.css"
|
||||||
|
|
||||||
|
if [ ! -f "$dark" ]; then
|
||||||
|
echo "error: $dark not found (is breeze-gtk installed?)" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$(readlink -f "$target" 2>/dev/null)" = "$dark" ]; then
|
||||||
|
echo "already fixed: $target -> $dark"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
mkdir -p "${target%/*}"
|
||||||
|
ln -sfn "$dark" "$target"
|
||||||
|
echo "fixed: $target -> $dark"
|
||||||
|
echo "restart GTK4 apps to pick up the dark stylesheet"
|
||||||
Reference in New Issue
Block a user