First off you may use xwininfo to get information on your application window. You run it in a terminal and then choose the window you want info on. The most important information it provides is the Window id:
- Code: Select all
[CronoCloud@mideel ~]$ xwininfo
xwininfo: Please select the window about which you
would like information by clicking the
mouse in that window.
xwininfo: Window id: 0x8002f6 "Yellow Dog Linux • Post a new topic - Mozilla Firefox"
Absolute upper-left X: 0
Absolute upper-left Y: 14
Relative upper-left X: 0
Relative upper-left Y: 15
Width: 1280
Height: 751
Depth: 24
Visual Class: TrueColor
Border width: 0
Class: InputOutput
Colormap: 0x20 (installed)
Bit Gravity State: NorthWestGravity
Window Gravity State: NorthWestGravity
Backing Store State: NotUseful
Save Under State: no
Map State: IsViewable
Override Redirect State: no
Corners: +0+14 -0+14 -0-3 +0-3
-geometry 1280x751+-1+-2
Once you have the window id you can use import from the Imagemagick suite to take the screenshot:
import -window window_id screenshot.jpg
If you want the window decorations you would add -frame to that.
import -window window_id -frame screenshot.jpg (or screenshot.png)
That will capture the shot immediately, but what if you wanted to wait until you had a specific menu or file open? Then you could put a simple sleep command in front to give you time to do that before the screenshot is taken:
sleep number_of_seconds_to_wait; import -window window_id -frame screenshot.jpg
For example if I wanted to capter a shot of the Firefox 3 window after 10 seconds I would do this:
sleep 10; import -window 0x8002f6 -frame screenshot.jpg
Ron Rogers Jr (CronoCloud)