1

CentOS で gnome を使用しています。私が達成したいのは、指定された時間帯、たとえば 23:00 ~ 7:00 の間、コンピューターを完全にロックすることです。

試み

  1. Python + Qt アプリを作成しようとしましたが、別のセッションに切り替えて強制終了することで簡単に回避できます。
  2. やりたいことに似た「タイピングブレイク」というアプリがあるのですが、Aの時点で有効にしてBの時点で無効にする方法がありません。

何か案が?

4

1 に答える 1

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
于 2013-04-24T15:09:54.093 に答える