From 70b4f40becb64da15fbcf0363d59db5d995641cf Mon Sep 17 00:00:00 2001 From: dalahast Date: Mon, 25 May 2020 10:57:48 +0200 Subject: [PATCH] add multihead workspace switching script for swaywm --- .local/bin/switchws.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100755 .local/bin/switchws.py diff --git a/.local/bin/switchws.py b/.local/bin/switchws.py new file mode 100755 index 0000000..4d22634 --- /dev/null +++ b/.local/bin/switchws.py @@ -0,0 +1,12 @@ +#!/usr/bin/python + +import json,sys,subprocess + +args = sys.argv +msg = json.loads(subprocess.run(["swaymsg", "-t", "get_workspaces"], stdout=subprocess.PIPE).stdout.decode('utf-8')) +for i in range(len(msg)): + if msg[i]["focused"] == True: + if msg[i]["output"] == "DP-1": + subprocess.run(["swaymsg", "workspace", str(args[1])]) + if msg[i]["output"] == "DVI-D-1": + subprocess.run(["swaymsg", "workspace", "P" + str(args[1])])