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])])