Implement activation tokens for X11 - #4
Conversation
3db1359 to
2f5a69a
Compare
kchibisov
left a comment
There was a problem hiding this comment.
I'll test it once we have issues resolved.
I've also rebased my branch, so it should be easier now.
2f5a69a to
3acc71c
Compare
Random idea for that: libstartup-notification contains |
|
You could also test on alacritty if you have something that can pass startup notify. That's how I've done wayland testing ^ |
The utils in this module should help the users to activate the windows they create, as well as manage activation tokens environment variables. The API is essential for Wayland in the first place, since some compositors may decide initial focus of the window based on whether the activation token was during the window creation. Fixes rust-windowing#2279.
| let atoms = self.xconn.atoms(); | ||
| let title = { | ||
| let title_bytes = self | ||
| .xconn | ||
| .get_property(self.xwindow, atoms[_NET_WM_NAME], atoms[UTF8_STRING]) | ||
| .expect("Failed to get WM_NAME property"); | ||
|
|
||
| String::from_utf8(title_bytes).map_err(|_| NotSupportedError::new())? | ||
| }; |
There was a problem hiding this comment.
Don't we have a title() getter already? I'm pretty sure you can just self.title().
There was a problem hiding this comment.
The title() getter returns an empty string.
| // Get the activation token and then put it in the event queue. | ||
| let token = self | ||
| .xconn | ||
| .request_activation_token(&title) |
There was a problem hiding this comment.
Maybe we should request the token right before sending it back to the user?
There was a problem hiding this comment.
Good idea, I've implemented this.
|
@notgull I'm not sure whether we should really add this testing example, because it requires installing the desktop file. How were you testing it btw in your setup? |
CHANGELOG.mdif knowledge of this change could be valuable to userscc rust-windowing#2955
Adds the parallel activation context things to X11. None of this code has been tested.
It seems like the actual activation token from
request_activation_tokendoesn't really matter, so I've just implemented it using the recommendation that the specs give.This is based on rust-windowing#2825, while the
activation_tokenbranch for this repo seems to be based on an older commit. Hence the extra noise.