From eb59d155a269983050f0fb0c025c46b13be689f1 Mon Sep 17 00:00:00 2001 From: Lucas Baumann <41015240+luca3s@users.noreply.github.com> Date: Sun, 11 May 2025 13:11:13 +0200 Subject: [PATCH] Add warning for invalid exclusive and anchor combination (#1316) --- CHANGELOG.md | 1 + crates/eww/src/display_backend.rs | 7 +++++++ docs/src/configuration.md | 2 +- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d94afd6..e20c84a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ All notable changes to eww will be listed here, starting at changes since versio - `get_locale` now follows POSIX standard for locale selection (By: mirhahn, w-lfchen) ### Features +- Add warning and docs for incompatible `:anchor` and `:exclusive` options - Add `eww poll` subcommand to force-poll a variable (By: kiana-S) - Add OnDemand support for focusable on wayland (By: GallowsDove) - Add jq `raw-output` support (By: RomanHargrave) diff --git a/crates/eww/src/display_backend.rs b/crates/eww/src/display_backend.rs index 87ca8aa..1a29810 100644 --- a/crates/eww/src/display_backend.rs +++ b/crates/eww/src/display_backend.rs @@ -112,6 +112,13 @@ mod platform_wayland { } else { window.set_layer_shell_margin(gtk_layer_shell::Edge::Top, yoffset); } + // https://github.com/elkowar/eww/issues/296 + if window_init.backend_options.wayland.exclusive + && geometry.anchor_point.x != AnchorAlignment::CENTER + && geometry.anchor_point.y != AnchorAlignment::CENTER + { + log::warn!("When ':exclusive true' the anchor has to include 'center', otherwise exlcusive won't work") + } } if window_init.backend_options.wayland.exclusive { window.auto_exclusive_zone_enable(); diff --git a/docs/src/configuration.md b/docs/src/configuration.md index 1e0a4de..e37c1cd 100644 --- a/docs/src/configuration.md +++ b/docs/src/configuration.md @@ -89,7 +89,7 @@ Depending on if you are using X11 or Wayland, some additional properties exist: | Property | Description | | ----------: |------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | `stacking` | Where the window should appear in the stack. Possible values: `fg`, `bg`, `overlay`, `bottom`. | -| `exclusive` | Whether the compositor should reserve space for the window automatically. Either `true` or `false`. | +| `exclusive` | Whether the compositor should reserve space for the window automatically. Either `true` or `false`. If `true` `:anchor` has to include `center`. | | `focusable` | Whether the window should be able to be focused. This is necessary for any widgets that use the keyboard to work. Possible values: `none`, `exclusive` and `ondemand`. | | `namespace` | Set the wayland layersurface namespace eww uses. Accepts a `string` value. |