如何心跳X11屏保?
X11有屏保机制,可以通过xset
命令控制。无需从 X11 应用程序内部调用外部命令来禁用或检测屏幕保护程序,如何对屏幕保护程序机制进行检测以防止其关闭显示器?
X11 has a screensaver mechanism that can be controlled by xset
command. Without having to invoke the external command to disable or heartbeat the screensaver, from inside my X11 application, how can I heartbeat the screensaver mechanism so to prevent it from shutting down the monitor?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果在现代 Linux 系统上,首选 FreeDesktop 方法是 ping DBus 接口,特别是 org.freedesktop.ScreenSaver.SimulateUserActivity() 或公开接口的其他部分,具体取决于您的需要。
If this on a modern Linux system, the preferred FreeDesktop method is to ping the DBus interface, specifically
org.freedesktop.ScreenSaver.SimulateUserActivity()
or another part of the exposed interface, depending on your needs.以及@Kitsune 建议的 D-Bus 解决方案。您还可以采用某些媒体播放器的方法,定期模拟按下某个键(例如 Alt)。
图腾中的代码: http://git.gnome.org/ browser/totem/tree/lib/totem-scrsaver.c 旨在放入您的代码库(LGPL v2.1)中,并且将使用 D-Bus 接口并使用
XTest
合成每 30 秒按一次 Alt 键。As well as the D-Bus solution suggested by @Kitsune. You can also take the approach that some media players do and simulate the pressing of a key (e.g. Alt) at regular intervals.
This code in totem: http://git.gnome.org/browse/totem/tree/lib/totem-scrsaver.c is designed to be dropped into your code base (it's LGPL v2.1) and will use both the D-Bus interface and also use
XTest
to synthesize pressing the Alt key every 30s.