xdg-desktop-portal
xdg-desktop-portal copied to clipboard
Button placement key
Closes https://github.com/flatpak/xdg-desktop-portal/issues/956
This only handles the layout of window decorations, the window decorations visuals themselves would probably best be handled separately, if at all.
Client implementations:
- [ ] GTK
- [ ] QT
- [ ] Electron + ArmCord
- [ ] Firefox
Portal implementations:
- [ ] GNOME: https://gitlab.gnome.org/GNOME/xdg-desktop-portal-gnome/-/issues/95
- [ ] KDE: https://invent.kde.org/plasma/xdg-desktop-portal-kde/-/issues/14
- [ ] Cosmic, maybe?
- [ ] Pantheon: https://github.com/elementary/portals/issues/87
I'm not entirely sure why workflows are failing, help would be appreciated there.
I made https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/200 to add the appropriate mode to xdg-decoration.
Update: still waiting on more input on how I should define this. The Wayland merge request is also useless here, was just a misunderstanding; server-side means apps shouldn't draw decorations at all, client-side means apps should draw them themselves. A none mode wasn't needed.
Going to update and rework this just a bit, since I've learned quite a bit more about how the GTK preference works and cross-toolkit-ness.
This seems fine to add to me, it could be useful for hide e.g. minimize where it doesn't matter etc. What I'd like to point out is that it won't solve potential "annoyances" that people have with CSD apps hiding things so they can get another "frame" placed around them. Arguably the value for this settings entry in those DE:s should still be so that CSD-only applications can, if they want, add the appropriate window controls, so that if the DE uses the "minimize" concept a lot, the app knows it should add a minimize button. Maybe this was something you already had in mind already.
The description of the setting is probably too strong. It tells clients exactly which buttons should be drawn in which order. It would probably be make more sense for it to be a hint: these actions make sense in the current environment. And then let the client figure out where to draw what buttons.
That also sidesteps issues with RTL layouts.
It would probably be make more sense for it to be a hint: these actions make sense in the current environment. And then let the client figure out where to draw what buttons.
I was thinking about this when reimplementing the button-layout logic from Tweaks, and yeah, a list of ideal actions would be better. I do think telling them where they should be drawn should be done though, so that on Pantheon you can get a close button on the left and on GNOME you get a close button on the right - while having no decorations on Sway and all decorations on the right on KDE.
Updated, and accounted for some potential configurations such that they're invalid, when they would be valid before.
Now it should work for setups such as: Sway, KDE, Pantheon, and GNOME.
Docs are finally building! Glad to see it making some more progress forward from where it was last time.
@ebassi would you mind giving this an updated review, please? I'd like to see if there's anything else to nab before I start implementing it.
Bugged @danirabbit on the Elementary Slack about it, so I think Elementary can be considered mostly neutral or in favor of this - they'd just hardcode (["close"],["maximize"]) on their side of things. Here's a portal issue for them: https://github.com/elementary/portals/issues/87
Someone needs to handle it for KDE too: https://invent.kde.org/plasma/xdg-desktop-portal-kde/-/issues/14
GNOME should be more or less fine, but someone needs to first expose a ([],["close"]) on the GNOME portal, then can possibly look at converting the gsettings key to that.
GTK should be able to implement the client side of this without adding or breaking the API.
btw, only GTK from client implementations mentioned in the PR seems realistic as both Firefox and Electron would rather use GtkSettings I believe and Qt has no concept of titlebar settings. Qt has only a dummy decoration for the cases when xdg-decoration is not present but then it's better to spend time on adding libdecor support I believe what ends with GTK client implementation again.
@orowith2os don't merge main into this branch, this repository uses a linear history.
Fair enough, I can force push such that there's only one commit if/when this is ready to be merged :)
Fair enough, I can force push such that there's only one commit if/when this is ready to be merged :)
Just do so now, no reason to wait to clean up the branch.
Done.
Next step before this can land would be to create proof of concepts and "acks" in "enough" toolkits.
I'm sure @lleyton should be able to handle the tauOS and libhelium side of things, and the work can easily be strapped onto the GNOME portal + GTK with @ItsJamie9494. I plan on making a Rust representation and reference for the GNOME portal soon, and tauOS can reuse it in their stuff.
I can work with GTK and GNOME, but I have nothing to do with libhelium and/or tauOS anymore
What about Qt (and/or https://github.com/FedoraQt/QAdwaitaDecorations)? If it's GTK land only, then it's not gaining much compared to just forwarding the GTK gsetting, does it not?
Edit: wrong link to QtADwaitaDecorations.
Sorry, sent the wrong link to QtAdwaitaDecorations.
I don't have anybody at hand to manage QT, but AFAIK that's all done with the platform plugins. You'd need to go through and update each one individually.
If I/we can sort something out for a source code representation of this setting, I can release it as a library and reuse that, possibly. Or use it as a base for other implementations.
I don't have anybody at hand to manage QT, but AFAIK that's all done with the platform plugins. You'd need to go through and update each one individually.
That's why I linked to QtAdwaitaDecorations. See https://jgrulich.cz/2023/08/22/qt-theming-in-fedora-workstation/.
If I/we can sort something out for a source code representation of this setting, I can release it as a library and reuse that, possibly. Or use it as a base for other implementations.
"implementing" the setting is most likely 99% toolkit specific plumbing, so prototyping a library outside of a toolkit likely isn't much help - I don't imagine GTK or Qt would have any use for it.
In QAdwaitaDecorations I already use what's provided by org.gnome.desktop.wm.preferences (in particular button-layout key). There is not much I can gain changing that for something else since this project targets GNOME and this is expected to be provided all the time. For Qt in general, I can imagine this being part of the decoration plugin.
QAdwaitaDecorations should probably still look to use this portal at some point, in the (possibly unlikely) event it's used someplace that's not GNOME, and the GNOME preferences aren't available to be read.
You'd need to go through and update each one individually.
The proper way would be to add a hint here, then implement it here and consume in decoration plugins like this (the default one is here)
if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme()) {
const QVariant themeHint = theme->themeHint(QPlatformTheme::SystemIconThemeName);
if (themeHint.isValid())
return themeHint.toString();
}
The one who would like to implement this will probably have to have a talk about that at [email protected] mailing list first.
@grulja org.gnome.desktop.wm.preferences isn't something that's available inside the flatpak sandbox so this should help with providing the same data in a cross-platform way inside the sandbox.
@grulja
org.gnome.desktop.wm.preferencesisn't something that's available inside the flatpak sandbox so this should help with providing the same data in a cross-platform way inside the sandbox.
Sure it is, you can get it through the settings portal already and it doesn't make a difference whether you make the call inside or outside the sandbox. I'm using it here for example.
Huh, that's interesting. The portal documentation says
This interface provides read-only access to a small number of host settings required for toolkits similar to XSettings. It is not for general purpose settings.
Currently the interface provides the following keys:
And then goes on to list org.freedesktop.appearance color-scheme accent-color contrast.
Now I'm wondering if this is on purpose or a mistake.
And then goes on to list
org.freedesktop.appearance color-scheme accent-color contrast.
None of those settings provided via xsettings btw. org.gnome.desktop.wm.preferences.button-layout is provided (Gtk/DecorationLayout).
And if it really provided only those keys, gtk applications weren't following lots of settings such as font name/size, cursor theme/size.