Disable Screen Blank/Lock on Lid Events

Please post suggestions for improvement of Cinnamon on:
https://github.com/linuxmint/Cinnamon
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
ahimmerman

Disable Screen Blank/Lock on Lid Events

Post by ahimmerman »

I'm running Linux Mint 13 Maya with the distro-stock 3.2.0-23 kernel, stock X.Org and stock Cinnamon on a Lenovo ThinkPad W520 4276-39U laptop. I'm having difficulty disabling screen blank/lock on lid close/open and would appreciate assistance. Ultimately, I'd like to be able to occasionally close the lid and use an external display, keyboard, mouse, etc..

I've attempted the following:
  • I tried using dconf-editor, I set org.gnome.settings-daemon.plugins.power lid-close-ac-action and lid-close-battery-action to nothing. (active is true). Not sure if it's relevant, though, org.gnome.desktop.screensaver lock-enabled is true, org.gnome.desktop.lockdown disable-lock-screen is false.
  • I tried modifying /etc/acpi/lid.sh, which shows evidence of being run by acpid, to immediately return (diagnostic step), tried modifying /usr/share/acpi-support/screenblank and then tried disabling acpid altogether (stop acpid and service acpi-support stop).
So far, I've not even been able to determine how lid events are being detected, let alone, what's handling those events. I suspect /proc/acpi/button/lid/LID/state, but haven't been able to determine what processes are watching that view.

Coincidentally, manual xset dpms changes are being reverted after the next lid close/open. While I'm optimistically awaiting replies, I'll grep for any scripts that make dpms changes, reference /proc/acpi/button/lid/*/state and/or reference xscreensaver or gnome-screensaver.

What's responsible for blanking/locking my screen on lid events? How can I reconfigure that for the behavior I want?

Thank you in advance for any support you can provide.
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
ahimmerman

Re: Disable Screen Blank/Lock on Lid Events

Post by ahimmerman »

It seems that the thinkpad_acpi module detects lid events, publishes those events to user-land via the /proc/acpi/event and /proc/acpi/button/lid/*/state interfaces for user-land processes to get open/close state. acpid monitors /proc/acpi/event as specified by /etc/acpi/events/lidbtn, which calls /etc/acpi/lid.sh, which, upon open, sources /usr/share/acpi-support/screenblank. Ultimately, it seems that acpid and its scripts are responsible for using xset dpms force on and off to blank the screens. Some process I've not yet identified uses dbus to manipulate gnome-screensaver.

Proposed kludgy resolution:
  • Update /etc/UPower/UPower.conf to set IgnoreLid=true
  • Update /etc/acpi/lid.sh to execute based on lid-close-ac-action and lid-close-battery-action gsettings and /proc/acpi AC v. battery state.
Can anyone confirm my description and/or comment on my proposed kludge?

Thank you in advance,

Andrew
antimatter
Level 1
Level 1
Posts: 30
Joined: Mon Nov 07, 2011 8:19 am

Re: Disable Screen Blank/Lock on Lid Events

Post by antimatter »

Thanks!
I was searching for a solution in order to prevent Mint 13 from locking the session when I close the laptop lid. The UPower think works like a charm on my HP 6450b. A reboot was necessary for the change to take effect.
naturalsciences

Re: Disable Screen Blank/Lock on Lid Events

Post by naturalsciences »

ahimmerman wrote: Proposed kludgy resolution:
  • Update /etc/UPower/UPower.conf to set IgnoreLid=true
  • Update /etc/acpi/lid.sh to execute based on lid-close-ac-action and lid-close-battery-action gsettings and /proc/acpi AC v. battery state.
Can anyone confirm my description and/or comment on my proposed kludge?
It ain't a hard thing to do - to change the UPoer IngoreLid to true.
But Update /etc/acpi/lid.sh to execute based on lid-close-ac-action and lid-close-battery-action gsettings and /proc/acpi AC v. battery state.
Well I just got no idea. I did lok the code in it and it was just a mess to a noob like me. Can you mabe post the modified code that should be in there or somesuch. I guess that wath you meant by the sentence at least?
That the code inside lid.sh should be cahnged. Cause I have changed Ingorelid in Upower, and it is not eanough. Screen still annoyingly blanks. And I have no other idea what to do next.


This is just such annoying "feature" I can not in my right mind understand why there is not a do nothing option in power settings. If they are worried then it might just come with a warning. But the main use for my laptops have been closed lid, on powerchord and attached to an actual monitor.

edit: So monaged to help myself a bit already here:
Looks like I managed to get what I wanted by doing following -- If I rolled my eyes over /etc/acpi/lid.sh I discovered it checks the lidstatus and then if it is closed initiates ./usr/share/acpi-support/screenblank. So right now I renamed the /usr/share/acpi-support/screenblank as a screenblankbackup (jut in case I need the poor lobotomised f****) to use a blank screen for some reason so I could restore it then.
Probably I could replace the command ./ /usr/share/acpi-support/screenblank inside lid.sh also with something harmless and keep the screenblank script file intact.
udrnovsek

Re: Disable Screen Blank/Lock on Lid Events

Post by udrnovsek »

This one works for me.
I setup in
>> Menu->Applications->SystemTools->Configuration editor (or run 'mateconf-editor')
>> +apps
+ mate-power-manager
+buttons
*lid_ac nothing
*lid_battery suspend

AND (otherwise don't work) in /etc/acpi/lid.sh commented the whole section

# -- commented lines to not to activate blank screen
#grep -q closed /proc/acpi/button/lid/*/state
#if [ $? = 0 ]
#then
# for x in /tmp/.X11-unix/*; do
# displaynum=`echo $x | sed s#/tmp/.X11-unix/X##`
# getXuser;
# if [ x"$XAUTHORITY" != x"" ]; then
# export DISPLAY=":$displaynum"
# . /usr/share/acpi-support/screenblank
# fi
# done
#else
for x in /tmp/.X11-unix/*; do
displaynum=`echo $x | sed s#/tmp/.X11-unix/X##`
getXuser;
if [ x"$XAUTHORITY" != x"" ]; then
export DISPLAY=":$displaynum"
grep -q off-line /proc/acpi/ac_adapter/*/state
if [ $? = 1 ]
then
if pidof xscreensaver > /dev/null; then
su $user -c "xscreensaver-command -unthrottle"
fi
fi
if [ x$RADEON_LIGHT = xtrue ]; then
[ -x /usr/sbin/radeontool ] && radeontool light on
fi
if [ `pidof xscreensaver` ]; then
su $user -c "xscreensaver-command -deactivate"
fi
su $user -c "xset dpms force on"
fi
done
#fi

From my system info:
Linux Mint 13 Maya
OpenGL Renderer : AMD Radeon HD 6320 Graphics
-Input Devices-
Power Button
Lid Switch
Sleep Button
Power Button

Hope i helped someone :)
jansef

Re: Disable Screen Blank/Lock on Lid Events

Post by jansef »

I only commented out one line:

# . /usr/share/acpi-support/screenblank

and it works now. I have HP 6530b laptop and I am running Linux Mint 14 Nadia. When the lid is closed, the display is power-off by hardware anyway. So it's the right solution.
J.
Locked

Return to “Cinnamon”