How to take a screenshot of a window that is not visible in batch mode?
What have I tried so far:
- import from imagemagick reports an error for both window id and window name - scrot doesn't accept a window id as argument - maim and xwd don't take the screenshot if the window is not visible (it's on another workspace, not the active one, i'm using vanilla dwm) Note: I take window id and name from the output of wmctrl -l |
Maybe make window sticky, then unstick it with wmctrl?
Not tested (wmctrl not installed here) Code:
wmctrl -i -r <window id> -b add,sticky |
I can get this to work with my dual monitor setup with separate screens on Monitor0 and Monitor1.
From a terminal on Monitor1, I can capture an image from a window displayed on Monitor0 with Code:
import -display ':0.0' -window 0x1600059 ~/Desktop/wsnapshot.png Quote:
|
Quote:
|
Quote:
Quote:
|
You can't take a screenshot of a window that does not exist.
If the window is not visible then there is no window. Maybe you should explain further what you are wanting. To capture the output form a running program/process? Screenshot is just that, a picture of something that is on the screen. Maybe you are wanting something else. I'm trying to figure out what you are doing. A shot of a minimized window? Or do you have a dual monitor setup with one monitor unplugged? Why isn't the window visible? Or a window that is behind another window? What? |
Quote:
|
If you are wanting to capture a window on another work space, then give yourself a pause so you can make it active.
Code:
sleep 5 && scrot -u https://askubuntu.com/questions/3030...nactive-window https://unix.stackexchange.com/quest...tive-workspace |
Quote:
|
Quote:
|
Quote:
I can't do anything else, because I need to take lots of screens for hours. That's why I want to run that window in the background (another workspace) and I need a way to take screenshots of it. Quote:
|
Quote:
|
Quote:
|
Technically changing window state to sticky does not move it. On the contrary, it's a flag that tells to window manager to let the window stay in place (stick on screen) while other element can move (viewports...)
Maybe dwm doesn't support this feature though (I never used it) |
This is the command that I use to take window snapshots.
Code:
import -window $(xwininfo | awk --non-decimal-data '/Window id/{printf "%d", $4}') ~/Desktop/wsnapshot.png I actually usually use it from a script behind a right click menu entry. PS - The conversion of the window id from hex to decimal does not appear to be necessary for 'import' any more. |
All times are GMT -5. The time now is 10:15 AM. |