Skip to content
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

notification: Add platform-data (with activation_token) to ActionInvoked #791

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

3v1n0
Copy link
Contributor

@3v1n0 3v1n0 commented May 5, 2022

Since some time FDO Notifications introduced the ActivationToken signal
to ensure that clients will receive an X11-startup notification ID or a
wayland xdg-activation token in order to support stealing-focus
prevention protocols.

However this isn't supported by xdg-desktop-portal's.
So fill the gap by adding a further activation token.

While it could be added by as an optional parameter, it's just better to
make it explicit.

It needs libportal from flatpak/libportal#88

Implemented in:

@3v1n0
Copy link
Contributor Author

3v1n0 commented May 5, 2022

@matthiasclasen wdyt about this?

At the current time I decided to do an api-break on libportal too, otherwise it could be exposed as an another signal, but it looked overkill to me.

@3v1n0 3v1n0 force-pushed the notification-activation-token branch from 0b4aca4 to 5c60d2e Compare May 6, 2022 20:52
@3v1n0
Copy link
Contributor Author

3v1n0 commented May 6, 2022

I wanted to add a test for checking on the old interface too, but to use libportal there too, we'd need to make a way to override the proto version, and sadly that can't be done once we've the proxy up.

So can only test it using the dbus API.

@3v1n0 3v1n0 changed the title notification: Add activation-token to ActionInvoked notification: Add platform-data (with activation_token) to ActionInvoked May 6, 2022
@3v1n0 3v1n0 force-pushed the notification-activation-token branch 5 times, most recently from f43b77a to 7950c64 Compare July 12, 2022 10:31
Since some time FDO Notifications introduced the ActivationToken signal
to ensure that clients will receive an X11-startup notification ID or a
wayland xdg-activation token in order to support stealing-focus
prevention protocols.

However this isn't supported by xdg-desktop-portal's.
So fill the gap by adding a further ActionInvoked signal that includes
platform data, where such parameter can be exposed.

As per this, bump the protocol version.
Ensure we don't regress in handling version 1 of the notification
protocol, we can't do it through libportal as it's checking for the
notification version early, we can still ensure all is handled as we
expected.
@A6GibKm
Copy link
Contributor

A6GibKm commented Jan 7, 2023

Hello, whats the state of this PR? Does the gnome shell know what to do with the activation token, so I can try testing this?

<arg type="s" name="app_id"/>
<arg type="s" name="id"/>
<arg type="s" name="action"/>
<arg type="a{sv}" name="platform_data"/>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps name this options? It's what the equivalent thing is called in other portals.

<signal name="ActionInvoked2">
<arg type="s" name="id"/>
<arg type="s" name="action"/>
<arg type="a{sv}" name="platform_data"/>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same about calling it options for consistency.

<arg type="s" name="action"/>
<arg type="a{sv}" name="platform_data"/>
<arg type="av" name="parameter"/>
</signal>
<property name="version" type="u" access="read"/>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we not bump the version, here? If version == 2, then ActionInvoked has more parameters, otherwise it doesn't.

Unless we assume that all portal implementations aren't checking the version.

I really don't want to have methods called Foo2; that's a great way to cause legibility issues, as well as the potential for typos. Might as well call this signal with another name entirely.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's not how it works; the apps don't "bind" a version it's compatible with, so we cannot change the type signature.

How do you imagine "app1" that is using the current version of the API to continue to work with a new xdg-desktop-portal if the type signature changes?

I think we just have to live with the fact that there will be a "Foo2" here and there. It's also why it's good to more or less always have a vararg so one can add more properties like this without changing the type signature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Needs Triage
Development

Successfully merging this pull request may close these issues.

None yet

5 participants