-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathworkspaces
More file actions
executable file
·34 lines (28 loc) · 807 Bytes
/
Copy pathworkspaces
File metadata and controls
executable file
·34 lines (28 loc) · 807 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/python
import subprocess
import time
def current_workspace():
active = subprocess.run("hyprctl activewindow".split(), stdout=subprocess.PIPE).stdout.decode("utf-8").strip()
return int(active.split(":")[4].split()[0].strip())
def gen_map(e):
current = current_workspace()
print(f"{current=}")
if e < current:
return [i for i in range(e+1, current, -1)]
elif e > current:
return [i for i in range(current,e+1)]
else:
return [current]
def go_to(e):
print(f"change to {e}")
_map = gen_map(e)
print(f"{_map=}")
t = 0.03*len(_map)
for i in _map:
subprocess.run(f"hyprctl dispatch workspace {i}".split())
time.sleep(t)
if t != 0.01:
t -= 0.03
else:
t -= 0.02
go_to(10)