summaryrefslogtreecommitdiff
path: root/src/caelestia/subcommands/record.py
diff options
context:
space:
mode:
author2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-06-17 12:49:16 +1000
committer2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-06-17 12:49:16 +1000
commit2c94c42cbd269b9b7fae3ad4d33e31e493e739b4 (patch)
tree3593981fecd1847bd0bfe423a0f7942483ba9055 /src/caelestia/subcommands/record.py
parentcompletions: update for prev commit (diff)
downloadcaelestia-cli-2c94c42cbd269b9b7fae3ad4d33e31e493e739b4.tar.gz
caelestia-cli-2c94c42cbd269b9b7fae3ad4d33e31e493e739b4.tar.bz2
caelestia-cli-2c94c42cbd269b9b7fae3ad4d33e31e493e739b4.zip
scheme: add notify opt
For sending a notification on error
Diffstat (limited to 'src/caelestia/subcommands/record.py')
-rw-r--r--src/caelestia/subcommands/record.py35
1 files changed, 10 insertions, 25 deletions
diff --git a/src/caelestia/subcommands/record.py b/src/caelestia/subcommands/record.py
index a4fa51d..dd0a5d0 100644
--- a/src/caelestia/subcommands/record.py
+++ b/src/caelestia/subcommands/record.py
@@ -3,6 +3,7 @@ import time
from argparse import Namespace
from datetime import datetime
+from caelestia.utils.notify import notify
from caelestia.utils.paths import recording_notif_path, recording_path, recordings_dir
@@ -48,20 +49,10 @@ class Command:
# Send notif if proc hasn't ended after a small delay
time.sleep(0.1)
if proc.poll() is None:
- notif = subprocess.check_output(
- ["notify-send", "-p", "-a", "caelestia-cli", "Recording started", "Recording..."], text=True
- ).strip()
+ notif = notify("-p", "Recording started", "Recording...")
recording_notif_path.write_text(notif)
else:
- subprocess.run(
- [
- "notify-send",
- "-a",
- "caelestia-cli",
- "Recording failed",
- f"Recording failed to start: {proc.communicate()[1]}",
- ]
- )
+ notify("Recording failed", f"Recording failed to start: {proc.communicate()[1]}")
def stop(self) -> None:
subprocess.run(["pkill", "wl-screenrec"])
@@ -87,19 +78,13 @@ class Command:
except IOError:
pass
- action = subprocess.check_output(
- [
- "notify-send",
- "-a",
- "caelestia-cli",
- "--action=watch=Watch",
- "--action=open=Open",
- "--action=delete=Delete",
- "Recording stopped",
- f"Recording saved in {new_path}",
- ],
- text=True,
- ).strip()
+ action = notify(
+ "--action=watch=Watch",
+ "--action=open=Open",
+ "--action=delete=Delete",
+ "Recording stopped",
+ f"Recording saved in {new_path}",
+ )
if action == "watch":
subprocess.Popen(["app2unit", "-O", new_path], start_new_session=True)