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.
sudo nano /etc/systemd/logind.confOption A: strict laptop suspend behavior
Section titled “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=suspendHandleLidSwitchExternalPower=suspendHandleLidSwitchDocked=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
Section titled “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=suspendHandleLidSwitchExternalPower=ignoreHandleLidSwitchDocked=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
Section titled “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-logindVerify active lid settings
Section titled “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 HandleLidFor the docked external-screen setup, the expected values are:
HandleLidSwitch=suspendHandleLidSwitchExternalPower=ignoreHandleLidSwitchDocked=ignoreCheck logind status
Section titled “Check logind status”Use these commands when lid behavior does not match the edited configuration.
systemctl status systemd-logind --no-pagerjournalctl -u systemd-logind -b --no-pager -n 100Debug related display state
Section titled “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
Section titled “File locations”- logind config: /etc/systemd/logind.conf
- systemd-logind service: systemd-logind.service
- i3 config is not responsible for lid behavior.