summaryrefslogtreecommitdiff
path: root/src/caelestia
diff options
context:
space:
mode:
author2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-06-19 15:05:44 +1000
committer2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-06-19 15:05:44 +1000
commit09aac148420d0e1a7ae2adc2a7af63e2b2c37a1b (patch)
tree791b9cb1bbdc6f4bea99ece766abb6db31c0e84a /src/caelestia
parentMerge pull request #15 from carloslockward/add-requirements (diff)
downloadcaelestia-cli-09aac148420d0e1a7ae2adc2a7af63e2b2c37a1b.tar.gz
caelestia-cli-09aac148420d0e1a7ae2adc2a7af63e2b2c37a1b.tar.bz2
caelestia-cli-09aac148420d0e1a7ae2adc2a7af63e2b2c37a1b.zip
screenshot: use shell for region
Diffstat (limited to 'src/caelestia')
-rw-r--r--src/caelestia/subcommands/screenshot.py36
1 files changed, 7 insertions, 29 deletions
diff --git a/src/caelestia/subcommands/screenshot.py b/src/caelestia/subcommands/screenshot.py
index acd1725..6b4c00a 100644
--- a/src/caelestia/subcommands/screenshot.py
+++ b/src/caelestia/subcommands/screenshot.py
@@ -1,9 +1,7 @@
import subprocess
-import time
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
@@ -22,34 +20,14 @@ class Command:
def region(self) -> None:
if self.args.region == "slurp":
- freeze_proc = None
-
- if self.args.freeze:
- freeze_proc = subprocess.Popen(["wayfreeze", "--hide-cursor"])
-
- try:
- ws = hypr.message("activeworkspace")["id"]
- geoms = [
- f"{','.join(map(str, c['at']))} {'x'.join(map(str, c['size']))}"
- for c in hypr.message("clients")
- if c["workspace"]["id"] == ws
- ]
-
- # Delay to ensure wayfreeze starts first
- if freeze_proc:
- time.sleep(0.01)
-
- region = subprocess.check_output(["slurp"], input="\n".join(geoms), text=True)
- finally:
- if freeze_proc:
- freeze_proc.kill()
+ subprocess.run(
+ ["qs", "-c", "caelestia", "ipc", "call", "picker", "openFreeze" if self.args.freeze else "open"]
+ )
else:
- region = self.args.region
-
- sc_data = subprocess.check_output(["grim", "-l", "0", "-g", region.strip(), "-"])
- swappy = subprocess.Popen(["swappy", "-f", "-"], stdin=subprocess.PIPE, start_new_session=True)
- swappy.stdin.write(sc_data)
- swappy.stdin.close()
+ sc_data = subprocess.check_output(["grim", "-l", "0", "-g", self.args.region.strip(), "-"])
+ swappy = subprocess.Popen(["swappy", "-f", "-"], stdin=subprocess.PIPE, start_new_session=True)
+ swappy.stdin.write(sc_data)
+ swappy.stdin.close()
def fullscreen(self) -> None:
sc_data = subprocess.check_output(["grim", "-"])