summaryrefslogtreecommitdiff
path: root/.local/bin/screenshot
diff options
context:
space:
mode:
authorryukamish <[email protected]>2026-06-06 01:44:49 +0530
committerryukamish <[email protected]>2026-06-06 01:44:49 +0530
commit51183654e84b12d38cf72d8581f950269d6b47c1 (patch)
treebb327aff9bc87c692d401f392ce375c52133e965 /.local/bin/screenshot
parentb91a830fe91c2819cb0ca9b91dcfdcb02b2a2ead (diff)
fix: directory and symlink path change
Diffstat (limited to '.local/bin/screenshot')
-rwxr-xr-x.local/bin/screenshot25
1 files changed, 25 insertions, 0 deletions
diff --git a/.local/bin/screenshot b/.local/bin/screenshot
new file mode 100755
index 0000000..7328c10
--- /dev/null
+++ b/.local/bin/screenshot
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+filename='screenshot_%Y-%m-%d-%H%M%S.png'
+
+case "$1" in
+ "region")
+ slurp | grim -t png -g - $HOME/pictures/Screenshots/$(date +$filename)
+ ;;
+ "window")
+ swaymsg -t get_tree \
+ | jq -r '.. | select(.pid? and .visible?) | .rect | "\(.x),\(.y) \(.width)x\(.height)"' \
+ | slurp \
+ | grim -t png -g - $HOME/pictures/Screenshots/$(date +$filename)
+ ;;
+ "screen-internal")
+ grim -o eDP-1 -t png $HOME/pictures/Screenshots/$(date +$filename)
+ ;;
+ "screen-external")
+ grim -o HDMI-A-1 -t png $HOME/pictures/Screenshots/$(date +$filename)
+ ;;
+ *)
+ grim -t png $HOME/pictures/Screenshots/$(date +$filename)
+ ;;
+esac
+