Add a GTK4 / libadwaita theme - #439
Open
george-petrakis wants to merge 1 commit into
Open
george-petrakis wants to merge 1 commit into
george-petrakis wants to merge 1 commit into
Conversation
Chicago95 has had no GTK4 stylesheet, so every GTK4 app - and in particular every libadwaita app, which is most of GNOME now - has been unthemed. This adds Theme/Chicago95/gtk-4.0/, written against GTK 4.22 and libadwaita 1.9, plus the installer and docs changes needed for it to actually take effect. The sheet is split the same way gtk-3.0 is, with gtk.css owning the palette, the global resets and the @import list: gtk.css palette, libadwaita colour overrides, resets, imports gtk-widgets.css button, entry, check/radio, switch, spin, scale, progress gtk-containers.css window/CSD titlebar, windowcontrols, notebook, scrollbar gtk-lists.css listview, columnview, gridview, treeexpander, sidebars gtk-menus.css popovers, menus, dropdowns, tooltips, dialogs, toasts gtk-adwaita.css AdwToolbarView, preferences rows, .boxed-list, tabs, etc. gtk-dark.css dark-variant entry point (Chicago95 has one look) settings.ini theme-level GTK settings Why the delivery path is what it is. libadwaita does not honour gtk-theme: on init it sets gtk-theme-name to "Adwaita-empty" (a real, zero-byte stylesheet inside libgtk) and installs its own providers at PRIORITY_THEME, so a theme directory is read and then discarded. The one hook that survives is $XDG_CONFIG_HOME/gtk-4.0/gtk.css, which GTK loads at PRIORITY_USER (800) and which therefore outranks libadwaita's own sheet. So installer.py now also installs the sheet there, behind a marker-delimited block with a backup, and disable_gtk4_user_css() removes it again. GTK_THEME= is deliberately not the recommended route: it makes libadwaita skip loading its stylesheet entirely, which leaves its widgets unstyled rather than restyled. installer.py additionally grows a GNOME branch that configures the theme with gsettings instead of xfconf-query, and picks the branch from XDG_CURRENT_DESKTOP rather than assuming Xfce. INSTALL.md documents the limits honestly: GNOME Shell itself is not themed, snap and flatpak apps are not covered, and window decorations are CSD under Mutter so the xfwm4 themes do not apply. Verified on GTK 4.22.4 / libadwaita 1.9.1: the whole sheet parses with zero errors through GtkCssProvider; the Chicago95 palette resolves in both a libadwaita and a plain-GTK4 process; gtk4-widget-factory and adwaita-1-demo both run with no GTK warnings; and all 44 relative url() asset references resolve. Not verified: GNOME Shell, snaps/flatpaks, HiDPI, and RTL. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a GTK4 / libadwaita stylesheet to Chicago95. This addresses #256 ("Theme not applying to GTK-4") and covers the GTK4 part of #363 ("use this on gnome?").
At the moment every GTK4 app is unthemed, and on a current GNOME that covers most of the desktop, since Files, Settings, Text Editor and Console are all libadwaita.
Why the earlier GTK4 attempts didn't stick
The prototype in #256 was abandoned in 2024. The reason matters, because it dictates how this has to be shipped.
libadwaita ignores
gtk-theme. Onadw_init()it setsgtk-theme-nametoAdwaita-empty, which is a real stylesheet shipped inside libgtk that contains zero bytes, and then installs its own three providers atGTK_STYLE_PROVIDER_PRIORITY_THEME(200). The result is that~/.themes/Chicago95/gtk-4.0/gtk.cssdoes get found and parsed, GTK even warns about loading it, and then it is discarded. A theme that ships only a theme directory is a no-op in every libadwaita app while looking like it should work. I confirmed this at runtime: with the theme installed,gtk-theme-namereads back asAdwaita-empty.The hook that does survive is
$XDG_CONFIG_HOME/gtk-4.0/gtk.css. GTK loads that atPRIORITY_USER(800), which is above libadwaita's own sheet, so that is where the theme has to go.installer.pynow installs it there.GTK_THEME=Chicago95is not the recommended route. It does change the look, but only because it makes libadwaita skip loading its stylesheet altogether, so its widgets come out unstyled rather than restyled.What's here
Theme/Chicago95/gtk-4.0/, split the same waygtk-3.0already is, withgtk.cssholding the palette, the global resets and the@importlist:gtk.cssgtk-widgets.cssgtk-containers.cssgtk-lists.cssgtk-menus.cssgtk-adwaita.cssAdwToolbarView, preferences rows,.boxed-list, tabs, status pagesgtk-dark.cssgtk.csssettings.iniPalette and metrics come from
gtk-3.0rather than being re-picked, including the parts that look like typos but aren't.bg_brightisshade(white, 0.99), which computes to#fcfcfcrather than#ffffff, and the GTK4 sheet uses the same value. There is noborder-radius, and no gradients, shadows or transitions.gtk-dark.cssis not filler. Withcolor-scheme=prefer-darkGTK asks for the dark variant, and when it is missing GTK falls back to its own builtin Default-dark rather than togtk.css, so Chicago95 would disappear entirely for anyone running dark mode.Also in this branch:
installer.pyinstalls the user CSS inside a marker-delimited block, keeps a backup, and gainsdisable_gtk4_user_css()to remove it again. It also gains a GNOME branch that configures the theme withgsettingsinstead ofxfconf-query, chosen fromXDG_CURRENT_DESKTOPrather than assuming Xfce.INSTALL.mdgets a GNOME/GTK4 section that spells out what this does not cover.Limits
gnome-shell/theme targets 3.32, and 46% of its selectors no longer exist on Shell 50. That is out of scope here.xfwm4themes don't apply. The CSD titlebar is styled instead, includingheaderbar.default-decoration, which is whatmutter-x11-framesuses for Xwayland windows.thumbnail.png. A maintainer screenshot would be better than anything I could make up.-gtk-icon-style: regular, because that makes GTK substitute whatever full-colour legacy icon the active theme ships; under Yaru that turns the close button into a red circle.Verification
Checked on GTK 4.22.4 / libadwaita 1.9.1 (Ubuntu 26.04, GNOME 50, Wayland):
GtkCssProviderwith 0 errors, with@imports followed;gtk4-widget-factoryandadwaita-1-demoboth run with no GTK warnings. An earlier revision of this branch produced 14 negative-min-size warnings; those are fixed, with the causes written up in comments next to the rules;url()asset references resolve;@colourreferences.Not checked: GNOME Shell, snaps and flatpaks, HiDPI, RTL, and Xfce. I don't have an Xfce session to confirm the GTK3 side still behaves, though no
gtk-3.0file is touched by this branch.If you'd rather the installer changes landed separately, or want the files named or split differently, I'm glad to rework it.