Add namespace window option (#723)

This commit is contained in:
ElKowar 2023-03-26 12:26:49 +02:00 committed by GitHub
parent 642983a066
commit 992ac0b59a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 9 additions and 1 deletions

View file

@ -6,6 +6,7 @@ All notable changes to eww will be listed here, starting at changes since versio
## [Unreleased] ## [Unreleased]
### Features ### Features
- Add `:namespace` window option
- Default to building with x11 and wayland support simultaneously - Default to building with x11 and wayland support simultaneously
- Add `truncate-left` property on `label` widgets (By: kawaki-san) - Add `truncate-left` property on `label` widgets (By: kawaki-san)
- Add support for safe access (`?.`) in simplexpr (By: oldwomanjosiah) - Add support for safe access (`?.`) in simplexpr (By: oldwomanjosiah)

View file

@ -54,6 +54,10 @@ mod platform_wayland {
WindowStacking::Overlay => gtk_layer_shell::set_layer(&window, gtk_layer_shell::Layer::Overlay), WindowStacking::Overlay => gtk_layer_shell::set_layer(&window, gtk_layer_shell::Layer::Overlay),
} }
if let Some(namespace) = &window_def.backend_options.wayland.namespace {
gtk_layer_shell::set_namespace(&window, namespace);
}
// Sets the keyboard interactivity // Sets the keyboard interactivity
gtk_layer_shell::set_keyboard_interactivity(&window, window_def.backend_options.wayland.focusable); gtk_layer_shell::set_keyboard_interactivity(&window, window_def.backend_options.wayland.focusable);

View file

@ -34,6 +34,7 @@ impl BackendWindowOptions {
let wayland = WlBackendWindowOptions { let wayland = WlBackendWindowOptions {
exclusive: attrs.primitive_optional("exclusive")?.unwrap_or(false), exclusive: attrs.primitive_optional("exclusive")?.unwrap_or(false),
focusable: attrs.primitive_optional("focusable")?.unwrap_or(false), focusable: attrs.primitive_optional("focusable")?.unwrap_or(false),
namespace: attrs.primitive_optional("namespace")?,
}; };
Ok(Self { x11, wayland }) Ok(Self { x11, wayland })
} }
@ -51,6 +52,7 @@ pub struct X11BackendWindowOptions {
pub struct WlBackendWindowOptions { pub struct WlBackendWindowOptions {
pub exclusive: bool, pub exclusive: bool,
pub focusable: bool, pub focusable: bool,
pub namespace: Option<String>,
} }
/// Window type of an x11 window /// Window type of an x11 window

View file

@ -81,6 +81,7 @@ Depending on if you are using X11 or Wayland, some additional properties exist:
| `stacking` | Where the window should appear in the stack. Possible values: `fg`, `bg`, `overlay`, `bottom`. | | `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. | | `exclusive` | Whether the compositor should reserve space for the window automatically. |
| `focusable` | Whether the window should be able to be focused. This is necessary for any widgets that use the keyboard to work. | | `focusable` | Whether the window should be able to be focused. This is necessary for any widgets that use the keyboard to work. |
| `namespace` | Set the wayland layersurface namespace eww uses |

View file

@ -53,7 +53,7 @@ cd eww
``` ```
Then build: Then build:
```bash ```bash
cargo build --release cargo build --release --no-default-features --features x11
``` ```
**NOTE:** **NOTE:**
When you're on Wayland, build with: When you're on Wayland, build with: