Disabling Laptop Screen with Ubuntu Server

As a part of my home network setup, I use an old Dell Studio XPS 15″ laptop as my “server.” It’s currently running Ubuntu 19.10. One issue I had during the last update was that whatever I set up a long time ago to manage the lid switch policy was lost, so I had to re-google it and re-do it, because I don’t want the screen to be on 24/7.

Some Googling led me to a post that got me part of the way there:

I had to adjust a few things for my setup, and for posterity I’m going to log them here for the future.

# As root, or sudo'd
apt install vbetool -y
echo 'event=button/lid.*' | tee --append /etc/acpi/events/lm_lid
echo 'action=/etc/acpi/lid.sh' | tee --append /etc/acpi/events/lm_lid
touch /etc/acpi/lid.sh
chmod +x /etc/acpi/lid.shCode language: PHP (php)

This will set everything up for the lid.sh script to run:

#!/bin/bash
# Close
grep -q close /proc/acpi/button/lid/*/state
if [ $? = 0 ]; then
	sleep 1 && vbetool dpms off
fi
# Open
grep -q open /proc/acpi/button/lid/*/state
if [ $? = 0 ]; then
	sleep 1 && vbetool dpms on
fiCode language: HTML, XML (xml)

Finally, reboot and enjoy not having to worry about the screen dying.

Other Posts Not Worth Reading

Hey, You!

Like this kind of garbage? Subscribe for more! I post like once a month or so, unless I found something interesting to write about.


Comments

Leave a Reply