element-desktop icon indicating copy to clipboard operation
element-desktop copied to clipboard

Support auto-raise/focus-pull when clicking system notifications on Plasma/KDE

Open kode54 opened this issue 4 months ago • 2 comments

Your use case

What would you like to do?

I would like to be able to raise the Element window to the foreground upon clicking a notification of a new message. Whether this works for minimized window is optional, or should be configurable.

Why would you like to do it?

It is convenient to move the mouse to a notification when reading it, and click it to bring the chat to the foreground to reply to the message.

How would you like to achieve it?

Electron supports the xdg_activation_v1 protocol, so this should be easy to implement.

Have you considered any alternatives?

No response

Additional context

No response

kode54 avatar Aug 22 '25 09:08 kode54

Note that this probably works as expected on GNOME due to the system requiring the user to click a notification bubble that says "$application is ready." to actually perform the activation. And there's labwc, one of the wlroots compositors which implements xdg_activation_v1, and it intentionally simplifies the verification requirements to allow activation, also because some applications, such as Thunderbird, still fail more stringent tests. However, it does provide configurable window rules to opt out of activation, rather than requiring it to be opted into.

kode54 avatar Aug 22 '25 09:08 kode54

We do wire up an onclick handler on the notification, but its up to Electron whether that works correctly in your chosen DE. https://github.com/element-hq/element-web/blob/develop/src/vector/platform/ElectronPlatform.tsx#L324-L327 + https://github.com/element-hq/element-desktop/blob/954e11947e7dc7292c5ebaccc3d22892ea23d02b/src/ipc.ts#L65-L72

We don't get access to the underlying dbus/os calls to make this work any better than it does today, that would need to be done in Chromium/Electron.

t3chguy avatar Aug 27 '25 10:08 t3chguy