2012-10-22 38 views
1

我在CentOS中使用gnome。我想要达到的目标是在指定的时间范围内完全锁定电脑,比如23:00〜7:00。在特定的时间段内锁定gnome屏幕而无法解锁它

尝试

  1. 我试图创建的Python + Qt的应用程序,但它可以通过切换到另一个会议,并杀死它很容易合作周围。
  2. 有一个名为“键入中断”应用程序,它类似于我想要做的,但没有办法,使其能够在时间点A和时间点B.

任何想法禁用?

回答

0

您可以gnome-screensaver-command

$ gnome-screensaver-command --help 
Usage: 
    gnome-screensaver-command [OPTION…] 

Help Options: 
    -h, --help   Show help options 

Application Options: 
    --exit    Causes the screensaver to exit gracefully 
    -q, --query   Query the state of the screensaver 
    -t, --time   Query the length of time the screensaver has been active 
    -l, --lock   Tells the running screensaver process to lock the screen immediately 
    -a, --activate  Turn the screensaver on (blank the screen) 
    -d, --deactivate  If the screensaver is active then deactivate it (un-blank the screen) 
    -V, --version  Version of this application 

在你的情况下控制屏保,一个cronjob可能就足够了。即

0 23 * * * DISPLAY=:0 gnome-screensaver-command --lock 
0 7 * * * DISPLAY=:0 gnome-screensaver-command --deactivate