YaLTeR / niri

A scrollable-tiling Wayland compositor.
https://matrix.to/#/#niri:matrix.org
GNU General Public License v3.0
4.12k stars 123 forks source link

xdg: startup activation #779

Open cmeissl opened 2 weeks ago

cmeissl commented 2 weeks ago

Okay, at first it looked like an easy task to just extend the logic to pass an activation token to process spawned through actions.

But it looks like the whole activation implementation misses some parts to actually make this work. Actually it also looks like activation is not handled for launchers like fuzzel.

The reason is that XdgActivationState::request_activation might be called before the window is actually mapped as part of the startup.

A quick look at sway reveals that it also handles unmapped windows, but in this case make sure that an token is only used once.

Draft because testing this will need the above to be fixed before.

YaLTeR commented 2 weeks ago

The reason is that XdgActivationState::request_activation might be called before the window is actually mapped as part of the startup.

A quick look at sway reveals that it also handles unmapped windows, but in this case make sure that an token is only used once.

Hmm. Guess we can put a "focus on map" bool on an Unmapped?

cmeissl commented 2 weeks ago

The reason is that XdgActivationState::request_activation might be called before the window is actually mapped as part of the startup. A quick look at sway reveals that it also handles unmapped windows, but in this case make sure that an token is only used once.

Hmm. Guess we can put a "focus on map" bool on an Unmapped?

yes, something like that, just hit this and did not have time to think about it.

cmeissl commented 5 days ago

Okay, so the second commit now allows to activate/focus windows in case a valid activation token has been passed while they were still un-mapped. While I believe this was the intended behavior from the beginning, it might still change how spawning and activation token work in niri today significantly.

YaLTeR commented 4 days ago

I'll need to take a look myself where else to pass activate in the layout code to avoid the extra activation token data argument; rest looks good.

cmeissl commented 4 days ago

I'll need to take a look myself where else to pass activate in the layout code to avoid the extra activation token data argument; rest looks good.

Sure, I just wanted to avoid putting it into the mapped window as the activation data is no longer needed after mapping it. An Option<TokenData> that is taken out on map also feels wrong imo.