Working on making an ultra lean Linux machine and can’t bear the idea of
installing scrot
or another program for taking screenshots? Fear not!
You probably already have x11-utils
installed, so you can do this:
xwininfo
and click the window you want to take a screenshot of. This will give you the window ID. Commit this hex value to memory.import -window that_last_hex_value /tmp/screenshot.png
Or more simply, as a function:
function screenshot {
id=$(xwininfo | fgrep 'Window id' | awk '{print $4}')
import -window "$id" "$1"
}
screenshot /tmp/screenshot.png