From 3119db6af366994d88c9168f2249988a6d9c0c64 Mon Sep 17 00:00:00 2001
From: Jiri Kalvoda <jirikalvoda@kam.mff.cuni.cz>
Date: Sun, 28 Aug 2022 23:20:36 +0200
Subject: [PATCH] Add main function swap-with-workspace

---
 woman/main_functions.py | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/woman/main_functions.py b/woman/main_functions.py
index 6c38e8b..c291b60 100644
--- a/woman/main_functions.py
+++ b/woman/main_functions.py
@@ -111,6 +111,14 @@ def mf_goto_workspace(params):
     n_master, n_slave = params_workspace(params)
     goto_workspace(n_master, n_slave)
 
+@main_function(["swap-with-workspace", "s"], std_parser, "Swap current workspace with specified workspace.")
+def mf_swap_with_workspace(params):
+    n_master, n_slave = params_workspace(params)
+    current = shared.workspace_on[shared.output]
+    print(current)
+    if current != (None, None) and current != GUI_WORKSPACE:
+        swap_workspace(n_master, n_slave, *current)
+
 @main_function(["gui"], [], "Show grafic user interface (only if you start daemon with `-g` option).")
 def mf_gui(params):
     if shared.workspace_on[shared.output] == GUI_WORKSPACE:
-- 
GitLab