From adc2691bc608c0343d7bcc18f036f019bb9dd430 Mon Sep 17 00:00:00 2001 From: Mateus Dubiela Oliveira Date: Mon, 26 Sep 2016 22:33:06 -0300 Subject: [PATCH] Fix swap monitors scripts (#26) The old script for swapping monitors had a issue if the first two outputs were not `active`, not making the swap correctly. I added a `filter` function on top of the retrieved output in order to retrieve only active outputs and swap only between then. --- docs/user-contributed/swapping-workspaces.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/user-contributed/swapping-workspaces.html b/docs/user-contributed/swapping-workspaces.html index a1278ef..4a3019e 100644 --- a/docs/user-contributed/swapping-workspaces.html +++ b/docs/user-contributed/swapping-workspaces.html @@ -28,7 +28,8 @@ The script uses i3's IPC via the
#!/usr/bin/python2.7
 
 import i3
-outputs = i3.get_outputs()
+# retrieve only active outputs
+outputs = filter(lambda output: output['active'], i3.get_outputs())
 
 # set current workspace to output 0
 i3.workspace(outputs[0]['current_workspace'])
-- 
2.39.5