我试着写一个这样的建议的脚本:
我创建了一个目录和一个新的脚本文件:
mkdir /etc/acpi/local
gksudo gedit /etc/acpi/local/lid.sh.post
Run Code Online (Sandbox Code Playgroud)
/etc/acpi/local/lid.sh.post包含以下代码的文件:
#!/bin/sh
#########################################################################
## Script written by Ruben Barkow ##
## https://gist.githubusercontent.com/rubo77/1a3320fda5a47fdebde7/raw/87cde3f0554467a132aba3cda7ad3c5e7187571f/lid.sh.post
## Description: This script reacts if laptop lid is opened or ##
## closed in Ubuntu 11.10 (Oneiric Ocelot). ##
## ##
## This script can be freely redistributed, modified and used. ##
## Any redistribution must include the information of authors. ##
## ##
## THIS SCRIPT HAS NO WARRANTY! ##
#########################################################################
grep -q close /proc/acpi/button/lid/*/state
if [ …Run Code Online (Sandbox Code Playgroud) 现在我有两个脚本,我想在关闭笔记本电脑的唇缘并打开它时分别执行它们。我怎样才能做到这一点?
我在虚拟机中使用 ubuntu,所以,我不时让它闲置。当我回去时显然屏幕被锁定,但我想将空闲时间配置为大约 10 分钟。我在哪里可以这样做?
好的,我知道已经有几个与此相关的问题。我尝试了很多解决方案都无济于事。我将在这里详细说明我做了什么以及我的配置文件如何,希望好心人能指出我遗漏了什么。
一些初步信息:
pm-hibernate 工作正常。1.
我有一个 Mint(如果我没记错的话是 14 个),在我添加一些脚本之前,关闭盖子不会休眠。在 Ubuntu 14 中/etc/acpi/lid.sh,我无法像在 Mint 中那样进行编辑。我试图用以下内容创建一个:
echo 'ok' > ok
grep -q closed /proc/acpi/button/lid/*/state
if [ $? = 0 ]
then
su - gabriel -c 'dconf read /org/gnome/settings-daemon/plugins/power/lid-close-ac-action' | grep hibernate
if [ $? = 0 ]
then
pm-hibernate
fi
fi
Run Code Online (Sandbox Code Playgroud)
ok当我合上盖子时不会创建该文件,这意味着该脚本从未被调用。
我试图将lid.sh 移动到events/.
作为建议在这里 …