如何运行黑屏使用命令?

如何运行黑屏使用命令?

我想制作一个脚本:

使用网络摄像头控制我的显示器。当我离开时自动运行屏幕保护程序。

但我不明白如何使用脚本或命令运行黑屏。

我想省点电。

答案1

您可以使用以下命令关闭屏幕:

xset dpms force off

解释来自man xset(仅为简短摘录):

NAME
       xset - user preference utility for X

OPTIONS
       dpms flags...
               The  dpms option allows the DPMS (Energy Star) parameters to be
               set.  The option can take up to three numerical values, or  the
               `force'  flag  followed  by  a  DPMS  state.  The `force' flags
               forces the server to immediately switch to the DPMS state spec‐
               ified.   The  DPMS  state  can  be one of `standby', `suspend',
               `off', or `on'.  When numerical values are given, they set  the
               inactivity  period (in units of seconds) before the three modes
               are activated.  The first value  given  is  for  the  `standby'
               mode,  the  second  is for the `suspend' mode, and the third is
               for the `off' mode.  Setting these  values  implicitly  enables
               the DPMS features.  A value of zero disables a particular mode.

相关内容