Skip to content

gtk: add install scripts, fix GTK4 dark mode switching#154

Open
hydroakri wants to merge 2 commits into
kepano:mainfrom
hydroakri:gtk-install-dark-mode
Open

gtk: add install scripts, fix GTK4 dark mode switching#154
hydroakri wants to merge 2 commits into
kepano:mainfrom
hydroakri:gtk-install-dark-mode

Conversation

@hydroakri

@hydroakri hydroakri commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Restructure gtk/ port: theme files moved under theme/, TypeScript color generator under src/
  • Add install.sh and uninstall.sh scripts for proper GTK3 + GTK4 installation
  • Fix GTK4 dark/light mode switching not responding to color-scheme gsettings

GTK4 dark mode fix

The existing documentation (and common advice) says to symlink gtk-dark.css into ~/.config/gtk-4.0/. This does not work: GTK4 only loads gtk.css from the user config directory — the gtk-dark.css dark-variant mechanism only applies to files under ~/.local/share/themes/, which libadwaita ignores entirely.

The fix is to generate a single combined gtk.css using @media (prefers-color-scheme: dark), which GTK4 4.x maps from the color-scheme gsettings value. install.sh extracts the @define-color declarations from both light and dark theme files and writes a combined file with the dark colors inside the media query block. @import paths are written as absolute paths to avoid symlink path-resolution issues.

Install

bash gtk/install.sh
# dark mode
gsettings set org.gnome.desktop.interface color-scheme prefer-dark
# light mode
gsettings set org.gnome.desktop.interface color-scheme prefer-light

Test plan

  • Run install.sh, verify GTK3 apps pick up the Flexoki theme
  • Run install.sh, toggle color-scheme between prefer-dark and prefer-light, verify GTK4/libadwaita apps switch colors without restart
  • Run uninstall.sh, verify theme files and generated CSS are removed and gsettings is reset
  • Run cd gtk/src && npm install && npm run build to verify the generator still produces correct output under the new directory structure

🤖 Generated with Claude Code

hydroakri and others added 2 commits June 2, 2026 07:27
Move theme files under theme/ and generator code under src/. Add
install.sh and uninstall.sh scripts that handle both GTK3 and GTK4.

Fix GTK4 dark/light switching: GTK4 does not load gtk-dark.css from
~/.config/gtk-4.0/ when color-scheme changes — that mechanism only
works for theme directories. install.sh now generates a single combined
gtk.css using @media (prefers-color-scheme: dark), which GTK4 4.x maps
from the color-scheme gsettings value, and uses absolute @import paths
to avoid symlink path resolution issues.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…lor-scheme

install.sh now inlines libadwaita.css and libadwaita-tweaks.css into the
generated gtk.css so the file has no external dependencies and survives
theme directory moves (catppuccin-style self-contained output).

Also: read and preserve the user's existing color-scheme preference instead
of leaving a manual post-install step; print a nudge only when still on
'default'. Fix the 400/600-series description in README (was inverted:
600-series is light-mode foreground, 400-series is dark-mode foreground).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant