From: Mateus Dubiela Oliveira Date: Tue, 27 Sep 2016 01:33:06 +0000 (-0300) Subject: Fix swap monitors scripts (#26) X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=adc2691bc608c0343d7bcc18f036f019bb9dd430;p=i3%2Fi3.github.io 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. --- 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'])