mirror of
https://github.com/alacritty/alacritty.git
synced 2024-11-18 13:55:23 -05:00
Support startup notify on Wayland/X11
Activate a window to indicate that we want initial focus when the system uses startup notifications. Fixes #6931.
This commit is contained in:
parent
bfcebbcd38
commit
8d174429ee
3 changed files with 18 additions and 0 deletions
|
@ -21,6 +21,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||||
- `Back`/`Forward` mouse buttons support in bindings
|
- `Back`/`Forward` mouse buttons support in bindings
|
||||||
- Copy global IPC options (`-w -1`) for new windows
|
- Copy global IPC options (`-w -1`) for new windows
|
||||||
- Bindings to create and navigate tabs on macOS
|
- Bindings to create and navigate tabs on macOS
|
||||||
|
- Support startup notify protocol to raise initial window on Wayland/X11
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
#[cfg(not(any(target_os = "macos", windows)))]
|
||||||
|
use winit::platform::startup_notify::{
|
||||||
|
self, EventLoopExtStartupNotify, WindowBuilderExtStartupNotify,
|
||||||
|
};
|
||||||
|
|
||||||
#[cfg(all(not(feature = "x11"), not(any(target_os = "macos", windows))))]
|
#[cfg(all(not(feature = "x11"), not(any(target_os = "macos", windows))))]
|
||||||
use winit::platform::wayland::WindowBuilderExtWayland;
|
use winit::platform::wayland::WindowBuilderExtWayland;
|
||||||
|
|
||||||
|
@ -143,6 +148,17 @@ impl Window {
|
||||||
.with_position(PhysicalPosition::<i32>::from((position.x, position.y)));
|
.with_position(PhysicalPosition::<i32>::from((position.x, position.y)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(not(any(target_os = "macos", windows)))]
|
||||||
|
if let Some(token) = event_loop.read_token_from_env() {
|
||||||
|
log::debug!("Activating window with token: {token:?}");
|
||||||
|
window_builder = window_builder.with_activation_token(token);
|
||||||
|
|
||||||
|
// Remove the token from the env.
|
||||||
|
unsafe {
|
||||||
|
startup_notify::reset_activation_token_env();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let window = window_builder
|
let window = window_builder
|
||||||
.with_title(&identity.title)
|
.with_title(&identity.title)
|
||||||
.with_theme(config.window.decorations_theme_variant)
|
.with_theme(config.window.decorations_theme_variant)
|
||||||
|
|
|
@ -9,6 +9,7 @@ Categories=System;TerminalEmulator;
|
||||||
Name=Alacritty
|
Name=Alacritty
|
||||||
GenericName=Terminal
|
GenericName=Terminal
|
||||||
Comment=A fast, cross-platform, OpenGL terminal emulator
|
Comment=A fast, cross-platform, OpenGL terminal emulator
|
||||||
|
StartupNotify=true
|
||||||
StartupWMClass=Alacritty
|
StartupWMClass=Alacritty
|
||||||
Actions=New;
|
Actions=New;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue