Fn+F2 to lock screen on ThinkPad X220
Hi everyone,
I am trying to map Fn+F2 to lock the screen on my thinkpad X220. I looked for some instruction online and found this topic (although regarding Arch).
I followed the instructions, namely:
1) installed both acpid and dbus
2) created the mentioned scripts:
/etc/acpi/events/fn-f2.sh:
event=ibm/hotkey HKEY 00000080 00001002
action=/etc/acpi/dbus-lock-screen.sh %e
/etc/acpi/dbus-lock-screen.sh:
#!/bin/bash
users=$(who|grep '^\w\w* *:'|awk '{print $1}'|sort|uniq)
for user in $users; do
userhome=$(grep "^$user:" /etc/passwd|awk -F : '{print $6}')
cd "$userhome/.dbus/session-bus/"
for sf in $(ls); do
source $sf
export DBUS_SESSION_BUS_ADDRESS
export DBUS_SESSION_BUS_PID
export DBUS_SESSION_BUS_WINDOWID
su $user -c 'qdbus org.freedesktop.ScreenSaver /ScreenSaver Lock'
done
done
It's quite clear to me that the first script aims to basically link the Fn+F2 "event" to lock the screen through the second script. However, I could not complete step 5) of the tutorial since there is no /etc/rc.d/ directory in my system. According to one of the replies in the abovementioned topic, the error might be in regex for grep in $users in the second script, although I don't really understand what do I need to edit. May someone give me a hand? Is this the problem, or do I need to also install acpid-runit and/or dbus-runit and enable them to make it work? Also, reading the second script I cannot understand what is actually used for locking the screen (I would like to edit this to make it slock, since I already use it to lock my screen on suspend).
Thank you in advance and sorry for the newbie question