在 Fedora 屏幕锁定上运行脚本

发布于 2024-12-21 17:16:00 字数 554 浏览 1 评论 0原文

我正在寻找一种在 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 技术交流群。

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

发布评论

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

评论(1

旧伤还要旧人安 2024-12-28 17:16:00

dbus 系统通告屏幕锁定;监视 org.gnome.ScreenSaver 上的 ActiveChanged。 (请参阅 http://people.gnome.org/~mccann /gnome-screensaver/docs/gnome-screensaver.html

例如(为清楚起见,自动换行)

    signal sender=:1.68 -> dest=(null destination) 
           serial=53 path=/org/gnome/ScreenSaver; 
           interface=org.gnome.ScreenSaver; member=ActiveChanged
        boolean true

不幸的是,恐怕这需要编写更多的代码,而不仅仅是 shell 脚本;尽管我很好奇您是否可以要求 dbus 以某种方式调用您的程序作为该信号的处理程序;否则,我想你只需启动一个守护进程并监听要广播的信号......

The dbus system advertises screen locking; monitor for ActiveChanged on org.gnome.ScreenSaver. (see http://people.gnome.org/~mccann/gnome-screensaver/docs/gnome-screensaver.html )

e.g. (word-wrapped for clarity)

    signal sender=:1.68 -> dest=(null destination) 
           serial=53 path=/org/gnome/ScreenSaver; 
           interface=org.gnome.ScreenSaver; member=ActiveChanged
        boolean true

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…

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