解锁时运行脚本?
嘿,我想在每次解锁计算机时运行一个 shell 脚本,在 KDE 4 上。我了解到我可以通过用 shell 脚本执行其操作来覆盖 /usr/lib/kde4/libexec/krunner_lock 来运行它,然后是原始的 krunner_lock 二进制文件,我基本上想做相反的事情:启动一个脚本来“撤消”锁定脚本的操作。 我使用的是 Kubuntu 9.04 64 位,但我很欣赏任何操作系统的答案,以防我想在该系统上做同样的事情。
Hey, I'd like to get a shell script to run everytime I unlock my computer, on KDE 4. I learned that I could run one by overwriting /usr/lib/kde4/libexec/krunner_lock with a shell script doing its thing, then the original krunner_lock binary, and I'd basically want to do the opposite: launch a script that "undoes" what the locking script does.
I'm on Kubuntu 9.04 64-bit but I appreciate answers for any operating system, in case I ever want to do the same on that system.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
在 这里的 KDE 论坛上找到了答案 。 波吉斯的解决方案非常接近答案,但还没有完全实现。 您必须将脚本接收到的参数传递给真正的 krunner_lock,如下所示:
krunner_lock_bin $@
Figured it out on the KDE forums here. Porges's solution is pretty close to the answer but it's not quite there yet. You have to pass the arguments that the script receives to the real krunner_lock, like so:
krunner_lock_bin $@
从此页面读取,似乎
krunner_lock
将保持运行状态只要屏幕锁定,因此您应该能够将命令放在运行它的行之后,并且一旦屏幕解锁,它们就会运行。例如
Reading from this page, it seems like
krunner_lock
will stay running as long as the screen is locked, so you should be able to place the commands after the line that runs it and they will run once the screen unlocks.e.g.
2015 年版本,在 Kubuntu 14.10 下使用桌面小部件储物柜运行:
适用于您想要在全局键盘快捷键的自定义部分下分配 CTRL+ATL+L 组合的情况。
Version for year 2015 that works under Kubuntu 14.10 using the Desktop Widgets locker:
This is for situation when you want to assign CTRL+ATL+L combination under the Custom section within the Global Keyboard Shortcuts.