-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
executable file
·48 lines (34 loc) · 916 Bytes
/
main.py
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/env python3
# usage: i3-save <workspace name>
import click
import i3ipc
import inject
from i3launcher.config import load_config
from i3launcher.injector import configure_injector
from i3launcher.i3 import I3Launcher
@click.group()
def main():
config = load_config()
connection = i3ipc.Connection()
configure_injector(config, connection)
@main.command("launch-all")
def launch_all():
l = I3Launcher()
l.launch_all_workspaces()
@main.command("launch")
@click.argument("workspace_name")
def launch(workspace_name):
l = I3Launcher()
l.launch_workspace(workspace_name)
@click.option(
"--target",
type=click.Choice(["all", "current"]),
default="all",
help="Specify which workspaces to save",
)
@main.command("save")
def save(target: str):
l = I3Launcher()
l.save_workspace(all_workspaces=(target == "all"))
if __name__ == "__main__":
main()