commit e006f590491bb3af9884ca243519b466f96c81b5
parent 5ba519c267ec580b94a0af07c3bf303e992d36b8
Author: deurzen <m.deurzen@tum.de>
Date: Fri, 7 May 2021 08:27:04 +0200
adds client iconifyability toggle
Diffstat:
3 files changed, 50 insertions(+), 2 deletions(-)
diff --git a/src/core/client.rs b/src/core/client.rs
@@ -78,6 +78,7 @@ pub struct Client {
contained: Cell<bool>,
invincible: Cell<bool>,
sticky: Cell<bool>,
+ iconifyable: Cell<bool>,
iconified: Cell<bool>,
disowned: Cell<bool>,
consuming: Cell<bool>,
@@ -147,8 +148,9 @@ impl Client {
fullscreen: Cell::new(false),
contained: Cell::new(false),
invincible: Cell::new(false),
- iconified: Cell::new(false),
sticky: Cell::new(false),
+ iconifyable: Cell::new(true),
+ iconified: Cell::new(false),
disowned: Cell::new(false),
consuming: Cell::new(false),
producing: Cell::new(true),
@@ -679,6 +681,19 @@ impl Client {
}
#[inline]
+ pub fn set_iconifyable(
+ &self,
+ toggle: Toggle,
+ ) {
+ self.iconifyable.set(toggle.eval(self.iconifyable.get()));
+ }
+
+ #[inline]
+ pub fn is_iconifyable(&self) -> bool {
+ self.iconifyable.get()
+ }
+
+ #[inline]
pub fn set_producing(
&self,
toggle: Toggle,
diff --git a/src/core/main.rs b/src/core/main.rs
@@ -172,6 +172,7 @@ fn init_bindings() -> (MouseBindings, KeyBindings) {
"1-2-C-f" => do_internal!(set_contained_focus, Toggle::Reverse),
"1-2-C-i" => do_internal!(set_invincible_focus, Toggle::Reverse),
"1-2-C-p" => do_internal!(set_producing_focus, Toggle::Reverse),
+ "1-2-C-y" => do_internal!(set_iconifyable_focus, Toggle::Reverse),
"1-y" => do_internal!(set_iconify_focus, Toggle::On),
"1-u" => do_internal!(pop_deiconify),
"1-2-u" => do_internal_block!(model, {
diff --git a/src/core/model.rs b/src/core/model.rs
@@ -1704,6 +1704,36 @@ impl<'model> Model<'model> {
client.set_producing(toggle);
}
+ #[inline(always)]
+ pub fn set_iconifyable_focus(
+ &self,
+ toggle: Toggle,
+ ) {
+ if let Some(focus) = self.focus.get() {
+ self.set_iconifyable_window(focus, toggle);
+ }
+ }
+
+ #[inline(always)]
+ pub fn set_iconifyable_window(
+ &self,
+ window: Window,
+ toggle: Toggle,
+ ) {
+ if let Some(client) = self.client(window) {
+ self.set_iconifyable_client(client, toggle);
+ }
+ }
+
+ #[inline(always)]
+ fn set_iconifyable_client(
+ &self,
+ client: &Client,
+ toggle: Toggle,
+ ) {
+ client.set_iconifyable(toggle);
+ }
+
#[inline]
pub fn set_iconify_focus(
&self,
@@ -1731,7 +1761,9 @@ impl<'model> Model<'model> {
toggle: Toggle,
) {
if toggle.eval(client.is_iconified()) {
- self.iconify(client);
+ if client.is_iconifyable() {
+ self.iconify(client);
+ }
} else {
self.deiconify(client);
}