This commit is contained in:
Joren 2025-01-09 14:18:58 +01:00
parent c310ce0049
commit f9bebb334e
Signed by: Joren
GPG Key ID: 280E33DFBC0F1B55

View File

@ -1,9 +1,7 @@
#!/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() {
@ -20,6 +18,12 @@ capture_window() {
grim -g "$window_geometry" "$FILENAME"
}
open_editor() {
# Open the screenshot in GIMP, ImageMagick's display command, or any preferred editor
photoflare "$FILENAME" &
}
# Capture the screenshot based on the option passed
case "$1" in
--full)
capture_full_screen
@ -31,10 +35,16 @@ case "$1" in
capture_window
;;
*)
echo "Invalid option. Usage: screengrab [--full|--select|--window]"
echo "Invalid option. Usage: screengrab [--full|--select|--window] [--edit]"
exit 1
;;
esac
# Copy to clipboard and notify
wl-copy < "$FILENAME" && notify-send "Screengrab" "Screenshot copied to clipboard"
# If --edit flag is passed, open the screenshot in the editor
if [[ "$2" == "--edit" ]]; then
open_editor
fi