“不活动时关闭屏幕”-从终端设置

“不活动时关闭屏幕”-从终端设置

我想从终端将“不活动 x 分钟时关闭屏幕”设置(在亮度设置中)设置为“从不”,但我找不到正确的命令。

这将在可执行文件中用于更改 Ubuntu 实时安装中的某些设置。

编辑:

由于更多复杂的原因,我想更改这个独立于屏幕保护程序设置的特定设置(我认为)。

答案1

gsettings set org.gnome.desktop.session idle-delay 0

将阻止您的屏幕锁定并将该设置更改为永不。

注意:关闭/重新打开设置窗口才能看到该命令的效果。

您在此处写入的值是 Unity 决定您未执行任何操作且应锁定屏幕所需的时间(以秒为单位)。

答案2

我认为你可以使用这个命令:

xset s off

来自xset手册页man xset

s       The  s  option  lets you set the screen saver parameters.  This
       option   accepts   up   to   two   numerical   parameters,    a
       'blank/noblank'  flag,  an  'expose/noexpose' flag, an 'on/off'
       flag, an 'activate/reset' flag, or the 'default' flag.   If  no
       parameters  or  the  'default' flag is used, the system will be
       set to its default screen saver characteristics.  The  'on/off'
       flags  simply  turn  the screen saver functions on or off.  The
       'activate' flag forces activation of screen saver even  if  the
       screen  saver  had  been  turned  off.  The 'reset' flag forces
       deactivation of screen saver if it is active.  The 'blank' flag
       sets  the preference to blank the video (if the hardware can do
       so) rather than display a background pattern,  while  'noblank'
       sets  the preference to display a pattern rather than blank the
       video.  The 'expose' flag sets the preference to  allow  window
       exposures  (the  server  can  freely  discard window contents),
       while 'noexpose' sets the preference to  disable  screen  saver
       unless  the  server  can regenerate the screens without causing
       exposure events.  The length  and  period  parameters  for  the
       screen  saver  function  determines how long the server must be
       inactive for screen saving  to  activate,  and  the  period  to
       change  the background pattern to avoid burn in.  The arguments
       are specified in seconds.  If only one numerical  parameter  is
       given, it will be used for the length.

对于 Gnome 和 Unity 桌面,在关闭一段时间后关闭锁定屏幕:

gsettings set org.gnome.desktop.screensaver lock-enabled  false

重新打开它:

gsettings set org.gnome.desktop.screensaver lock-enabled true

您还可以设置x屏幕空白后锁定的分钟数,但必须以秒为单位输入(乘以 60)

gsettings set org.gnome.desktop.screensaver lock-delay "x"

示例值为3005 分钟 - 您可以在以下 bash 行中输入分钟数:

gsettings set org.gnome.desktop.screensaver lock-delay $(echo X*60 | bc)

分钟数在哪里X- 似乎在 Ubuntu 13.10 中有效。

哦,要禁用屏幕变暗:

gsettings set org.gnome.settings-daemon.plugins.power idle-dim false

答案3

尝试一下,至少对我有用:

xset +dpms
xset dpms 300

300 是 5 分钟,因此,如果 5 分钟不活动,它就会关闭。

相关内容