zero/home-environments/radio/files/.local/bin/screenshot

22 lines
853 B
Plaintext
Raw Permalink Normal View History

2024-03-23 06:11:36 +00:00
#!/bin/sh
case "$1" in
"activewindow")
# Get active window geometry
eval $(xdotool getactivewindow getwindowgeometry --shell)
REGION="$((${WIDTH} + 10))x$((${HEIGHT}+10))+$((${X}-5))+$((${Y}-5))"
maim -Bg "${REGION}" | xclip -selection clipboard -t image/png;;
"selectwindow")
# Let the user select a window and get its geometry
eval $(xdotool selectwindow getwindowgeometry --shell)
REGION="$((${WIDTH} + 10))x$((${HEIGHT}+10))+$((${X}-5))+$((${Y}-5))"
maim -Bg "${REGION}" | xclip -selection clipboard -t image/png;;
"selectregion")
maim -s | xclip -selection clipboard -t image/png;;
*)
# Get current screen
SCREEN=$(xdotool get_desktop)
REGION="$(hostname):${SCREEN}.1"
maim -u | xclip -selection clipboard -t image/png;;
esac