From 05d4e07a811686aaf36158a8848b2436b4a63a60 Mon Sep 17 00:00:00 2001 From: neodarz Date: Tue, 10 Apr 2018 09:52:45 +0200 Subject: Add top and bottom workspace switch --- scripts/.scripts/cycle-workspace_more_2.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/scripts/.scripts/cycle-workspace_more_2.py b/scripts/.scripts/cycle-workspace_more_2.py index fd2b13d..e49b6df 100755 --- a/scripts/.scripts/cycle-workspace_more_2.py +++ b/scripts/.scripts/cycle-workspace_more_2.py @@ -10,6 +10,12 @@ import sys # figure out what is on, and what is currently on your screen. workspace_origin = list(filter(lambda s: s['focused'], i3.get_workspaces()))[0] outputs = list(filter(lambda s: s['active'], i3.get_outputs())) +output_origin = "" + +print(workspace_origin) +for output in outputs: + if output['current_workspace'] == workspace_origin['name']: + output_origin = output def rename(origin, destination): if destination >= 1 and destination <= 10: @@ -39,6 +45,23 @@ if sys.argv[1] == "left": if next_workspace_start == output['rect']['x']: workspace_destination = output +if sys.argv[1] == "bottom": + workspace_origin_y = output_origin['rect']['y'] + workspace_origin_height = output_origin['rect']['height'] + next_workspace_start = workspace_origin_y + workspace_origin_height + for output in outputs: + if next_workspace_start == output['rect']['y']: + workspace_destination = output + +if sys.argv[1] == "top": + workspace_origin_y = output_origin['rect']['y'] + workspace_origin_height = output_origin['rect']['height'] + next_workspace_start = workspace_origin_y - workspace_origin_height + for output in outputs: + next_workspace_start=workspace_origin_y - output['rect']['height'] + if next_workspace_start == output['rect']['y']: + workspace_destination = output + if (workspace_destination != workspace_origin): # Because workspace name are fixed to screen, just rename workspace can change workspace to another screen. # Get temprory workspace of the screen destination (10, 20 or 30) -- cgit v1.2.1