You are not logged in.
Pages: 1
Hi all,
I've been fiddling with my handler.sh file for ages, trying to get my hotkeys on my Thinkpad X40 to work. I've finally got to the stage where the action is recognised (i.e. the "logger" message shows up in /var/log/messages.log in the below cases). However, I can't get some actions to work.
For example:
button/screenlock*) # Fn+F3
logger "acpid: blank screen (Fn+F3) pressed; switching display off"
sleep 1 && xset dpms force off ;;
button/sleep*) # Fn+F4
logger "acpid: sleep button (Fn+F4) pressed; initiating pm-suspend"
/usr/sbin/pm-suspend ;;
In this case, the sleep button works, and I can suspend the computer. However I cannot blank the screen with Fn+F3, although when I am in a normal terminal I can execute the above command without sudo. xset is in /usr/bin/ however, and not /usr/sbin/. I have a variety of other commands that do not also exectute for other hotkeys (cpufreq-set etc), but I'm hoping someone can give a solution to this, and it will work for all of them!
Cheers,
Ianhoolihan
Offline
The button/sleep action uses absolute paths, whereas the button/screenlock action does not?
Last edited by .:B:. (2011-11-27 08:12:08)
Got Leenucks? :: Arch: Power in simplicity :: Get Counted! Registered Linux User #392717 :: Blog thingy
Offline
Maybe you have to run xset command with su and DISPLAY. Something like tihis:
sleep 1 && DISPLAY:0.0 su -c - username /usr/bin/xset dpms force off ;;
If you have built castles in the air, your work need not be lost; that is where they should be. Now put foundations under them.
Henry David Thoreau
Registered Linux User: #559057
Offline
Thanks for both of your replies, but neither seems to work.
Note that I can run
xset dpms force off
from the terminal, without using sudo --- but it doesn't work in the handler.sh file. Also, I did have this working about three weeks ago, but after I updated the system, the same handler.sh does not work.
Any ideas on how to fix this, or test it?
Cheers
Offline
Run acpi_lsiten and press fn+F3. Post the output.
Last edited by Shark (2011-11-27 20:09:26)
If you have built castles in the air, your work need not be lost; that is where they should be. Now put foundations under them.
Henry David Thoreau
Registered Linux User: #559057
Offline
acpi_listen gives:
button/screenlock SCRNLCK 00000080 00000000
button/sleep SBTN 00000080 00000000
Note that previously it was something more like those originally posted in the topic below:
https://bbs.archlinux.org/viewtopic.php?id=130121
i.e. ibm/hotkey HKEY ...
Offline
I saw this which may help set it up: https://wiki.archlinux.org/index.php/Acpid
Offline
See also this from a bug report I was involved in awhile back. Read esp. from comment #12 onward.
Offline
However I cannot blank the screen with Fn+F3,
Because you didn't allow the connection to your X, and you didn't specify the display, and you didn't specify the path.
So what you really want is:
XAUTHORITY=/home/ianhoolihan/.Xauthority /usr/bin/xset -display :0.0 dpms force off
You need to install an RTFM interface.
Offline
Thanks anxrc!
Problem solved. Before I mark this topic as solved, if you could maybe give a few sentences for the newbies among the readers (me included!) that'd be much appreciated.
Ianhoolihan
Offline
Following on from the last bit ...
I'm still having the problem with, for example,
video/switchmode*) # Fn+F7
logger "acpid: Fn+F7 pressed, toggling screen"
case "$(xrandr -q | grep LVDS1)" in
*"+"*) ### LVDS1 is in use
case "$(/usr/bin/xrandr | grep VGA1)" in
"VGA1 connected (normal"*) ### VGA1 connected but not in use, so turn on in dual screen
logger "acpid: VGA1 now being used as second screen, above LVDS1"
/usr/bin/xrandr --output VGA1 --mode "1024x768" --above LVDS1;;
*"+"*) ### VGA1 is in use, so turn off LVDS1 and optimise VGA1
logger "acpid: LVDS1 switched off and VGA1 left on"
/usr/bin/xrandr --output LVDS1 --off
/usr/bin/xrandr --output VGA1 --auto
/usr/bin/xrandr --output VGA1 --preferred;;
*) ### VGA1 not connected
logger "acpid: external screen not found" ;;
esac;;
"LVDS1 connected (normal"*) ### LVDS1 connected but not in use, so turn off VGA1 and turn on LVDS1
logger "acpid: LVDS1 turned on, and VGA1 off"
/usr/bin/xrandr --output VGA1 --off
/usr/bin/xrandr --output LVDS1 --auto
/usr/bin/xrandr --output LVDS1 --preferred;;
*) ### if LVDS1 is not connected
logger "acpid: LVDS1 is not connected";;
which works fine as a separate script, but not as part of handler.sh. In saying that, it worked one time when I was fiddling round with it, but not again since. Given that it also worked before the last time I updated, do I maybe just need to change the permissions on the file or something similar?
Cheers
Ianhoolihan
Offline
Any ideas?
Offline
OK, I managed to get at least some working by adding
export XAUTHORITY="$HOME/.Xauthority"
export DISPLAY=":0"
I've no idea why this works, but it does. Could someone please explain this?
Offline
Pages: 1