5 if [ .
"$1" = .
--region ]
9 if [ .
"$1" = .
--repeat ]
12 coords
=`cat ~/.config/xscreenshot/last-selected-region`
17 selection
=$
(xrectsel
-p)
19 [ $rc = 0 ] ||
exit $rc
21 coords
=$
(echo "$selection" |
sed -ne 1p
)
25 # select the whole window under the cursor if not a region was selected, just a point
26 if expr "$coords" : '^0x0[+-]' >/dev
/null
28 coords
=$
(echo "$selection" |
sed -ne 2p
)
31 # save coordinates for later use
32 mkdir
-p ~
/.config
/xscreenshot
33 echo "$coords" > ~
/.config
/xscreenshot
/last-selected-region
38 filepath
=~
/tmp
/screenshot_$
(date +%F_
%H
%M
%S
).jpg
39 # may remove 'xwdtopnm' if your imagemagick version supports "X-Window screen dump" format
40 xwd
-root | xwdtopnm | convert
- ${coords:+-crop "$coords"} "$filepath"
41 exec mimeopen-gui
"$filepath"