[ltp] gnome-screensaver and locking using fn-f2

Grant Williamson linux-thinkpad@linux-thinkpad.org
Thu, 05 Apr 2007 23:00:39 +0200


Yep, 2 parts

1)
you need to have hotkey-setup running on your machine the thinkpad-keys 
daemon is the important part.

2)
acpi_support package, the acpi_fakey to send a keycode of 152, this will 
lock your screen using gnome-screeesaver.

It's a rather cool way of doing this.

Rob Hess wrote:
> On 4/5/07, Grant Williamson <traxtopel@gmail.com> wrote:
>> Ok finally worked it out ;)
>
> Can you describe in more detail how you got the fn-f2 key to lock
> gnome-screensaver?  I had tried to do this a little while back without
> success.
>
> Thanks.
>
> -Rob
>
>>
>> Ian Redfern wrote:
>> > I was thinking the ACPI might be faking that key.
>> >
>> > On Thu, 2007-04-05 at 11:48 +0200, Grant Williamson wrote:
>> >>  Ian,
>> >>      yep that works, I am just trying to get the fn-fx key's to work
>> >>  also. I have enabled it using xlock, however would like to get the
>> >>  ubuntu method working on redhat.
>> >>
>> >>  Ian Redfern wrote:
>> >>  > My GNOME Keyboard Shortcuts has Ctrl-Alt-L mapped to 'Lock 
>> screen'.
>> >>  > Does yours?
>> >>  >
>> >>  > On Wed, 2007-04-04 at 15:53 +0200, Grant Williamson wrote:
>> >>  >>  Ubuntu has a clever way of doing it using acpi_fakekey which 
>> sends
>> >>  >>  signals. i.e. acpi_fakekey 152 will launch the screensaver.
>> >>  >>
>> >>  >>  Ian Redfern wrote:
>> >>  >>  > Odd really, because xscreensaver-command doesn't exist on 
>> my system,
>> >>  >>  > as I only have gnome-screensaver, yet Fn-F2 does indeed 
>> kick off
>> >>  >>  > gnome-screensaver.
>> >>  >>  >
>> >>  >>  > On Wed, 2007-04-04 at 14:39 +0200, Grant Williamson wrote:
>> >>  >>  >>  They are still using "xscreensaver-command" in their 
>> scripts. I guess I
>> >>  >>  >>  can use xlock.
>> >>  >>  >>
>> >>  >>  >>  Ian Redfern wrote:
>> >>  >>  >>  > Attached. Hope it helps!
>> >>  >>  >>  >
>> >>  >>  >>  > On Wed, 2007-04-04 at 14:28 +0200, Grant Williamson wrote:
>> >>  >>  >>  >>  I was looking at dapper, can u tar up the /etc/acpi 
>> dir for me mail me
>> >>  >>  >>  >>  it please.
>> >>  >>  >>  >>
>> >>  >>  >>  >>  Ian Redfern wrote:
>> >>  >>  >>  >>  > Nope, gnome-screensaver.
>> >>  >>  >>  >>  >
>> >>  >>  >>  >>  > #On Wed, 2007-04-04 at 14:09 +0200, Grant 
>> Williamson wrote:
>> >>  >>  >>  >>  >>  I know, ubuntu uses xscreensaver.
>> >>  >>  >>  >>  >>
>> >>  >>  >>  >>  >>  Ian Redfern wrote:
>> >>  >>  >>  >>  >>  > It may not help much, but Fn-F2 works fine on 
>> Ubuntu Feisty on my
>> >>  >>  >>  >>  >>  > ThinkPad X60, so you may be able to copy it 
>> from there.
>> >>  >>  >>  >>  >>  >
>> >>  >>  >>  >>  >>  > On Wed, 2007-04-04 at 13:18 +0200, Grant 
>> Williamson wrote:
>> >>  >>  >>  >>  >>  >>  That does not seem to work either, 
>> xscreensaver would, even if I set
>> >>  >>  >>  >>  >>  >>  XAUTH & DISPLAY.
>> >>  >>  >>  >>  >>  >>
>> >>  >>  >>  >>  >>  >>  Fails with either
>> >>  >>  >>  >>  >>  >>  gnome-screensaver-Message: Screensaver is not 
>> running! (launch it as root)
>> >>  >>  >>  >>  >>  >>  or
>> >>  >>  >>  >>  >>  >>  gnome-screensaver-Message: Failed to connect 
>> to the D-BUS daemon: Failed
>> >>  >>  >>  >>  >>  >>  to execute dbus-launch to autolaunch D-Bus 
>> session (via su - user)
>> >>  >>  >>  >>  >>  >>
>> >>  >>  >>  >>  >>  >>
>> >>  >>  >>  >>  >>  >>  Richard Neill wrote:
>> >>  >>  >>  >>  >>  >>  >
>> >>  >>  >>  >>  >>  >>  >
>> >>  >>  >>  >>  >>  >>  > Grant Williamson wrote:
>> >>  >>  >>  >>  >>  >>  >> Hi,
>> >>  >>  >>  >>  >>  >>  >> has anyone got a way to lock gnome-screen 
>> saver using fn-fn2.
>> >>  >>  >>  >>  >>  >>  >>
>> >>  >>  >>  >>  >>  >>  >> I am using ibm-acpi
>> >>  >>  >>  >>  >>  >>  >> i.e.
>> >>  >>  >>  >>  >>  >>  >> events/FnF2-ibm-acpi.conf
>> >>  >>  >>  >>  >>  >>  >> # ACPID Configuration to execute action 
>> when pressing Fn+F2
>> >>  >>  >>  >>  >>  >>  >> event=ibm/hotkey HKEY 00000080 00001002
>> >>  >>  >>  >>  >>  >>  >> action=/etc/acpi/actions/FnF2.sh
>> >>  >>  >>  >>  >>  >>  >>
>> >>  >>  >>  >>  >>  >>  >> actions/FnF2.sh
>> >>  >>  >>  >>  >>  >>  >> #!/bin/bash
>> >>  >>  >>  >>  >>  >>  >> # Does not work ... yet
>> >>  >>  >>  >>  >>  >>  >> USER=`ps aux|grep -i 
>> gnome-screensaver|grep -v grep| awk '{print $1}'`
>> >>  >>  >>  >>  >>  >>  >> su $USER -c "dbus-send --session 
>> --dest=org.gnome.ScreenSaver
>> >>  >>  >>  >>  >>  >>  >> --type=method_call --print-reply 
>> --reply-timeout=20000
>> >>  >>  >>  >>  >>  >>  >> /org/gnome/ScreenSaver 
>> org.gnome.ScreenSaver.SetActive boolean:true"
>> >>  >>  >>  >>  >>  >>  >>
>> >>  >>  >>  >>  >>  >>  >
>> >>  >>  >>  >>  >>  >>  > Try using
>> >>  >>  >>  >>  >>  >>  >   gnome-screensaver-command --activate
>> >>  >>  >>  >>  >>  >>  > You may need to set the correct value of 
>> $DISPLAY first.
>> >>  >>  >>  >>  >>  >>  >
>> >>  >>  >>  >>  >>  >>  > HTH,
>> >>  >>  >>  >>  >>  >>  >
>> >>  >>  >>  >>  >>  >>  > Richard
>> >>  >>
>> >>  >
>> >>  >
>> >>  > This e-mail and any attachment is for authorised use by the 
>> intended
>> >>  > recipient(s) only. It may contain proprietary material, 
>> confidential
>> >>  > information and/or be subject to legal privilege. It should not be
>> >>  > copied, disclosed to, retained or used by, any other party. If 
>> you are
>> >>  > not an intended recipient then please promptly delete this 
>> e-mail and
>> >>  > any attachment and all copies and inform the sender. Thank you.
>> >>  >
>> >>
>> >>
>> >
>> > *Ian Redfern MIET*
>> > Telecoms Consultant
>> > _________________________________________
>> > *LogicaCMG -* * Releasing your potential *
>> > 75 Hampstead Road
>> > London NW1 2PL, UK
>> > T: +44 (0) 20 7637 9111
>> > E: Ian.Redfern@LogicaCMG.Com <mailto:Ian.Redfern@LogicaCMG.Com>
>> > www.logicacmg.com <http://www.logicacmg.com>
>> >
>>
>> -- 
>> The linux-thinkpad mailing list home page is at:
>> http://mailman.linux-thinkpad.org/mailman/listinfo/linux-thinkpad
>>