Created
March 27, 2025 23:02
-
-
Save digitalsignalperson/422d2af186033be8e8fdf32487a295e5 to your computer and use it in GitHub Desktop.
kde fast screenshot
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
cleanup(){ | |
[[ -n $1 ]] && rm -f "$1" | |
} | |
tempfile=$(mktemp -t screenshot-XXXXXX.png) | |
trap "cleanup '$tempfile'" EXIT | |
spectacle --fullscreen --background --nonotify --output "$tempfile" & | |
geometry=$(slurp) | |
wait | |
if [ -z "$geometry" ]; then | |
exit 1 | |
fi | |
read -r x y w h <<< $(echo "$geometry" | sed 's/,/ /' | sed 's/x/ /') | |
convert "$tempfile" -crop "${w}x${h}+${x}+${y}" PNG:- | wl-copy |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment