You are not logged in.

#1 2013-10-20 02:10:51

czepluch
Member
Registered: 2011-04-11
Posts: 11

Turning touchpad on and off using FN + F1 script not working

Hi.

I have just bought a Sony Vaio Pro 13. I would like to be able to use FN + F1 to toggle the touchpad on and off instead of having to write the 'synclient TouchpadOff=1' command everytime i want to turn it off.

I have used the following scripts:

/etc/acpi/events/toggle-touchpad

event=button.fnf1 FNF1
action=/etc/acpi/actions/toggle-touchpad.sh "%e"

and

/etc/acpi/actions/toggle-touchpad.sh

#!/bin/bash
PATH="/bin:/usr/bin:/sbin:/usr/sbin"
export DISPLAY=:0
USER=`who | grep ':0' | grep -o '^\w*' | head -n1`

if [ "$(su "$USER" -c "synclient -l" | grep TouchpadOff | awk '{print $3}')" == "0" ]; then
    su "$USER" -c "synclient TouchpadOff=1"
else
    su "$USER" -c "synclient TouchpadOff=0"
fi

The code is from the arch wiki page for the given laptop that I am using [link]https://wiki.archlinux.org/index.php/So … ntallation[/link] and should work, but it does not work for me.

Is there an error in the code or is there just something that I haven't done to get this to work?


EDIT: And of course acpid is installed and added to systemd.

Last edited by czepluch (2013-10-20 02:11:54)

Offline

#2 2013-10-20 02:22:37

cfr
Member
From: Cymru
Registered: 2011-11-27
Posts: 7,178

Re: Turning touchpad on and off using FN + F1 script not working

Does the script work if you execute it manually?

Also, check that the key is sending the code you expect.


CLI Paste | How To Ask Questions

Arch Linux | x86_64 | GPT | EFI boot | refind | stub loader | systemd | LVM2 on LUKS
Lenovo x270 | Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz | Intel Wireless 8265/8275 | US keyboard w/ Euro | 512G NVMe INTEL SSDPEKKF512G7L

Offline

#3 2013-10-20 02:38:44

czepluch
Member
Registered: 2011-04-11
Posts: 11

Re: Turning touchpad on and off using FN + F1 script not working

When I execute it manually it says: "su:  user does not exist".
This does of course give me a clue of whats wrong, but I don't know how to fix it. How do I check if a key sendt the code I expect?

Offline

#4 2013-10-22 10:58:23

David Batson
Member
Registered: 2011-10-13
Posts: 640

Re: Turning touchpad on and off using FN + F1 script not working

Use acpi_listen in terminal to see if the key combo executes the acpi command you are expecting (i.e. FNF1).  acpi_listen works something like xev.  Start acpi_listen, then press the key combo.

Regarding starting the script file, I never used %e in the actions line.  Try running the script toggle-touchpad.sh as root from terminal to test it.  Make sure it's set as 'executable'.

Offline

#5 2013-10-22 14:42:43

Lynden
Member
Registered: 2011-11-10
Posts: 23

Re: Turning touchpad on and off using FN + F1 script not working

czepluch wrote:

When I execute it manually it says: "su:  user does not exist".
This does of course give me a clue of whats wrong, but I don't know how to fix it. How do I check if a key sendt the code I expect?

The who command used in your example doesn't work on my install either. I'm guessing due to systemd.
Try replacing it with

USER=`loginctl --no-pager | awk '{ print $3 }' | head -n1`

I haven't tested it extensively, but give it a try.

Offline

Board footer

Powered by FluxBB