summaryrefslogtreecommitdiff
path: root/src/caelestia
diff options
context:
space:
mode:
author2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-08-04 15:40:17 +1000
committer2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-08-04 15:40:17 +1000
commitd8037819f01ef2eb920516ce50237a922019684b (patch)
tree2353531ebe95a7ae69aaa5c77b767a3db7f737d9 /src/caelestia
parenttheme: add template system (#36) (diff)
downloadcaelestia-cli-d8037819f01ef2eb920516ce50237a922019684b.tar.gz
caelestia-cli-d8037819f01ef2eb920516ce50237a922019684b.tar.bz2
caelestia-cli-d8037819f01ef2eb920516ce50237a922019684b.zip
ci: add flake update workflow
Also add contributing, funding and issue templates parser: add kill option to shell version: fix errors when not on arch
Diffstat (limited to 'src/caelestia')
-rw-r--r--src/caelestia/parser.py1
-rw-r--r--src/caelestia/subcommands/shell.py3
-rw-r--r--src/caelestia/utils/version.py48
3 files changed, 34 insertions, 18 deletions
diff --git a/src/caelestia/parser.py b/src/caelestia/parser.py
index 550842d..35266b2 100644
--- a/src/caelestia/parser.py
+++ b/src/caelestia/parser.py
@@ -22,6 +22,7 @@ def parse_args() -> (argparse.ArgumentParser, argparse.Namespace):
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", "--log", action="store_true", help="print the shell log")
+ shell_parser.add_argument("-k", "--kill", action="store_true", help="kill the shell")
shell_parser.add_argument("--log-rules", metavar="RULES", help="log rules to apply")
# Create parser for toggle opts
diff --git a/src/caelestia/subcommands/shell.py b/src/caelestia/subcommands/shell.py
index 06f3b45..4cdd128 100644
--- a/src/caelestia/subcommands/shell.py
+++ b/src/caelestia/subcommands/shell.py
@@ -17,6 +17,9 @@ class Command:
elif self.args.log:
# Print the log
self.print_log()
+ elif self.args.kill:
+ # Kill the shell
+ self.shell("kill")
elif self.args.message:
# Send a message
self.message(*self.args.message)
diff --git a/src/caelestia/utils/version.py b/src/caelestia/utils/version.py
index 7c5ce88..5e75387 100644
--- a/src/caelestia/utils/version.py
+++ b/src/caelestia/utils/version.py
@@ -1,30 +1,42 @@
+import shutil
import subprocess
from caelestia.utils.paths import config_dir
def print_version() -> None:
- print("Packages:")
- pkgs = ["caelestia-shell-git", "caelestia-cli-git", "caelestia-meta"]
- versions = subprocess.run(
- ["pacman", "-Q", *pkgs], stdout=subprocess.PIPE, stderr=subprocess.DEVNULL, text=True
- ).stdout
+ if shutil.which("pacman"):
+ print("Packages:")
+ pkgs = ["caelestia-shell-git", "caelestia-cli-git", "caelestia-meta"]
+ versions = subprocess.run(
+ ["pacman", "-Q", *pkgs], stdout=subprocess.PIPE, stderr=subprocess.DEVNULL, text=True
+ ).stdout
- for pkg in pkgs:
- if pkg not in versions:
- print(f" {pkg} not installed")
- print("\n".join(f" {pkg}" for pkg in versions.splitlines()))
+ for pkg in pkgs:
+ if pkg not in versions:
+ print(f" {pkg} not installed")
+ print("\n".join(f" {pkg}" for pkg in versions.splitlines()))
+ else:
+ print("Packages: not on Arch")
- caelestia_dir = (config_dir / "hypr").resolve().parent
- print("\nCaelestia:")
- caelestia_ver = subprocess.check_output(
- ["git", "--git-dir", caelestia_dir / ".git", "rev-list", "--format=%B", "--max-count=1", "HEAD"], text=True
- )
- print(" Last commit:", caelestia_ver.split()[1])
- print(" Commit message:", *caelestia_ver.splitlines()[1:])
+ print()
+ try:
+ caelestia_dir = (config_dir / "hypr").resolve().parent
+ caelestia_ver = subprocess.check_output(
+ ["git", "--git-dir", caelestia_dir / ".git", "rev-list", "--format=%B", "--max-count=1", "HEAD"], text=True
+ )
+ print("Caelestia:")
+ print(" Last commit:", caelestia_ver.split()[1])
+ print(" Commit message:", *caelestia_ver.splitlines()[1:])
+ except subprocess.CalledProcessError:
+ print("Caelestia: not installed")
- print("\nQuickshell:")
- print(" ", subprocess.check_output(["qs", "--version"], text=True).strip())
+ print()
+ if shutil.which("qs"):
+ print("Quickshell:")
+ print(" ", subprocess.check_output(["qs", "--version"], text=True).strip())
+ else:
+ print("Quickshell: not in PATH")
local_shell_dir = config_dir / "quickshell/caelestia"
if local_shell_dir.exists():