Skip to content

Instantly share code, notes, and snippets.

@gquittet
Last active December 22, 2024 17:11
Show Gist options
  • Save gquittet/c7b43a067943137fb05ba348eaf2c77e to your computer and use it in GitHub Desktop.
Save gquittet/c7b43a067943137fb05ba348eaf2c77e to your computer and use it in GitHub Desktop.

Disable lid suspend

  1. Create a file sudo vim /etc/systemd/logind.conf.d/00-laptop.conf
  2. Append this content in it
    [Login]
    HandleLidSwitch=ignore
    HandleLidSwitchExternalPower=ignore
    HandleLidSwitchDocked=ignore                         
  3. Restart the service: sudo systemctl restart systemd-logind

Or run these commands directly:

#!/usr/bin/env bash

mkdir -p /etc/systemd/logind.conf.d
cat <<< "[Login]
HandleLidSwitch=ignore
HandleLidSwitchExternalPower=ignore
HandleLidSwitchDocked=ignore
" > /etc/systemd/logind.conf.d/00-laptop.conf
systemctl restart systemd-logind.service
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment