Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Apps are not aware of desktop themes #114
Comments
|
This is somewhat tricky, because apps and runtimes can have different toolkit versions that the host, and themes are version specific. So, the theme you have installed may not necessarily work with the app. Also, its generally hard to use themes (of various kinds) that are system installed (i.e. are in /usr) because those are not visible in the sandbox (/usr there is from the runtime). If you installed the themes in your homedirectory, and the app had access to the homedir, and the theme works with your app then it should work. |
aditiapratama
commented
Jun 27, 2016
•
|
I have some ideas how to do this nicely with extension directories, but I will have to think about it a bit. |
magcius
commented
Jun 29, 2016
|
Inkscape also can't access my system fonts. I can't figure out any way to install fonts in a Flatpak. |
|
@magcius That is weird, both the user and the system fonts should be in /run/host/fonts and /run/host/user-fonts. And the runtime fontconfig is configured to look there. Is inkscape not using fontconfig? |
magcius
commented
Jun 29, 2016
|
Hm, indeed. I'll see if I can investigate. |
|
Food for thought: What if we have a single runtime bundle that contains |
|
I haven't really thought about it recently. Themes are a complex issue, as they generally are tied to very specific versions of the toolkits. For instance, flatpak already exports the host fonts because doing so is generally safe. But say a host-installed gtk theme works only against a particular set of gtk versions, so we can't generically export it to the app. Some themes are even .so:s so are very particular about versions. What I think could work is having each individual runtime or application that ships a specific version of a toolkit could somehow request via an extension point themes for that particular version. Unfortunately the layout of /usr/share/themes is not ideal for this, as it has the theme name before the "what is the theme for". I.e. if it was /usr/share/themes/gtk+-3.0/themename, then we could have an extension point at /usr/share/themes/gtk+-3.0 such that any extensions matching it would create a subdirectory in there. |
|
If you look at
https://git.gnome.org/browse/gtk+/tree/gtk/gtkcssprovider.c#n1925 we are
looking at versioned directories. But of course, there are very few (if
any) themes that ship those versioned variants.
…
|
|
Yes, we can use versioned directories, or we can match the extension on versions. For example, we could have an subdirectory extension point called something like |
|
oh, you're saying the problem is that its .../Adwaita/.../ 3.22 ... and not
.... 3.22 ... /Awaita/...
yes. thats unfortunate.
…
|
|
No, not quite. The problem is that it is Themes/Adwaita/Gtk, and not Themes/Gtk/Adwaita. With the later we could make Themes/Gtk a subdir-style extension point matching a particular gtk version. But with the previous we can only make Themes an extension point, and the extension for Adwaita has to contain all types of themes, which makes it hard to match it to a particular version of the toolkit. |
|
Well, your point is true too. |
|
We could add a new type of extension point, which is similar to the subdir one, but lets you place the variable part in a different place than at the end. For example, we might have:
Which if you had In such a setup we you could have both Does that make sense? |
|
Uhm, sorry, it should be subdirectory-suffix i guess. |
|
Also, this combined with the unmaintained extensions should let a distro ship a bunch of themes in /var/lib/flatpak/extension to integrate with flatpak. |
|
Does seem reasonable. |
|
Ya now I think more about it, this is always gonna be an issue of curation. Why would we offer the ability to expose "broken" themes, when we could make curated/tested extensions available instead.. ^^ |
|
Well, curation is a policy thing, this is mainly talking about the technical implementation. I think what you want is the ability to inject themes into 3rd party apps in a targeted way (so you know gtk 3.20 apps get a 3.20 theme). Now, you might want to control exactly which themes are injected, but some other random user wants to inject his favourite theme (and the app author may not want custom themes at all...). As long as this is possilble the distro/user can handle the curation. |
|
Currently bindmounting themes directory seems to work fine, but ofc as you say, picking the right one to make available is key. I think in terms of larger umbrella there needs to be a simple cascade to determine the "right" asset to make available, same for the icon theme. |
Anti-Ultimate
commented
Mar 9, 2017
|
Isn't GTK supposed to be stable since GNOME 3.20 ? From my experience with AppImages, themes in applications broke before GTK 3.20, but it's never happened since. Ideally, you could mount the theme directory the user has the DE to use, and if it's not compatible, default to Adwaita / the default theme. |
jbicha
commented
Apr 8, 2017
|
By the way, if I am using Adwaita and I have Global Dark Theme enabled, Flatpak apps just use Adwaita and ignore the Global Dark Theme setting. |
mdickie
commented
Apr 8, 2017
|
So the key could be to distribute themes through Flatpak. |
|
The 'global dark theme' is and has always been a hack. The dark-theme settings is a per-application setting. |
alex285
commented
Apr 9, 2017
•
|
@matthiasclasen there is a different bug in that, to reproduce
Output so that flag will work only if the global theme is set to Adwaita. except if there is another way to set dark variant per app |
phw
commented
Apr 9, 2017
|
@alex285 While this is very annoying and also applies if prefer dark theme is set on a per application basis, I think this is a separate issue, likely a GTK issue and not Flatpak related (even though Flatpak makes the issue obvious) |
alex285
commented
Apr 9, 2017
|
@phw i dont know how to set that flag per app for nonFlat apps, so i cannot test if it doesn't work there either :/ |
|
If we wanted to have a global dark theme, the most straightforward way to achieve that is to just have a DarkAdwaita theme, and totally ignore the prefer-dark setting. |
hadess
locked and limited conversation to collaborators
Apr 9, 2017
|
I've locked the conversation as we're not covering new ground in the comments. You can still subscribe or, even better, provide Pull Requests if this problem is high up on your priority list. |
|
I have added support for what was mentioned in #114 (comment) (that is subdirectory-suffix=foo) in 5e1d456, which is now in the latest stable release. I think the way forward here is for the gnome runtime to expose a org.gtk.theme.322 or suchlike, and then package the themes using flatpak. (Alternatively an unmaintained extension can be used if you just want to expose some local files, but that seems less usable for regular users.) |
|
Here is a patch for gnome-sdk-images that adds such an extension and a shell script to populate it. |
|
Some things still to consider before merging this:
|
|
I've tried to create a similar extension for icon themes: [Extension org.freedesktop.Icons] The problem with this is that it covers up the existing icon themes in the runtime: Adwaita, HighContrast and hicolor. And merge-dirs seems to work only between extensions, not between extensions and the runtime. |
|
I guess one way around the covering proplem would be to break out the currently included icon themes into (maintained) extensions of their own. Alex, does that sound like the right way forward ? |
|
I think in general having maintained themes is a better approach than messing around with copying things. For icon themes the we really need some basic icon theme to be installed, or a lot of stuff will not work. But, we don't want to make the icon theme extension auto-download, because then we will download all icon themes from the same repo. I wonder if we could instead set XDG_DATA_DIRS so that we get another "layer" of directories where we look for things like icon themes. |
|
Currently we pick up XDG_DATA_DIRS=/app/share:/usr/share as the default fallback. But if we add XDG_DATA_DIRS=/app/share:/usr/share:/usr/share/runtime/extra-share or something we can put an extension point in /usr/share/runtime/extra-share/icons |
|
Another go at defining the right extensions https://git.gnome.org/browse/gnome-sdk-images/log/?h=theme-extensions Couldn't quite figure out how to build a working extensions that matches one of these though... |
|
I added your icon theme spec to the fd.o base: Here is an example icon theme: https://gist.github.com/alexlarsson/c0f60483ce883f61d28f7c3831b8d746 Will take a look at the Gtk side too. I guess we can package the most common icon themes in flathub. |
|
Added gtk3 theme and icon themes to gnome sdk: |
|
This can be closed since we have theme extensions now. |


garrett commentedJun 14, 2016
Apps running via Flatpak do not respect the desktop's theme settings.
Affected scenarios: