aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xdotfiles/scripts/cycle-workspace-multiscreen.py15
1 files changed, 10 insertions, 5 deletions
diff --git a/dotfiles/scripts/cycle-workspace-multiscreen.py b/dotfiles/scripts/cycle-workspace-multiscreen.py
index d1da2d8..5e3d32a 100755
--- a/dotfiles/scripts/cycle-workspace-multiscreen.py
+++ b/dotfiles/scripts/cycle-workspace-multiscreen.py
@@ -19,7 +19,7 @@ output_origin = ""
for output in outputs:
if output['current_workspace'] == workspace_origin['name']:
- output_origin = output
+ output_origin = output
output_destination = workspace_origin
@@ -60,7 +60,7 @@ if sys.argv[1] == "top":
next_workspace_start = output_origin_y - output_origin_height
output_origin_x = output_origin['rect']['x']
for output in outputs:
- next_workspace_start=output_origin_y - output['rect']['height']
+ next_workspace_start = output_origin_y - output['rect']['height']
output_end = output['rect']['x'] + output['rect']['width']
# FIXME: screen must have the same start x position and screen with not
# the same resolution can by buggy
@@ -70,17 +70,22 @@ if sys.argv[1] == "top":
if (output_destination != workspace_origin):
+ wrksp_orig = workspace_origin['name']
+ wkrsp_dest = output_destination['current_workspace']
# Move origin workspace to the correct screen
i3.command('move', 'workspace to output '+output_destination['name'])
# Rename origin workspace to temporary workspace of the screen destination
- i3.command('rename', 'workspace '+str(workspace_origin['name'])+' to a_fucking_workspace')
+ cmd = f"workspace {wrksp_orig} to a_fucking_workspace"
+ i3.command('rename', cmd)
# Change focus to the workspace destination
i3.workspace(output_destination['current_workspace'])
# Move destination workspace to the correct screen
i3.command('move', 'workspace to output '+workspace_origin['output'])
# Rename workspace destination to the origin workspace
- i3.command('rename', 'workspace '+output_destination['current_workspace']+' to '+str(workspace_origin['name']))
+ cmd = f"workspace {wkrsp_dest} to {wrksp_orig}"
+ i3.command('rename', cmd)
# Rename temporary workspace to workspace destination
- i3.command('rename', 'workspace a_fucking_workspace to '+output_destination['current_workspace'])
+ cmd = f"workspace a_fucking_workspace to {wkrsp_dest}"
+ i3.command('rename', cmd)
# Change focus the workspace destination
i3.workspace(output_destination['current_workspace'])