summaryrefslogtreecommitdiff
path: root/screenshot.fish
diff options
context:
space:
mode:
author2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-05-26 21:44:31 +0800
committer2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-05-26 21:44:31 +0800
commit98cf5cbe126b498199bd0697ec473db482c4672e (patch)
tree8925661b829fabe225239b30e628552ff6ae5200 /screenshot.fish
parentfeat: print scheme command (diff)
downloadcaelestia-cli-98cf5cbe126b498199bd0697ec473db482c4672e.tar.gz
caelestia-cli-98cf5cbe126b498199bd0697ec473db482c4672e.tar.bz2
caelestia-cli-98cf5cbe126b498199bd0697ec473db482c4672e.zip
screenshot: add region and freeze functionality
equibop -> discord with openasar and equicord
Diffstat (limited to 'screenshot.fish')
-rwxr-xr-xscreenshot.fish18
1 files changed, 18 insertions, 0 deletions
diff --git a/screenshot.fish b/screenshot.fish
index 5274c67..ecabbc0 100755
--- a/screenshot.fish
+++ b/screenshot.fish
@@ -4,6 +4,24 @@
mkdir -p "$C_CACHE/screenshots"
set -l tmp_file "$C_CACHE/screenshots/$(date +'%Y%m%d%H%M%S')"
+
+if test "$argv[1]" = 'region'
+ if test "$argv[2]" = 'freeze'
+ wayfreeze --hide-cursor & set PID $last_pid
+ sleep .1
+ end
+
+ set -l ws (hyprctl -j activeworkspace | jq -r '.id')
+ set -l region (hyprctl -j clients | jq -r --argjson activeWsId $ws '.[] | select(.workspace.id == $activeWsId) | "\(.at[0]),\(.at[1]) \(.size[0])x\(.size[1])"' | slurp)
+ if test -n "$region"
+ grim -l 0 -g $region - | swappy -f - &
+ end
+
+ set -q PID && kill $PID
+
+ exit
+end
+
grim $argv $tmp_file; and wl-copy < $tmp_file; or exit 1
set -l action (notify-send -i 'image-x-generic-symbolic' -h "STRING:image-path:$tmp_file" \