screenshot 522 B

123456789
  1. #!/bin/bash
  2. [ -d $(xdg-user-dir PICTURES)/screenshots ] || mkdir -p $(xdg-user-dir PICTURES)/screenshots
  3. mx=$(xdotool getmouselocation | awk -F'[: ]' '{print $2}')
  4. my=$(xdotool getmouselocation | awk -F'[: ]' '{print $4}')
  5. xdpyinfo -ext XINERAMA | sed '/^ head #/!d;s///' | while IFS=' :x@,' read i w h x y; do
  6. if [[ $mx -ge $x && $mx -le $(($x + $w)) && $my -ge $y && $my -le $(($y + $h)) ]]; then
  7. import -window root -crop ${w}x$h+$x+$y "$(xdg-user-dir PICTURES)/screenshots/$(date +%F_%H%M%S_%N)-${i}.png"
  8. fi
  9. done