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

Richard Neill linux-thinkpad@linux-thinkpad.org
Wed, 04 Apr 2007 11:33:28 +0100


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