feat: sway workspace switcher (swws) logic update

This commit is contained in:
surtur 2020-10-05 18:25:46 +02:00
parent 1d0cc6b02f
commit 684814a570
Signed by: wanderer
GPG Key ID: 19CE1EC1D9E0486D

@ -10,6 +10,12 @@ else:
a = "" a = ""
ws = args[1] ws = args[1]
ws10 = str(10+int(ws)) ws10 = str(10+int(ws))
monnum = (subprocess.run(["bash", "-c", "swaymsg -t get_outputs| grep type | grep output | wc -l|xargs"],stdout=subprocess.PIPE)).stdout.decode('utf-8').rstrip()
if (monnum == "2"):
ws20 = ws10
else:
ws20 = str(20+int(ws))
msg = json.loads(subprocess.run(["swaymsg", "-t", "get_workspaces"], stdout=subprocess.PIPE).stdout.decode('utf-8')) msg = json.loads(subprocess.run(["swaymsg", "-t", "get_workspaces"], stdout=subprocess.PIPE).stdout.decode('utf-8'))
def expl_pick(mon_type): def expl_pick(mon_type):
@ -62,7 +68,19 @@ for i in range(len(msg)):
wssw(mon_type) wssw(mon_type)
if msg[i]["output"] == "DP-3": if msg[i]["output"] == "DP-3":
if not a: if not a:
subprocess.run(["swaymsg", "workspace", ws10]) subprocess.run(["swaymsg", "workspace", ws20])
else: else:
mon_type = "DP-3" mon_type = "DP-3"
wssw(mon_type) wssw(mon_type)
if msg[i]["output"] == "DP-4":
if not a:
subprocess.run(["swaymsg", "workspace", ws10])
else:
mon_type = "DP-4"
wssw(mon_type)
if msg[i]["output"] == "DP-5":
if not a:
subprocess.run(["swaymsg", "workspace", ws10])
else:
mon_type = "DP-5"
wssw(mon_type)