Set appid/wmclass for zed window (#10909)

fixes https://github.com/zed-industries/zed/issues/9132

By setting the app id, window managers like `sway` can apply custom
configuration like `for_window [app_id="zed"] floating enable`.
Tested using `wlprop`/`hyprctl activewindow` for wayland, `xprop` for
x11.


Release Notes:

- Zed now sets the window app id / class, which can be used e.g. in
window managers like `sway`/`i3` to define custom rules
This commit is contained in:
Jakob Hellermann 2024-04-29 18:27:25 +02:00 committed by GitHub
parent 5674ba2a49
commit 2386ae9f0e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 46 additions and 2 deletions

View file

@ -209,6 +209,7 @@ pub(crate) trait PlatformWindow: HasWindowHandle + HasDisplayHandle {
fn activate(&self);
fn is_active(&self) -> bool;
fn set_title(&mut self, title: &str);
fn set_app_id(&mut self, app_id: &str);
fn set_background_appearance(&mut self, background_appearance: WindowBackgroundAppearance);
fn set_edited(&mut self, edited: bool);
fn show_character_palette(&self);
@ -557,6 +558,9 @@ pub struct WindowOptions {
/// The appearance of the window background.
pub window_background: WindowBackgroundAppearance,
/// Application identifier of the window. Can by used by desktop environments to group applications together.
pub app_id: Option<String>,
}
/// The variables that can be configured when creating a new window
@ -599,6 +603,7 @@ impl Default for WindowOptions {
display_id: None,
fullscreen: false,
window_background: WindowBackgroundAppearance::default(),
app_id: None,
}
}
}