From 83f075ad1ddb4c4eff0673fdfc2072f7260dc80d Mon Sep 17 00:00:00 2001 From: neodarz Date: Fri, 30 Mar 2018 09:40:41 +0200 Subject: Add scripts for move workspaces --- scripts/.scripts/cycle-workspace_more_2.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 scripts/.scripts/cycle-workspace_more_2.py (limited to 'scripts/.scripts/cycle-workspace_more_2.py') diff --git a/scripts/.scripts/cycle-workspace_more_2.py b/scripts/.scripts/cycle-workspace_more_2.py new file mode 100644 index 0000000..81ea163 --- /dev/null +++ b/scripts/.scripts/cycle-workspace_more_2.py @@ -0,0 +1,27 @@ +#!/usr/bin/env python + +# cycle-workspace +# Moves the currently active workspace to the next active display +# Depends on i3-py (`pip install i3-py`) + +import i3 + +# figure out what is on, and what is currently on your screen. +focused_workspace = list(filter(lambda s: s['focused'], i3.get_workspaces()))[0] +outputs = list(filter(lambda s: s['active'], i3.get_outputs())) + +# find the index of the currently focused workspace +currentIndex = 0 +for i, output in enumerate(outputs): + if output['name'] == focused_workspace['output']: + currentIndex = i + break + +# find the next workspace +nextIndex = currentIndex + 1 +if nextIndex >= len(outputs): + nextIndex = 0 +other_workspace = outputs[nextIndex] + +# send current to the no-active one +i3.command('move', 'workspace to output '+other_workspace['name']) -- cgit v1.2.1