neXromancers / shotgun

Minimal X screenshot utility

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Focused transparent windows

ethanh92 opened this issue · comments

Is there a way to capture the background along with the window when capturing the focused window? I use transparency with my terminal, and whenever I capture a focused terminal window, the background is completely black. The command I'm using is: shotgun --id "$(xdotool getwindowfocus)". Same results if I use hacksaw to manually select a window with shotgun --id "$(hacksaw -f %i)".

shotgun grabs the window's pixmap directly, including the alpha channel. You have a few options to capture the background:

  • if your terminal supports fake transparency, you can try enabling it (not recommended)
  • composite your wallpaper into the resulting image with imagemagick or similar
  • capture the root window instead (using -g and omitting -i), note that the output will include any other window that may be in front of or behind your terminal

You can get the window geometry from xdotool with the following:

eval $(xdotool getwindowfocus getwindowgeometry --shell)
GEOMETRY="$WIDTHx$HEIGHT+$X+$Y"

I think there should be a FAQ for these kinds of things since this are edge cases but can be solved.

I was thinking of adding a contrib directory to the repo, so people could submit random scripts they make.

I think the question has been answered, and it's not a bug or feature request so I'm closing this.