summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--completions/caelestia.fish1
-rw-r--r--src/caelestia/parser.py1
-rw-r--r--src/caelestia/subcommands/shell.py5
3 files changed, 6 insertions, 1 deletions
diff --git a/completions/caelestia.fish b/completions/caelestia.fish
index 894038c..7e310da 100644
--- a/completions/caelestia.fish
+++ b/completions/caelestia.fish
@@ -25,6 +25,7 @@ complete -c caelestia -n $not_seen -a 'pip' -d 'Picture in picture utilities'
# Shell
set -l commands mpris drawers wallpaper notifs
set -l not_seen "$seen shell && not $seen $commands"
+complete -c caelestia -n $not_seen -s 'd' -l 'daemon' -d 'Start the shell detached'
complete -c caelestia -n $not_seen -s 's' -l 'show' -d 'Print all IPC commands'
complete -c caelestia -n $not_seen -s 'l' -l 'log' -d 'Print the shell log'
complete -c caelestia -n $not_seen -a 'mpris' -d 'Mpris control'
diff --git a/src/caelestia/parser.py b/src/caelestia/parser.py
index 5b1e924..e39b29c 100644
--- a/src/caelestia/parser.py
+++ b/src/caelestia/parser.py
@@ -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",
diff --git a/src/caelestia/subcommands/shell.py b/src/caelestia/subcommands/shell.py
index 11c979c..e8017fe 100644
--- a/src/caelestia/subcommands/shell.py
+++ b/src/caelestia/subcommands/shell.py
@@ -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)