Share theming between labwc and external components #3104
Replies: 1 comment 6 replies
-
Thanks for creating this separate discussion.
Thanks for clarifying — I see your point about why parsing the theme manually is not enough, since the effective theme depends on the exact command-line args and env vars that Labwc itself was started with. And I understand your suggestion that the “correct” first step would be for Labwc to persist this resolved state itself, so that other frameworks can consume it. Still, just to finish my thinking on the portal side, I wondered about a slightly modified version of the idea:
The appeal here is that Labwc stays D-Bus-free, while minimalist setups could still provide a functioning So yes — I agree that the persistent file solution you suggested is the more realistic way forward (even if I don’t find it super appealing). But I wanted to at least put this “companion service” variant on the table, even if only as a thought experiment, before dropping the idea. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Originally posted by @lobre in #3049 (comment)
I’d like to propose a way to share theming from labwc to external components via a new Settings portal backend, tentatively called
xdg-desktop-portal-labwc
.First, I understand that major desktop environments drive the full experience and ship large portal implementations, so everything feels consistent. If labwc is used as the compositor inside a DE such as Xfce, then launchers, dialogs, notifications, status bars, etc. will typically be provided by Xfce and should match Xfce’s look. In that scenario, there’s little point in pushing labwc’s internal styling outward; more likely, Xfce would drive labwc’s theming so it integrates well.
The problem I’m trying to solve is different: labwc used as a minimalist, standalone window manager. In that case, labwc effectively becomes “the desktop,” so its theming should drive the overall style of complementary components (dialogs, app runners, status bars, etc.). I’m very new to Wayland, but as I’ve been tinkering with labwc I discovered
xdg-desktop-portal
. I’m wondering whether a portal approach could be a clean way to expose labwc’s resolved appearance values to other processes—even sandboxed apps.I know labwc’s homepage says:
What I’m suggesting is an external piece, outside the compositor: a small
xdg-desktop-portal-labwc
program that knows how to read (parse)labwc
configuration and theming and implements the Settings portal. It could even be a third-party project unrelated to labwc itself. The advantage of using the desktop portal is that even sandboxed apps can reach the Settings interface.I’m aware that the standardized Settings keys are currently very small:
org.freedesktop.appearance color-scheme
org.freedesktop.appearance accent-color
org.freedesktop.appearance contrast
The spec also says implementations may expose custom keys (though they’re non-standard and undocumented):
https://flatpak.github.io/xdg-desktop-portal/docs/doc-org.freedesktop.portal.Settings.html
I realized that GTK (the library) itself can use the portal to retrieve custom GNOME GSettings when running on GNOME. Conceptually, something like this happens:
org.freedesktop.portal.Settings.Read("org.gnome.desktop.interface", "font-name")
org.gnome.desktop.interface font-name
.By analogy, a wrapper script (or any thin client) could query the portal to get labwc’s theming. For example:
Our backend (
xdg-desktop-portal-labwc
) would be registered for the Settings portal, understand theorg.labwc.theme
custom namespace (or alsoorg.labwc.config
), read and resolve the current labwc theme, and return the corresponding values over D-Bus. A launcher likewofi
could then be wrapped by a small shell script that queries the portal, exports a few color/font variables, and launcheswofi
with the right flags.I fully realize this might be overkill, and I’m very open to feedback—especially if this is a bad idea or goes against best practices for Wayland/portals. I’m just starting with Wayland and only recently discovered
xdg-desktop-portal
, so I know this is more complex than exposing a few environment variables. I’m proposing it to learn from maintainers and users who understand this space better. In particular, if the Settings portal is not appropriate for this kind of theming, I’d be grateful to hear if that gives you better ideas related to that space.Originally posted by @lobre in #3049 (comment)
Beta Was this translation helpful? Give feedback.
All reactions