Update wayland-screenshot.sh

This commit is contained in:
Alexander Rosenberg 2024-04-29 03:18:02 -07:00
parent fa4f74301b
commit 9c80e72e37
Signed by: Zander671
GPG Key ID: 5FD0394ADBD72730

View File

@ -2,7 +2,6 @@
local resp="$(fuzzel --index -d <<'EOF' local resp="$(fuzzel --index -d <<'EOF'
Whole screen Whole screen
Current window
Selected area Selected area
Copy text with OCR (English) Copy text with OCR (English)
Copy text with OCR (Japanese) Copy text with OCR (Japanese)
@ -28,24 +27,17 @@ case "${resp}" in
grim "${outfile}" grim "${outfile}"
;; ;;
1) 1)
local active_window="$(hyprctl -j activewindow)"
[[ activewindow == '{}' ]] ||
jq -r --null-input --argjson 'window' "${active_window}" \
'$window | "\(.at[0]),\(.at[1]) \(.size[0])x\(.size[1])"' |
grim -g - "${outfile}"
;;
2)
local area="$(slurp 2>&1)" local area="$(slurp 2>&1)"
[[ "${area}" == 'selection cancelled' ]] || [[ "${area}" == 'selection cancelled' ]] ||
grim -g "${area}" "${outfile}" grim -g "${area}" "${outfile}"
;; ;;
3) 2)
copy_with_ocr eng copy_with_ocr eng
;; ;;
4) 3)
copy_with_ocr jpn copy_with_ocr jpn
;; ;;
5) 4)
local color="$(hyprpicker -f hex -n -r)" local color="$(hyprpicker -f hex -n -r)"
(( ${#color} == 0 )) && exit (( ${#color} == 0 )) && exit
wl-copy "${color}" wl-copy "${color}"