2012-10-22 81 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