From 6bf82016de284a9472c664b2e85d9ca87dedb81f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=9Eahin=20Akkaya?= Date: Sun, 22 May 2022 16:43:29 +0300 Subject: [PATCH] Switch to prev group when last window closed --- .config/qtile/modules/hooks.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.config/qtile/modules/hooks.py b/.config/qtile/modules/hooks.py index e39b293..bbd9657 100644 --- a/.config/qtile/modules/hooks.py +++ b/.config/qtile/modules/hooks.py @@ -14,6 +14,13 @@ def show_window(window): window.group.cmd_toscreen() +@hook.subscribe.client_killed +def toggle_previous_group_if_last_window_killed(window): + group = window.group + if len(group.info()['windows']) == 1: + group.screen.toggle_group() + + @hook.subscribe.client_managed @hook.subscribe.client_urgent_hint_changed @hook.subscribe.client_killed @@ -25,3 +32,4 @@ def hook_response(*args, **kwargs): file = os.path.expanduser('~/.cache/workspaces') with open(file, 'a') as f: print('workspace changed', file=f) +