Take a screenshot using `import` from ImageMagick:

   $ import screenshot.png                      <--- Click on the
   window to screenshot
   $ import -window 0x121f2ef screenshot.png    <--- Specify the window
   $ import -window root screenshot.png         <--- The lot

What's the current X window ID?

   $ xprop -root _NET_ACTIVE_WINDOW
   _NET_ACTIVE_WINDOW(WINDOW): window id # 0x121f2ef

   $ xprop -root _NET_ACTIVE_WINDOW | cut -d' ' -f5
   0x121f2ef

Glue it all together:

   import -window $(xprop -root _NET_ACTIVE_WINDOW | cut -d' ' -f5)
   ~/screenshot_$(/bin/date +%Y%m%dT%H%M%S).png

I use the i3 window manager, so I've loaded it up into a key-binding:

   bindsym Print exec import -window $(xprop -root _NET_ACTIVE_WINDOW |
   cut -d' ' -f5) ~/screenshot_$(/bin/date +%Y%m%dT%H%M%S).png

Gnome screenshot can be used to achieve the same outcome (a lot more simply). It drops the result into your home directory by default:

   $ gnome-screenshot
   $ gnome-screenshot --window
   $ gnome-screenshot --window --delay 2
   $ gnome-screenshot --interactive

Just for fun.
Douglas.
_______________________________________________
Linux-users mailing list
[email protected]
http://lists.canterbury.ac.nz/mailman/listinfo/linux-users

Reply via email to