shell: no duplicate + daemon option

This commit is contained in:
2 * r + 2 * t
2025-06-17 22:21:12 +10:00
parent 1ab61223c6
commit 83148d9351
3 changed files with 6 additions and 1 deletions
+1
View File
@@ -18,6 +18,7 @@ def parse_args() -> (argparse.ArgumentParser, argparse.Namespace):
shell_parser = command_parser.add_parser("shell", help="start or message the shell")
shell_parser.set_defaults(cls=shell.Command)
shell_parser.add_argument("message", nargs="*", help="a message to send to the shell")
shell_parser.add_argument("-d", "--daemon", action="store_true", help="start the shell detached")
shell_parser.add_argument("-s", "--show", action="store_true", help="print all shell IPC commands")
shell_parser.add_argument(
"-l",
+4 -1
View File
@@ -20,7 +20,10 @@ class Command:
self.message(*self.args.message)
else:
# Start the shell
subprocess.Popen(["qs", "-c", "caelestia"]).wait()
args = ["qs", "-n", "-c", "caelestia"]
if self.args.daemon:
args.append("-d")
subprocess.run(args)
def shell(self, *args: list[str]) -> str:
return subprocess.check_output(["qs", "-c", "caelestia", *args], text=True)