见链接:http://askubuntu.com/questions/177348/how-do-i-disable-the-screensaver-lock

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 <seconds> (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 <function> 0 (for bash-type shells) to catch exits and apply the restoration functions.

ubuntu设置关闭屏幕和锁定的更多相关文章

  1. 专心学LINUX:CentOS关闭屏幕自动锁定和睡眠

    在VMware中学习CentOS总免不了一直测试.调试,加上看书.刨坛,再转回到CentOS界面时已经被锁定了.看看怎么将这定时锁定取消以免麻烦.虽然可以使用字符终端,但字符终端不便于翻看前面已经发出 ...

  2. ubuntu设置开机默认进入字符界面方法 ubuntu 12.04 桌面版关闭图形界面(转)

    ubuntu 12.04 桌面版关闭图形界面 注意]改GRUB 的配置文件(不建议直接改 grub.conf) file:/etc/default/grub GRUB_CMDLINE_LINUX_DE ...

  3. VirtualBox中Ubuntu 14.04屏幕分辨率不能设置的问题

    VirtualBox中Ubuntu 14.04屏幕分辨率不能设置的问题   在VirtualBOx虚拟机中Ubuntu 14.04设置屏幕分辨率,怎么点都没反应. 方法一:安装与你的Ubuntu-Gu ...

  4. Ubuntu设置屏幕分辨率

    Ubuntu设置屏幕分辨率 原创 2016年10月14日 13:01:24 14900 在虚拟机装好Ubuntu,进入系统分辨率是800*600,打开显示界面设置下分辨率,设置完怎么也选不上应用,于是 ...

  5. ubuntu设置开机启动图形应用程序,替换默认图形桌面

    直接将启动程序放在rc.local即可.但是如果自动启动的程序奔溃后,会返回到ubuntu的unity桌面系统. 我遇到的问题是程序还有调用 xset 去定时关闭屏幕.在桌面启动后调用没问题.如果rc ...

  6. 键盘和鼠标闲置超时时关闭显示器并锁定电脑桌面的AutoHotkey脚本 2019年11月24日写

    /* 键盘和鼠标闲置超时时关闭显示器并锁定电脑桌面的AutoHotkey脚本 2019年11月24日写 在电脑桌面锁定时移动鼠标就会显示登录界面,此时即使超过电源设置的时间电脑也不会关闭显示器使得屏幕 ...

  7. Ubuntu设置程序开机自启或者开机禁止加载

    先说说ubuntu,它有运行级别这个概念 0:停机 1:单用户形式,只root进行维护 2:多用户,不能使用net file system 3:完全多用户 5:图形化 6:重启 例子:按指定顺序.在指 ...

  8. 【命令】Ubuntu设置和查看环境变量

    转自[Ubuntu]Ubuntu设置和查看环境变量 查看环境变量 env env命令是environment的缩写,用于列出所有的环境变量 export 单独使用export命令也可以像env列出所有 ...

  9. 【Ubuntu】Ubuntu设置和查看环境变量

    [Ubuntu]Ubuntu设置和查看环境变量    转载 https://blog.csdn.net/White_Idiot/article/details/78253004 1. 查看环境变量 查 ...

随机推荐

  1. 几种 HtmlEncode 的区别(转发)

    问题: HttpUtility.HtmlDecode ,HttpUtility.HtmlEncode  与  Server.HtmlDecode ,Server.HtmlEncode  与 HttpS ...

  2. 【PHP代码审计】 那些年我们一起挖掘SQL注入 - 6.全局防护Bypass之一些函数的错误使用

    0x01 背景 PHP程序员在开发过程中难免会使用一些字符替换函数(str_replace).反转义函数(stripslashes),但这些函数使用位置不当就会绕过全局的防护造成SQL注入漏洞. 0x ...

  3. Comparison method violates its general contract

    生产环境出现的错误排查,错误log如下 java.lang.IllegalArgumentException: Comparison method violates its general contr ...

  4. input的button和submit的区别

    故事由来: 其实这个问题,昨天已经遇到过,但是昨天是公司的一枚老员工帮助我这个实习生调的,而且我也确(猜)定(测)那枚老员工也不知道这个区别.然后今天又遇到相同问题. 故事梗概: 现在公司里面做一个项 ...

  5. 标签云 - jqcloud 用法

    html <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF- ...

  6. No saved view state could be found for the view identifier

    解决方法: javax.faces.application.ViewExpiredException:No saved view state could be found for the view i ...

  7. 【网络编程】之十二、wsaeventselect+线程池 服务器实现

    #include<WinSock2.h> #include<iostream> using namespace std; #pragma comment(lib, " ...

  8. hdu 3909 数独扩展

    思路:做法与9*9的一样.只不过是变量. #include<set> #include<map> #include<cmath> #include<queue ...

  9. 实战FFmpeg编译支持arm64(转)

    App store要求上架的app必须支持arm64.而手中的ffmpeg还不支持arm64, 百度下ffmpeg支持arm64方法,网上有很多资料.其中一篇是使用脚本自动编译实现的.本文就是使用它的 ...

  10. noip2015day1 T1 4510 神奇的幻方

    4510 神奇的幻方 noip2015day1 T1  时间限制: 1 s  空间限制: 128000 KB  题目等级 : 黄金 Gold 题解  查看运行结果     题目描述 Descripti ...