If I’m closing the lid then the system come in standby vice versa with the open lid the monitor remain always on. I choose Ubuntu 18.04.4 LTS as system OS without X Server on my old laptop, so why do I need to have the lid open? and why do I need to have the tty screen always on? Below a fast guide to configure those stuff
Change Lid Close Action
In Ubuntu 18.04 Gnome desktop, there’s no option for that, so we need to work on /etc/systemd/logind.conf
and need to change the parameters on HandleLidSwitch
and HandleLidSwitchDocked
This parameter manage the Lid actions and it can accept a couple of values, for my scope I what just to “ignore” the action so I just edit file in those 2 parameters with the below value:
[...] HandleLidSwitch=ignore HandleLidSwitchDocked=ignore [...]
For a full and better compression of what this file does I suggest you read the man page of it with the command man logind.conf
( remeber it’s the unique and official documentation!)
Disable screen on lid close
Here I haven’t found a real scripts, so I made one from myself. The idea is to check the lid state and every time someone change this state just run a script that enable or disable the tty monitor.
In order to disable the monitor I’m using the command /usr/sbin/vbetool dpms off
and viceversa in order to enable it the command /usr/sbin/vbetool dpms on
In order to read the state of Lid is possible to use the state present on /proc
, so in order to see the current state of lid jut type cat /proc/acpi/button/lid/*/state
and the result will be very clear!
odyno@ade:~$ cat /proc/acpi/button/lid/*/state
state: closed
Now we need to have a trigger of action open or action close of lid: the answer of this question is the events management performed by acpi on /etc/acpi/events
scripts.
Well done now we have all, so as recap of all: create a new event on acpi that trigger the script that check the lid and set the screen!
In summary
Create a new script named lid_sensor
on the directory /etc/acpi/events
with this content:
event=button/lid.*
action=/etc/acpi/lid.sh
Create the lid.sh
script on /etc/acpi
, add the right permission with the command chmod +x /etc/acpi/lid.sh
and fill the content of file with