Skip to content

Instantly share code, notes, and snippets.

@levihuayuzhang
Last active April 22, 2025 08:17
Show Gist options
  • Save levihuayuzhang/e1f9524e98efba4ddfeaa2de2c80918b to your computer and use it in GitHub Desktop.
Save levihuayuzhang/e1f9524e98efba4ddfeaa2de2c80918b to your computer and use it in GitHub Desktop.
Auto close screen without DE (in TTY)
  1. set in grub config (blank in 60 seconds)
GRUB_CMDLINE_LINUX_DEFAULT="consoleblank=60"
  1. setterm -blank X (X in minutes) in shell init file (.bashrc) or /etc/rc.local.

Then, prevent sleep when lid close: sudoedit /etc/systemd/logind.conf:

HandleLidSwitch=ignore

After that, sudo systemctl restart systemd-logind.

Ref:

  1. https://superuser.com/questions/152347/change-linux-console-screen-blanking-behavior
  2. https://unix.stackexchange.com/questions/290712/how-to-power-down-display-on-terminal
  3. https://wiki.archlinux.org/title/Kernel_parameters
  4. https://wiki.archlinux.org/title/Display_Power_Management_Signaling
  5. https://askubuntu.com/questions/15520/how-can-i-tell-ubuntu-to-do-nothing-when-i-close-my-laptop-lid
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment