aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Horner <sites@tecdev.com>2024-11-23 14:20:56 -0500
committerGitHub <noreply@github.com>2024-11-23 19:20:56 +0000
commit6e9a19fd8317e9d0d6a33aa535a1f2ea56844626 (patch)
treec01e6caac137590e2bc57de0b4fdac6cfd5ac6d2
parent3ac4904eb5a1cc15cc02b077c118f1ffcb9e6916 (diff)
downloadalacritty-6e9a19fd8317e9d0d6a33aa535a1f2ea56844626.tar.gz
alacritty-6e9a19fd8317e9d0d6a33aa535a1f2ea56844626.zip
Add `window.level` config option
-rw-r--r--CHANGELOG.md4
-rw-r--r--alacritty/Cargo.toml2
-rw-r--r--alacritty/src/config/window.rs22
-rw-r--r--alacritty/src/display/window.rs3
-rw-r--r--extra/man/alacritty.5.scd11
5 files changed, 39 insertions, 3 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index c9faa35c..e78e82ba 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -10,6 +10,10 @@ Notable changes to the `alacritty_terminal` crate are documented in its
## 0.15.0-dev
+### Added
+
+- Config option `window.level = "AlwaysOnTop"` to force Alacritty to always be the toplevel window
+
### Changed
- Always focus new windows on macOS
diff --git a/alacritty/Cargo.toml b/alacritty/Cargo.toml
index f7f282c2..264ecbc6 100644
--- a/alacritty/Cargo.toml
+++ b/alacritty/Cargo.toml
@@ -41,7 +41,7 @@ tempfile = "3.12.0"
toml = "0.8.2"
toml_edit = "0.22.21"
unicode-width = "0.1"
-winit = { version = "0.30.4", default-features = false, features = ["rwh_06", "serde"] }
+winit = { version = "0.30.5", default-features = false, features = ["rwh_06", "serde"] }
[build-dependencies]
gl_generator = "0.14.0"
diff --git a/alacritty/src/config/window.rs b/alacritty/src/config/window.rs
index 380f7a6f..358bb76d 100644
--- a/alacritty/src/config/window.rs
+++ b/alacritty/src/config/window.rs
@@ -6,7 +6,7 @@ use serde::{Deserialize, Deserializer, Serialize};
#[cfg(target_os = "macos")]
use winit::platform::macos::OptionAsAlt as WinitOptionAsAlt;
-use winit::window::{Fullscreen, Theme as WinitTheme};
+use winit::window::{Fullscreen, Theme as WinitTheme, WindowLevel as WinitWindowLevel};
use alacritty_config_derive::{ConfigDeserialize, SerdeReplace};
@@ -61,6 +61,9 @@ pub struct WindowConfig {
/// System decorations theme variant.
decorations_theme_variant: Option<Theme>,
+
+ /// Window level.
+ pub level: WindowLevel,
}
impl Default for WindowConfig {
@@ -80,6 +83,7 @@ impl Default for WindowConfig {
resize_increments: Default::default(),
decorations_theme_variant: Default::default(),
option_as_alt: Default::default(),
+ level: Default::default(),
}
}
}
@@ -306,3 +310,19 @@ impl From<Theme> for WinitTheme {
}
}
}
+
+#[derive(ConfigDeserialize, Default, Debug, Clone, Copy, PartialEq, Eq)]
+pub enum WindowLevel {
+ #[default]
+ Normal,
+ AlwaysOnTop,
+}
+
+impl From<WindowLevel> for WinitWindowLevel {
+ fn from(level: WindowLevel) -> Self {
+ match level {
+ WindowLevel::Normal => WinitWindowLevel::Normal,
+ WindowLevel::AlwaysOnTop => WinitWindowLevel::AlwaysOnTop,
+ }
+ }
+}
diff --git a/alacritty/src/display/window.rs b/alacritty/src/display/window.rs
index 3d6989a0..1f1e7402 100644
--- a/alacritty/src/display/window.rs
+++ b/alacritty/src/display/window.rs
@@ -169,7 +169,8 @@ impl Window {
.with_transparent(true)
.with_blur(config.window.blur)
.with_maximized(config.window.maximized())
- .with_fullscreen(config.window.fullscreen());
+ .with_fullscreen(config.window.fullscreen())
+ .with_window_level(config.window.level.into());
let window = event_loop.create_window(window_attributes)?;
diff --git a/extra/man/alacritty.5.scd b/extra/man/alacritty.5.scd
index fa0edaaf..18172487 100644
--- a/extra/man/alacritty.5.scd
+++ b/extra/man/alacritty.5.scd
@@ -195,6 +195,17 @@ This section documents the *[window]* table of the configuration file.
Default: _"None"_
+*level* = _"Normal"_ | _"AlwaysOnTop"_
+
+ Sets window level.
+
+ *Normal*
+ Window adheres to system's default z-order.
+ *AlwaysOnTop*
+ Window is a toplevel window.
+
+ Default: _"Normal"_
+
Example:
*[window]*++
padding = { x = _3_, y = _3_ }++