rust-windowing / winit

Window handling library in pure Rust

Home Page:https://docs.rs/winit/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Window activation for existing windows

acarl005 opened this issue · comments

commented

Description

The WindowBuilder::with_activation_token method allows the user to create a new window with an activation token on Linux.

However, according to the Wayland xdg-activation protocol, activation is not something that is limited to newly created windows. You can request activation on an existing window. It would be useful if the Window struct had a method to wrap this functionality, something like:

impl Window {
    pub fn activate(&self, token: ActivationToken) {
        if let Some(xdg_activation) = &self.xdg_activation {
            xdg_activation.activate(token._token, self.surface());
        }
    }
}

As an example use case, suppose an app was asked to handle a custom URI scheme (deep link) which was clicked in a web browser. In order to make it clear to the user that the app has handled the URI, it might want to request activation.

Relevant platforms

Wayland