diff --git a/ScreenShot/screengrab b/ScreenShot/screengrab index cedbeae..15119de 100755 --- a/ScreenShot/screengrab +++ b/ScreenShot/screengrab @@ -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 +