Ctrl K

i3 Laptop Lid Behavior on Arch

Configure systemd-logind lid behavior for laptop, plugged-in, docked, and external-display i3 workflows.

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

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.

sudo nano /etc/systemd/logind.conf

Option A: strict laptop suspend behavior

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

[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.

Option B: docked external-screen behavior

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.

[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.

Apply the change

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

sudo systemctl restart systemd-logind

Verify active lid settings

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

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

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

HandleLidSwitch=suspend
HandleLidSwitchExternalPower=ignore
HandleLidSwitchDocked=ignore

Check logind status

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

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

Debug related display state

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

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.

File locations

  • logind config: /etc/systemd/logind.conf
  • systemd-logind service: systemd-logind.service
  • i3 config is not responsible for lid behavior.