-
I am using xproto.Getimage to try and capture the state of the screen. But when i do certain windows have no background and the desktop wallpaper is missing/completely transparent. I was unable to find a solution online so I wanted to ask here. the line of code in question: imgCookie := xproto.GetImage(Xconn, xproto.ImageFormatZPixmap, xproto.Drawable(screen.Root), x, y, width, height, 0xffffffff) |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
Are you on wayland or X11? Maybe wayland has an issue to give an potentially unsecure X11 app access to background and other wayland apps. Note: I found another way to capture screen using SHM in BurntSushi/xgb issues. It's low probability that it works better than standard xproto.GetImage, but maybe it's worth a try. |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
I have found the solution in bgra2rgba function i now set the alpha layer to max (255), this might be a bug or might just be x11 i don't know, but it took me a while since i was setting transparency to max in the actual GetImage function. updated function: func bgra2rgba(data []byte) {
for i := 0; i < len(data); i += 4 {
data[i], data[i+2] = data[i+2], data[i]
data[i+3] = 255
}
} Hope this helps someone! |
Beta Was this translation helpful? Give feedback.
I have found the solution in bgra2rgba function i now set the alpha layer to max (255), this might be a bug or might just be x11 i don't know, but it took me a while since i was setting transparency to max in the actual GetImage function.
updated function:
Hope this helps someone!