[Wayland] Support XDG_ACTIVATION_TOKEN env var
Categories
(Core :: Widget: Gtk, enhancement)
Tracking
()
Tracking | Status | |
---|---|---|
firefox108 | --- | fixed |
People
(Reporter: contact, Assigned: emilio)
References
(Blocks 1 open bug)
Details
Attachments
(1 file)
User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:100.0) Gecko/20100101 Firefox/100.0
Steps to reproduce:
There's no way to raise firefox from other apps from what I can see or the way of doing so is unclear. Firefox already implemented xdg-activation-v1
, however the XDG_ACTIVATION_TOKEN
was left alone.
The xdg-activation-v1 protocol states the following.
This token is then forwarded to the client, which is supposed to activate one of its surfaces, through a separate band of communication.
One established way of doing this is through the XDG_ACTIVATION_TOKEN environment variable of a newly launched child process. The child process should unset the environment variable again right after reading it out in order to avoid propagating it to other child processes.
Another established way exists for Applications implementing the D-Bus interface org.freedesktop.Application, which should get their token under XDG_ACTIVATION_TOKEN on their platform_data.
It's similar to X11 DESKTOP_STARTUP_ID
(which firefox has some handling for), and is supported by gtk from what I can see.
Actual results:
Firefox isn't activated when passing XDG_ACTIVATION_TOKEN
token to it.
Expected results:
Firefox should activate with when the token was provided to it.
Comment 1•3 years ago
|
||
The Bugbug bot thinks this bug should belong to the 'Core::Widget: Gtk' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.
Comment 2•2 years ago
|
||
Gentle ping on this :)
I suppose this won't be hard since firefox already has code for activating itself.
Assignee | ||
Comment 3•2 years ago
|
||
https://searchfox.org/mozilla-central/rev/ed02e6e84e433cd283e86377524462b4e8b1597b/toolkit/xre/nsAppRunner.cpp#3798 is the desktop-startup-id-handling code, probably similar code could be added to wayland.
Assignee | ||
Comment 4•2 years ago
|
||
This ought to work but I'm not sure how to best test this?
Updated•2 years ago
|
Comment 5•2 years ago
|
||
:emilio, try the url mode of https://codeberg.org/dnkl/foot as in https://codeberg.org/dnkl/foot#user-content-urls
Assignee | ||
Comment 6•2 years ago
|
||
Hmm, but that already works for me on GNOME at least... what gives?
Assignee | ||
Comment 7•2 years ago
|
||
I can try kwin too, let's see.
Assignee | ||
Comment 8•2 years ago
|
||
Ok, so after the patch I can raise the Firefox window from foot, while I couldn't do so (this is on Kwin, on Mutter it all just works). So the patch is working as expected.
That said, it's a bit sad that programs are expected to get a token and set the environment variable before spawning another process... Presumably we should do the same when opening third-party applications (from LaunchWithURI).
Vlad, do you know the difference between KWin and Mutter here? Mutter's behavior seems a bit nicer for users at least.
Comment 9•2 years ago
|
||
Oh, nice I started looking into this myself yesterday. I tested your patch on my machine and it works fine. If I click a link in Konsole, firefox gets the activation token through the XDG_ACTIVATION_TOKEN environment variable.
Comment 10•2 years ago
|
||
That said, it's a bit sad that programs are expected to get a token and set the environment variable before spawning another process... Presumably we should do the same when opening third-party applications (from LaunchWithURI).
At the moment, the two most popular options are either to set the XDG_ACTIVATION_TOKEN environment variable or set "activation-token" property in platform_data in org.freedesktop.Application requests. You're obviously not limited by those two options and could use IPC of choice if it's more suitable for your needs.
Updated•2 years ago
|
Comment 11•2 years ago
|
||
Hmm, but that already works for me on GNOME at least... what gives?
There could be some kind of GTK-specific mechanism involved
Presumably we should do the same when opening third-party applications (from LaunchWithURI).
Yes, you should. The exact mechanism to be used depends on how these apps are launched. When launching them by invoking the executable then pass the token via XDG_ACTIVATION_TOKEN evironment variable.
When launching them using DBus-activation then set "activation-token" property in platform_data in org.freedesktop.Application requests.
When launching the file manager via org.freedesktop.FileManager1 then pass it as StartupId parameter
Comment 12•2 years ago
|
||
Comment 13•2 years ago
|
||
Comment 15•2 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/77aa1ef8002a
https://hg.mozilla.org/mozilla-central/rev/36a4be6a04ff
Description
•