Skip to content

xdg-activation: add focus stealing prevention when using tokens #2626

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

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dkondor
Copy link
Contributor

@dkondor dkondor commented Apr 12, 2025

Continuation of #2527

This implements focus stealing in a straightforward way by disallowing xdg-activation tokens if the view that generated them is not focused anymore. So this is about the case when the user switches to another view before a token is used.

@ammen99
Copy link
Member

ammen99 commented Apr 12, 2025

@dkondor
Copy link
Contributor Author

dkondor commented Apr 13, 2025

This works based on xdg-activation and only tracks which view has focus. Mainly, it is to prevent the following scenario:

  1. User interacts with app A, which generates a token and passes it to app B
  2. App B is slow to use its token, the user switches to app C in the meantime
  3. Now app B uses the token to activate itself, which might be unexpected

In contrast, the plugin in wpe focuses on keyboard (if I understand correctly), to prevent taking focus while typing, regardless of whether the requesting app has a valid token or not. So I think these can complement each other, with this PR more focusing on users' attention and also reducing the cases that even trigger the fsp plugin in wpe.

@dkondor dkondor marked this pull request as draft April 13, 2025 12:47
@dkondor
Copy link
Contributor Author

dkondor commented Apr 13, 2025

Marking it a draft, since I this prevents focusing also in some valid cases, especially when used in combination with #2627 and desktop components, specifically when launching apps / actions from a menu opened from a layer-shell panel (such as with WayfireWM/wf-shell#293)

@dkondor dkondor force-pushed the xdg_activation_focus_stealing2 branch from d3c872b to c269324 Compare April 21, 2025 11:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants