客户的 cairo 表面截图

client's cairo surfaces screenshots

我刚刚发现使用 client.content 属性 的屏幕截图的可能性。
所以为了测试这个功能,我把这段代码绑定到 XF86Reload 键:

awful.key({  },        "XF86Reload",     function()                                                                        
     local i = 0                                                                                                          
     for c in awful.client.iterate(function() return true end)                                                            
     do                                                                                                                   
        local f = c.name                                                                                                  
        gears.surface(c.content):write_to_png( "/home/david/" .. string.format('%02i',i) .."-" .. f  ..  ".png")          
        i=i+1                                                                                                             
     end                                                                                                                  
end)

不幸的是,有些图像令人困惑。开罗表面是否需要在屏幕上(即非最小化)才能正确拍摄? (似乎它有时也会发生在可见的 windows 上)或者可能是其他一些我看不到的原因......

Is the Cairo surface needs to be on the screen (ie non minimized) to be properly shot?

是(而且:可能不会被其他 windows 遮挡或不可见 space;您只能看到显示器上实际显示的内容。

另请注意,运行 Compton 或其他合成管理器使其更加可靠