Screenshot of focused window
I want to be able to do screen shots of the focused by pressing a button. Should be easy.
First try: scrot
(since it seems to be the most recomended tool for screenshots in i3wm)
Whole screen
bindsym XF86Display exec "scrot ~/Downloads/Screenshot%Y-%m-%d%H:%M:%S.png"
Works fine
Focussed Window
Well... Some people in the internet seem to think there is a -u flag for scrot but in the yum-installed Fedora version (0.8) there definitely is not. Bad luck.
Second try: ImageMagick
(since many people tell me it can do anything I want)
Whole screen
bindsym XF86Display exec "import -window root ~/Downloads/Screenshot$(date +%F%H:%M:%S).png"
The date is not as elegant as in scrot, works fine though.
Focussed window
Tricky. I don't know the id of the focused window. But there is a workaround:
import -window
xwininfo | awk '/.*Window id:.*/ {print $4}'
~/Downloads/Screenshot$(date +%F%H:%M:%S).png
I can click on the window I want to screenshot and there we go. A bit of a hack (found here: http: //www .trueelena.org/computers/howto/screenshotswithimagemagick.html ), but anyway. Works in the console. But in i3config:
bindsym XF86Display exec "import -window
xwininfo | awk '/.*Window id:.*/ {print $4}'
~/Downloads/Screenshot$(date +%F%H:%M:%S).png"
Doesn't work. I am asked to click on a window, but no screenshot is saved. I am not sure why.
Could someone give me a hand, please?