-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Set DesktopNames in sway.desktop to have XDG_CURRENT_DESKTOP
#4876
Conversation
Setting DesktopNames in the desktop file sets the environment variable `XDG_CURRENT_DESKTOP`, which can be used to find out the name of the currently running session.
This isn't our responsibility, this is something the login manager should do. Arguably it shouldn't do it, because this isn't a spec, no one has written it down, and software which relies on it is wrong. |
According to the XDG spec, the login manager sets the variable found in |
Thanks for finding it in the spec! I agree, but I'll leave this up to @ddevault. |
People shouldn't use this to detect the current desktop. |
I was trying to make
|
Either you reopen this or Firefox can't detect you to enable features like hardware rendering etc. |
This is actually a very good reason not to reopen this. Clients like Firefox should really not detect the current compositor. |
Firefox whitelists features for desktop environments that are proven bug free. It does not blacklist broken ones as it causes more trouble for users. WebRender (OpenGL rendering) rollout will happen incrementally by desktop environment. If you don't merge this, you might not get hardware rendering by default at some point. (?) |
Also, if your users report bugs and upload their about:support page, their desktop environment entry is empty. It's unlikely that every user is manually asked for it, so bugs might get mistriaged and not further debugged. All Sway bugs should ideally end up here: https://bugzilla.mozilla.org/show_bug.cgi?id=wayland-sway |
This is really broken behaviour and a Firefox bug. Reminds me of obnoxious websites whitelisting some browsers. (Not to mention that XDG_CURRENT_DESKTOP is unreliable and only set when users have a display manager enabled.) |
Yes, it might not be nice, but it's the common way. Then I guess systems without display manager are not officially supported, so it's up to the user to enable and disable certain preferences to achieve the correct feature set. (?) |
The common way? How is this common? Firefox is the very first Wayland client doing this.
How has a display manager anything to do with Firefox? Firefox doesn't interact at all with the display manager. By the way, display managers are unsupported by Sway (which does interact directly with them). So I guess that makes it impossible for Firefox to officially support Sway. This is getting quite ridiculous. |
Good to have brought this up, I almost wouldn't have reported this to you. |
Unlike X11, under Wayland applications aren't permitted to access each other's screen content; this is great for security, but breaks screensharing. In order to enable screensharing, a program called `xdg-desktop-portal` provides an API for accessing other applications' screen content (and, optionally, entire screens' content). `xdg-desktop-portal` launches a corresponding protocol-specific adapter (e.g. `xdg-desktop-portal-gtk` for GNOME, `xdg-desktop-portal-wlr` for `wlroots`-based DEs) depending on the value of `XDG_CURRENT_DESKTOP`. Sway doesn't set this value and has rationale for not doing so (swaywm/sway#4876). This is a pretty hacky fix because it sets it no matter which DE launches, but there really aren't any good options for setting this (the ideal is probably to set it in `sway.desktop`, but that must be maintained systemwide and is updated any time the `sway` package is updated).
Is there still a good reason to not set I think we should reconsider this issue at least. |
People might have other preferences (e.g. setting it to KDE to have Qt rather than Gtk portals for file opening/printing, to have launchers show the proper applications, etc.). We only set environment variables that are needed to make clients able to talk to us ( Just set it to what you want before starting sway, or before starting the application in question. There are plenty of other environment variables that you might want to set ( |
I had broken screensharing in firefox for years because of this issue, not even knowing that XDG_CURRENT_DESKTOP wasn't being set properly. How am I expected to know to set this environment variable when its not in the sway docs? The reasoning's for not including this patch are philosophical at best. I'm a user with a real issue. My suggestion is to include in a FAQ or README that as part of the installation, we should set this variable for compatibility with underlying applications. That way users who debug this issue don't have to search github's closed issues to fix their problem (as I did). |
|
@jessesimpson36 you can edit the wiki to add that |
I tried editing the wiki, but it seems I do not have permission. If you have feedback about the description, I'd be happy to change it to better reflect the findings of this discussion. XDG_CURRENT_DESKTOP environment variable is not being setSome applications may rely on the XDG_CURRENT_DESKTOP environment variable to be set so that the application can accommodate for being ran under sway. One example of this is using Screensharing in Firefox. To set this variable, one option is to modify your shell's profile file to export this environment variable before manually running It's not good practice for applications to make use of XDG_CURRENT_DESKTOP in this way, and Firefox has an issue open to try to fix it. Refer to (xpdw's FAQ)[https://github.com/emersion/xdg-desktop-portal-wlr/wiki/FAQ#how-do-i-run-xdpw] and (xdpw's Troubleshooting guide)[https://github.com/emersion/xdg-desktop-portal-wlr/wiki/%22It-doesn't-work%22-Troubleshooting-Checklist] if your issue is specifically related to screensharing. |
Ah, yes, the wiki was locked down because of recent abuse. I've unlocked it again. |
Oh, I'm sorry to hear it. |
As per points 1 and 2 in https://github.com/alebastr/sway-systemd/blob/0fdb2c4b10beb6079acd6073c5b3014bd58d3b74/src/session.sh Discussion of why this is not in Sway is here: swaywm/sway#4876 (comment)
Setting DesktopNames in the desktop file sets the environment variable
XDG_CURRENT_DESKTOP
, which can be used to find out the name of thecurrently running session.
See also https://bugzilla.gnome.org/show_bug.cgi?id=727546 and https://bugzilla.redhat.com/show_bug.cgi?id=1787407.
We may want to allow additional names, e.g., Sway. I can update this PR if desired.