How do I capture a screen with xwd?
I need to capture a window with xwd:
$ xwd -out /home/me/dump I run it, I get a crosshair pointer, click on the target window and the screenshot is dumped. I can view it with xwud. Now, I need to do that non-interactively. $ xprop WM_NAME I get a crosshair pointer, click on the target window and the output tells me: WM_NAME(STRING) = "Name of application" So I run: $ xwd -name "Name of application" -out /home/me/dump Then I try to view it with xwud and the result is a completely black screen. There seems to be a thin gray frame around it. What am I doing wrong? |
I'd try to do the same with xwininfo and window id:
Code:
$ xwininfo||grep -Po 'Window id: \K\w+' |
Quote:
|
What are you trying to achieve?
You can make screenshot of the entire screen with Code:
xwd -root > screenshot Code:
id=$(xprop -root _NET_ACTIVE_WINDOW | cut -d ' ' -f5) Code:
WM_NAME(STRING) = "LinuxQuestions.org - Reply to Topic - Mozilla Firefox" Code:
WM_NAME(STRING) = "xterm" PS: I tested above commands on FVWM2. If your desktop reliably displays the application name in the windows title bar then you could reliably identify a window by its application name. However, if there are multiple instances open then it would still be ambiguous. |
Quote:
The -root option would work fine for me if I could specify a virtual desktop. In fact, I keep the application running in virtual desktop 2 while I do something else in virtual desktop 1. Quote:
sleep 2; id=$(xprop -root _NET_ACTIVE_WINDOW | cut -d ' ' -f5) (alt+tabbed to the desired application) xwd -id $id > screenshot And I got a completely black screen again. :( Quote:
I've tried other applications too. I always end up with a black screen. I searched a little more and found this command: $ xwininfo -id $id | grep 'Map State' The window I want is in virtual desktop 2 and it returns Map State: IsUnMapped However, I tried using the id of another application that is running in virtual desktop 1: Map State: IsViewable But when I screenshot that application with xwd, I get a black screen too! I am stumped. |
Quote:
You could try a different screenshooter, but: Quote:
This is a continuation of this thread. It's a horrible approach to a problem I'm sure can be solved better. But OP refuses to identify that problem and keeps clinging to their cludge. |
Quote:
|
Quote:
Quote:
|
you can have a screenshot from the visible desktop (or area). The "other" virtual desktops are simply not available. X only draws what is displayed, but does not care/process anything outside (as long as they are hidden).
|
Quote:
@OP: The fact that the other application is running in a different desktop is quite crucial. As has been pointed out, you can only take a screenshot of the current desktop. For possible workarounds I found this thread. I have not tried the suggestions there since I never had any need to take "Off-screen" screenshots. My first idea, however, was also to start the application on another virtual display, possibly with vncserver. Screen scraping should not be the first tool of choice to solve a problem. However, if you refuse to share what you are actually trying to achieve then you will probably keep getting only vague ideas of what a solution might look like. |
Quote:
Quote:
- an application is running; - it displays notifications; I need to act upon them as soon as possible but they don't occur very often, not even every day; - it is running in another virtual workspace; it would be inconvenient to run it into the same workspace I use regularly; - I need to capture screenshots of that application programatically, non-interactively, and detect changes; that is VERY CLEAR; - even in my main/active workspace, I can't capture windows. |
there should be a better way to communicate with that "another" application. Probably a log file or other thing which can be processed too.
Again, actually there is nothing to capture, so you need to find a different way. |
Quote:
You later stated that it is running in a different Desktop. At this point your goal kind of became a "moving target". By the way, here is some output that I get for Firefox: Code:
$ xwininfo -root -tree |grep -i firefox Code:
$ xprop -id 0x1a00003 _NET_WM_PID If only you were willing to provide the application name so we could look for something that might be unique ... |
The application is proprietary and meant for internal use, provided by an employer for a very specific task. You will not find it on the Internet and I am not at liberty to disclose a lot about it. I would pounce at the opportunity to detect the notifications in an easier way if there was any. Capturing its screen every so often is my only chance.
Note that bringing it to my current virtual workspace from the secondary one does not help. Even with other common/popular applications. That is reported above in the thread. |
Quote:
By the way I would still try to use a log file or some other way. |
All times are GMT -5. The time now is 06:33 AM. |