用命令关闭Ubuntu的自动关闭屏幕和锁屏 您所在的位置:网站首页 app登录后自动退出屏幕怎么解决 用命令关闭Ubuntu的自动关闭屏幕和锁屏

用命令关闭Ubuntu的自动关闭屏幕和锁屏

2024-07-10 23:13| 来源: 网络整理| 查看: 265

有时候linux系统是没有图形化界面的,为了关闭锁屏和息屏可以用如下命令

关闭息屏,最后0是代表关闭锁屏,将0替换为60代表60s后自动息屏,以此类推。 gsettings set org.gnome.desktop.session idle-delay 0 关闭锁屏 gsettings set org.gnome.desktop.screensaver lock-enabled false

翻译取自这篇文章

If you want to wrap your app in a script that takes care of this for you when you launch it (or GUI simply isn't an option), the best command-line solution as of Ubuntu 14.04 is:

To disable the screen blackout:

gsettings set org.gnome.desktop.session idle-delay  (0 to disable)

To disable the screen lock:

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

You probably want to add their inverses at the end of the wrapper script to return your system to normal behavior on exit. In such a case, you want to prevent against ungraceful termination (i.e. interrupt, or SIGTERM during system shutdown), so create a function to restore normal behavior and use trap 0 (for bash-type shells) to catch exits and apply the restoration functions.



【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有