Commit 1fe5ab8
xxwhirlpool
·
2025-06-07 07:09:10 -0400 EDT
parent f829623
add screenshot scripts
2 files changed,
+47,
-0
+25,
-0
| ... | ... | @@ -0,0 +1,25 @@ | |
| 1 | + | #!/usr/bin/env bash | |
| 2 | + | # | |
| 3 | + | # modified from this GH script: | |
| 4 | + | # | |
| 5 | + | # https://github.com/BreadOnPenguins/scripts/blob/master/screenshot_extra_features | |
| 6 | + | ||
| 7 | + | export DISPLAY=:0 | |
| 8 | + | SHOTPATH="/home/kat/Pictures/Screenshots" | |
| 9 | + | COUNT=$(find $SHOTPATH -type f -printf x | wc -c | awk '{print $1+1}' | awk '{printf "%04d\n", $0}') | |
| 10 | + | FILE="$SHOTPATH/$COUNT.png" | |
| 11 | + | ||
| 12 | + | # Determine screenshot utility | |
| 13 | + | if command -v import &> /dev/null; then | |
| 14 | + | TOOL="import" | |
| 15 | + | elif command -v scrot &> /dev/null; then | |
| 16 | + | TOOL="scrot" | |
| 17 | + | else | |
| 18 | + | notify-send "Screenshot Tool Missing" "Neither ImageMagick (import) nor scrot is installed!" | |
| 19 | + | echo "Error: No screenshot tool found (import or scrot)." | |
| 20 | + | exit 1 | |
| 21 | + | fi | |
| 22 | + | ||
| 23 | + | import -window root "$FILE" || exit 1 | |
| 24 | + | ||
| 25 | + | notify-send "Screenshot Taken" "Saved as ${FILE} in ${SHOTPATH}" |
+22,
-0
| ... | ... | @@ -0,0 +1,22 @@ | |
| 1 | + | #!/usr/bin/env bash | |
| 2 | + | ||
| 3 | + | # modified from this GH script: | |
| 4 | + | # | |
| 5 | + | # https://github.com/BreadOnPenguins/scripts/blob/master/screenshot_extra_features | |
| 6 | + | ||
| 7 | + | export DISPLAY=:0 | |
| 8 | + | SHOTPATH="/home/kat/Pictures/Screenshots" | |
| 9 | + | COUNT=$(find $SHOTPATH -type f -printf x | wc -c | awk '{print $1+1}' | awk '{printf "%04d\n", $0}') | |
| 10 | + | FILE="$SHOTPATH/$COUNT.png" | |
| 11 | + | ||
| 12 | + | ||
| 13 | + | selection () { # draw a selection, or click to select a window | |
| 14 | + | import "$FILE" && post | |
| 15 | + | } | |
| 16 | + | ||
| 17 | + | ||
| 18 | + | post () { # copy image to clip & send a notification | |
| 19 | + | xclip -selection clipboard -t image/png -i $FILE && notify-send -i "$FILE" "$FILE copied to clipboard" | |
| 20 | + | } | |
| 21 | + | ||
| 22 | + | selection |