ubuntu笔记本合盖不休眠
时间: 2024-12-08 13:24:47 浏览: 286
Ubuntu笔记本默认设置下,当您关闭笔记本电脑的盖子时,系统可能会进入睡眠状态而不是完全关机,这是为了节省电力并保持待机功能。如果您希望在合上盖子时不进入休眠状态,可以按照以下步骤操作:
1. 打开终端:点击左上角的 Dash 搜索栏输入 "Terminal" 或者搜索图标,然后找到终端应用。
2. 找到 `sudoedit /etc/sleep.d/99-suspend-on-lid-close` 文件。这个文件控制了盖子合上时的行为。
3. 使用文本编辑器打开文件,如 `sudo nano /etc/sleep.d/99-suspend-on-lid-close`。如果文件不存在,您需要创建它。
4. 找到类似这样的行:
```
# If lid is closed and no input detected for $lid_seconds seconds,
# suspend or hibernate.
if [ "$SUSPEND_ON_LID_CLOSE" = true ] && [[ $(xdotool getevent --state) =~ ("KEY\[.*\]"|"BTN\[.*\]") ]]; then
suspend
fi
```
5. 将 `suspend` 改成 `do_nothing` 或注释掉这一行,让其不再响应盖子关闭事件。例如:
```
# If lid is closed and no input detected for $lid_seconds seconds,
# do nothing (or comment out this line to disable the behavior altogether).
# if [ "$SUSPEND_ON_LID_CLOSE" = true ] && [[ $(xdotool getevent --state) =~ ("KEY\[.*\]"|"BTN\[.*\]") ]]; then
# do_nothing
# fi
```
6. 保存并退出编辑器。按 `Ctrl+X`,然后按 `Y` 确认保存,再按 `Enter` 退出。
7. 重启计算机以使更改生效。
现在您的Ubuntu笔记本合盖应该不会自动休眠了。若想进一步了解或定制其他选项,您可以查阅 Ubuntu 的官方文档或者使用命令 `man power-management`。
阅读全文
相关推荐











