From 2e589bf94b57c2bdfd11b29d3113471699cefccb Mon Sep 17 00:00:00 2001 From: Janis Date: Sun, 28 Nov 2021 20:54:38 +0100 Subject: [PATCH] custom runner using Xephyr --- .gitignore | 1 + runner.sh | 12 ++++++++++++ src/backends/traits.rs | 2 ++ src/backends/xlib/mod.rs | 4 ++++ src/clients.rs | 4 +++- 5 files changed, 22 insertions(+), 1 deletion(-) create mode 100755 runner.sh diff --git a/.gitignore b/.gitignore index 2c6f84f..67d0d60 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ /Cargo.lock /.cargo/ /wmlog +/xinitrc.tmp diff --git a/runner.sh b/runner.sh new file mode 100755 index 0000000..78dae00 --- /dev/null +++ b/runner.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +# binary supplied by cargo +bin=$1 + +# write temporary xinitrc +printf "exec $bin\n" > xinitrc.tmp + +# call xinit +XEPHYR_BIN=$(which Xephyr) + +[ -z "$XEPHYR_BIN" ] || exec xinit ./xinitrc.tmp -- $XEPHYR_BIN :100 -ac -screen 800x600 diff --git a/src/backends/traits.rs b/src/backends/traits.rs index c69154c..9ff085f 100644 --- a/src/backends/traits.rs +++ b/src/backends/traits.rs @@ -38,6 +38,8 @@ pub trait WindowServerBackend { fn ungrab_cursor(&self); fn move_cursor(&self, window: Option, position: Point); + fn all_windows(&self) -> Vec; + fn resize_window(&self, window: Self::Window, new_size: Point) { self.configure_window(window, Some(new_size), None, None); } diff --git a/src/backends/xlib/mod.rs b/src/backends/xlib/mod.rs index 1abaf72..7c3c3a7 100644 --- a/src/backends/xlib/mod.rs +++ b/src/backends/xlib/mod.rs @@ -857,6 +857,10 @@ impl WindowServerBackend for XLib { ); } } + + fn all_windows(&self) -> Vec { + todo!() + } } struct XLibAtoms { diff --git a/src/clients.rs b/src/clients.rs index 7710572..d5997ca 100644 --- a/src/clients.rs +++ b/src/clients.rs @@ -537,7 +537,9 @@ impl ClientState { { let (new, old) = self.focus_client_inner(key); - info!("Swapping focus: new({:?}) old({:?})", new, old); + if !(new.is_vacant() && old.is_vacant()) { + info!("Swapping focus: new({:?}) old({:?})", new, old); + } (new, old) }