Gangmax Blog

Make Ubuntu Not Go in Suspend When Laptop Lid is Closed

From here.

After install Ubuntu 22.04, I found there’s not configuration item is available in “System Settings” to make Ubuntu not go in suspend when lid is closed. Here is the solution.

1. GUI

1
sudo apt install gnome-tweaks

Once installed, start the Tweaks application. In the General tab from the sidebar, toggle off the “Suspend when laptop lid is closed” button.

2. CLI

Open “/etc/systemd/logind.conf” and update it’s content:

1
2
3
4
5
6
7
8
9
10
11
12
13
# Find the following items, uncomment if necessary:
# HandleLidSwitch: When the laptop is on battery power
# HandleLidSwitchExternalPower: When the laptop is plugged into a power outlet
# HandleLidSwitchDocked: When the laptop is connected to a docking station
# And update the value to one of:
# lock: lock when lid is closed
# ignore: do nothing
# poweroff: shutdown
# hibernate: hibernate when lid is closed
# In my case, I use:
HandleLidSwitch=ignore
HandleLidSwitchExternalPower=ignore
HandleLidSwitchDocked=ignore

Comments