View previous topic :: View next topic |
Author |
Message |
grant123 Veteran
Joined: 23 Mar 2005 Posts: 1080
|
Posted: Sun Sep 16, 2012 11:11 am Post subject: Lid closed = screen locked? |
|
|
Can I have the screen locked whenever the laptop lid is closed in xfce4 without using xfce4-power-manager?
How about having the screen turned off when the lid is closed? |
|
Back to top |
|
|
audiodef Watchman
Joined: 06 Jul 2005 Posts: 6639 Location: The soundosphere
|
|
Back to top |
|
|
ppurka Advocate
Joined: 26 Dec 2004 Posts: 3256
|
Posted: Sun Sep 16, 2012 5:27 pm Post subject: |
|
|
Best option is to use acpi. It will be independent of your desktop manager. You will need to fill in the following "blanks".
1. Determine the lid close event. Use acpi_listen to find out what event is triggered.
2. Create a file /etc/acpi/events/lid with the contents Code: | event=button/lid # replace button/lid with your event
action=/etc/acpi/actions/lid "%e" |
3. Create an executable script /etc/acpi/actions/lid that catches this event Code: | #!/bin/bash
# if launched through a lid event and lid is open, do nothing
# replace the following string with your lid open event string from acpi_listen
[[ "$1" = *button/lid*open ]] && exit 0
# Determine your logged in user, or hard code your username
# See http://forums.gentoo.org/viewtopic-t-927908-view-previous.html
XUSER="username"
# Launch whatever you want
export DISPLAY=":0.0"
# You might also need to determine the dbus instance if you want to run xfce lock command.
<xfce lock command here> & # Put an "&" at the end if the lock command doesn't exit immediately.
xset dpms force off # will blank screen |
_________________ emerge --quiet redefined | E17 vids: I, II | Now using kde5 | e is unstable :-/ |
|
Back to top |
|
|
grant123 Veteran
Joined: 23 Mar 2005 Posts: 1080
|
Posted: Mon Sep 17, 2012 7:12 am Post subject: |
|
|
Thank you, I've decided to stick with xfce4-power-manager but this should come in handy for someone. |
|
Back to top |
|
|
|