sudo nano /etc/systemd/logind.conf
, change these values to ignore
:
HandleLidSwitch=ignore
HandleLidSwitchExternalPower=ignore
HandleLidSwitchDocked=ignore
Restart service: sudo systemctl restart systemd-logind
sudo nano /etc/default/grub
, add consoleblank=<seconds>
to GRUB_CMDLINE_LINUX_DEFAULT
. Example:
GRUB_CMDLINE_LINUX_DEFAULT="quiet consoleblank=180"
sudo update-grub
and reboot.
Call a script that turns the screen off when the lid is being closed.
sudo pacman -S acpid # or sudo apt install acpid
sudo systemctl start acpid
sudo systemctl enable acpid
sudo nano /etc/acpi/events/lid-close # any file name as long as it's in this directory
/etc/acpi/events/lid-close
:
event=button/lid
action=/usr/local/bin/lid-close.sh # anywhere you want
/usr/local/bin/lid-close.sh
:
#! /usr/bin/env bash
xset dpms force off
Make the script executable, then restart the service:
sudo chmod +x /usr/local/bin/lid-close.sh
sudo systemctl restart acpid
echo 15 | sudo tee /sys/class/backlight/*/brightness >/dev/null
Brightness range: zero to /sys/class/backlight/*/max_brightness
.