diff options
| author | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-06-17 12:49:16 +1000 |
|---|---|---|
| committer | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-06-17 12:49:16 +1000 |
| commit | 2c94c42cbd269b9b7fae3ad4d33e31e493e739b4 (patch) | |
| tree | 3593981fecd1847bd0bfe423a0f7942483ba9055 /src/caelestia/subcommands/screenshot.py | |
| parent | completions: update for prev commit (diff) | |
| download | caelestia-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/screenshot.py')
| -rw-r--r-- | src/caelestia/subcommands/screenshot.py | 29 |
1 files changed, 12 insertions, 17 deletions
diff --git a/src/caelestia/subcommands/screenshot.py b/src/caelestia/subcommands/screenshot.py index a535f6f..acd1725 100644 --- a/src/caelestia/subcommands/screenshot.py +++ b/src/caelestia/subcommands/screenshot.py @@ -4,6 +4,7 @@ from argparse import Namespace from datetime import datetime from caelestia.utils import hypr +from caelestia.utils.notify import notify from caelestia.utils.paths import screenshots_cache_dir, screenshots_dir @@ -59,22 +60,16 @@ class Command: screenshots_cache_dir.mkdir(exist_ok=True, parents=True) dest.write_bytes(sc_data) - action = subprocess.check_output( - [ - "notify-send", - "-i", - "image-x-generic-symbolic", - "-h", - f"STRING:image-path:{dest}", - "-a", - "caelestia-cli", - "--action=open=Open", - "--action=save=Save", - "Screenshot taken", - f"Screenshot stored in {dest} and copied to clipboard", - ], - text=True, - ).strip() + action = notify( + "-i", + "image-x-generic-symbolic", + "-h", + f"STRING:image-path:{dest}", + "--action=open=Open", + "--action=save=Save", + "Screenshot taken", + f"Screenshot stored in {dest} and copied to clipboard", + ) if action == "open": subprocess.Popen(["swappy", "-f", dest], start_new_session=True) @@ -82,4 +77,4 @@ class Command: new_dest = (screenshots_dir / dest.name).with_suffix(".png") new_dest.parent.mkdir(exist_ok=True, parents=True) dest.rename(new_dest) - subprocess.run(["notify-send", "Screenshot saved", f"Saved to {new_dest}"]) + notify("Screenshot saved", f"Saved to {new_dest}") |