如何在 Xorg 中获取正在运行的窗口的快照图像?

发布于 2024-12-13 10:25:17 字数 107 浏览 6 评论 0原文

我想将 Compiz 的 Window Picker 功能迁移到 XFCE 环境,因此我需要抓取当前显示器中运行的窗口的图像,并使用 GtkWidget 显示它,但是如何呢?

I wanted to migrate Compiz's Window Picker function to XFCE environment , so i needed to grab an image of the window running in current display , and display it with an GtkWidget , but how ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

回首观望 2024-12-20 10:25:17

如果您不介意依赖外部工具,可以通过调用 ImageMagick 的 import -window 0xid bmp- 来获取图像。读取管道的输出并创建适当的 GTK 对象。

当然,您需要替换要从中获取图像的窗口 ID。这是 一篇文章,可帮助您获取窗口 ID来自进程 ID

If you don't mind relying on an external tool, you can acquire the image by invoking ImageMagick's import -window 0xid bmp-. Read the output from a pipe and create the appropriate GTK object.

Of course, you will to replace the window ID you want to get the image from. Here is a post that will help you get the window ID from a a Process ID.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文