见链接: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. qregularexpression和qregexp的区别

    QRegularExpression 是Qt 5.0才引进的,相对于QRegExp,QRegularExpression class修复了很多bug,提高了效率,提供了对Perl的RegEx几乎全面兼 ...

  2. Mybank

    using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.T ...

  3. Triangular Sums

    描述 The nth Triangular number, T(n) = 1 + … + n, is the sum of the first n integers. It is the number ...

  4. 1.6.3 Uploading Data with Solr Cell using Apache Tika

    1. Uploading Data with Solr Cell using Apache Tika solr使用Apache Tika工程的代码提供了一个框架,用于合并所有不同格式的文件解析器为so ...

  5. cocos2dx3.0-tinyxml在Android环境下解析xml失败的问题

    本文由@呆代待殆原创,转载请注明出处. 正常情况下,我们在用tinyxml读取xml文件的的时候,会像下面这样写. std::string filePath = FileUtils::getInsta ...

  6. IOS 给图片添加水印(文字)

    有时候上传图片要加唯一标识,简单的就是添加一个水印.这里水印我们讲文字,可以是当前系统时间.坐标.地理位置等 原理就是把一个字符串写到图片上,并且字(font)的大小由图片大小控制. 以下是封装好的一 ...

  7. iOS - UI - UIPageControl

    1.UIPageControl 分页控件 //分页控件初始化 UIPageControl * pageControl = [[UIPageControl alloc] init]; //分页页数 pa ...

  8. 各种"居中"

    先看效果 代码: <!DOCTYPE html> <html> <head> <meta charset="utf-8"/> < ...

  9. 剑指Offer19 包含min函数的栈

    /************************************************************************* > File Name: 19_MinInS ...

  10. 3D--知识点1

    三层架构 1.DAL(数据访问层)-->与数据库进行关联,对数据库进行增删改查操作2.BLL(业务逻辑层)-->负责加减乘除与或非操作,比如:用户注册3.UI/web(表示层) sqlse ...