Skip to content

i3 Laptop Lid Behavior on Arch

Configure laptop lid behavior on Arch for an i3 setup. This workflow keeps lid behavior separate from the main i3 configuration because it is controlled by systemd-logind, not by i3 itself. It covers strict suspend behavior, docked external-display behavior, applying changes, and verifying the active configuration.

Understand where lid behavior is configured

Section titled “Understand where lid behavior is configured”

Lid behavior is controlled by systemd-logind, not by i3. The i3 window manager controls windows, workspaces, keybindings, and status bar behavior, while logind handles hardware events such as closing the laptop lid.

Terminal window
sudo nano /etc/systemd/logind.conf

Use this option when the laptop should suspend whenever the lid is closed, regardless of battery, external power, or docked state.

Terminal window
[Login]
HandleLidSwitch=suspend
HandleLidSwitchExternalPower=suspend
HandleLidSwitchDocked=suspend
  • HandleLidSwitch controls lid close behavior on battery.
  • HandleLidSwitchExternalPower controls lid close behavior while plugged in.
  • HandleLidSwitchDocked controls lid close behavior when systemd considers the machine docked.

Use this option when the laptop is often used with a single external screen and the lid may be closed while plugged in. The laptop still suspends on battery lid close, but ignores lid close while plugged in or docked.

Terminal window
[Login]
HandleLidSwitch=suspend
HandleLidSwitchExternalPower=ignore
HandleLidSwitchDocked=ignore
  • This is useful for an external-only i3 desk setup.
  • The laptop still suspends when the lid is closed on battery.
  • The laptop stays running when the lid is closed while plugged in or docked.

Restart systemd-logind after editing the file. Restarting logind can log out the current graphical session, so save work first.

Terminal window
sudo systemctl restart systemd-logind

Use systemd-analyze to see the final merged configuration that systemd is actually using.

Terminal window
systemd-analyze cat-config systemd/logind.conf | grep -i HandleLid

For the docked external-screen setup, the expected values are:

Terminal window
HandleLidSwitch=suspend
HandleLidSwitchExternalPower=ignore
HandleLidSwitchDocked=ignore

Use these commands when lid behavior does not match the edited configuration.

Terminal window
systemctl status systemd-logind --no-pager
journalctl -u systemd-logind -b --no-pager -n 100

When using external-only i3 display profiles, confirm the current xrandr state before testing lid behavior.

Terminal window
xrandr | grep " connected"
xrandr
  • If the external monitor is active and the laptop panel is off, Option B is usually the better lid behavior.
  • If the laptop panel is the only active display, Option A is usually safer.
  • logind config: /etc/systemd/logind.conf
  • systemd-logind service: systemd-logind.service
  • i3 config is not responsible for lid behavior.