在 Fedora 屏幕锁定上运行脚本
我正在寻找一种在 Fedora 15 (linux) 中锁定屏幕时运行程序的方法。基本上我想在屏幕锁定时开始运行运动检测程序,或者我手动按 Ctrl+Alt+L,但我不'不知道正在运行哪些命令或在哪里为我自己的中间步骤添加别名。我认为是:
gnome-screensaver-command --lock
但不知道如何解决这个问题。有人知道如何做,或者开始寻找的方向吗?
编辑,因为链接位于评论中: 这是通过 dbus-monitor 完成的,并在此处进行了描述。
I'm looking for a way to run a program when locking the screen in Fedora 15
(linux). Basically I want to start running a motion detection program when the screen locks, or I manually hit Ctrl+Alt+L, but I don't know what commands are being run or where to alias my own intermediate step in. I assume it's:
gnome-screensaver-command --lock
but am not sure how to go about this. Anybody know how, or a direction to start looking in?
Edit, since link was in a comment:
This is done with dbus-monitor
and described here.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
dbus
系统通告屏幕锁定;监视org.gnome.ScreenSaver
上的ActiveChanged
。 (请参阅 http://people.gnome.org/~mccann /gnome-screensaver/docs/gnome-screensaver.html )例如(为清楚起见,自动换行)
不幸的是,恐怕这需要编写更多的代码,而不仅仅是 shell 脚本;尽管我很好奇您是否可以要求 dbus 以某种方式调用您的程序作为该信号的处理程序;否则,我想你只需启动一个守护进程并监听要广播的信号......
The
dbus
system advertises screen locking; monitor forActiveChanged
onorg.gnome.ScreenSaver
. (see http://people.gnome.org/~mccann/gnome-screensaver/docs/gnome-screensaver.html )e.g. (word-wrapped for clarity)
Unfortunately, this will require writing more code than just a shell script, I'm afraid; although I'd be curious if you could ask
dbus
to call your program as a handler for that signal, somehow; otherwise, I suppose you'd just start a daemon process and listen for that signal to be broadcast…