Skip to content

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
@dkondor dkondor force-pushed the xdg_activation_focus_stealing2 branch from c269324 to 59008c2 Compare June 16, 2025 12:41
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