Upload files to "/"

This commit is contained in:
Joren 2024-06-23 02:25:20 +02:00
parent a0d0de6543
commit e532e9e086

42
screengrab Normal file
View File

@ -0,0 +1,42 @@
#!/bin/bash
SAVE_DIR="$HOME/Pictures/Screenshots"
mkdir -p "$SAVE_DIR"
FILENAME="$SAVE_DIR/screenshot_$(date +"%Y-%m-%d_%H-%M-%S").png"
capture_full_screen() {
grim "$FILENAME"
}
capture_selection() {
# Use slurp to select region
region=$(slurp)
grim -g "$region" "$FILENAME"
}
capture_window() {
window_geometry=$(swaymsg -t get_tree | jq -r '.. | select(.focused?) | .rect | "\(.x),\(.y) \(.width)x\(.height)"')
grim -g "$window_geometry" "$FILENAME"
}
case "$1" in
--full)
capture_full_screen
;;
--select)
capture_selection
;;
--window)
capture_window
;;
*)
echo "Invalid option. Usage: screengrab [--full|--select|--window]"
exit 1
;;
esac
wl-copy < "$FILENAME" && notify-send "Screengrab" "Screenshot copied to clipboard"