Skip to content

Use Gtk4 calls to apply css.

Sundeep Mediratta requested to merge fix-gtk4-css-changes into main

Applying style_context.add_class() and remove_class() is is depreciated with > Gtk 4.10.

This updates the code to apply css styles with Gtk4 methods and calls to widgets directly.

This leaves stylecontext calls to get color for drawing rubber band as the only code that currently still uses that method.

Also updates css to apply selectors to named widgets. This makes css application very specific, so hopefully user installed themes cannot override application defaults easily to make the desktop window opaque. This hopefully solves #9 (closed).

As using hovered status updates css, we can use the same :hover flag to detect mouse on a widget. This simplifies code and we can remove 2 eventcontrollers from DesktopIconItem.js. Multiply this by the number of icons on the desktop... and we save a lot on complexity.

Also updates CSS code, named color desktop_icons_bg_color and desktop_icons_fg_color are added. These point to theme selected colors, that is done and allocated and programmed in code. There are safe fallbacks if theme selected colors cannot be found.

Also reacts correctly to theme changes, on changes, the selection color and rubber band color are updated automatically.

Now also reacts to Gnome global dark mode setting changes. The css theme is automatically changed to load the dark variant of the current theme (if correctly installed and available).

Edited by Sundeep Mediratta

Merge request reports