This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Touchpad off using Fn+F5 is not persistent across restart

Tags: None
(comma "," separated)
User avatar
posiris
Registered Member
Posts
2
Karma
0
OS
I’m using Manjaro KDE on a Dell Latitude E5440. I’ve noticed that other distros that use KDE have the same issue so I don’t think it’s specific to Manjaro, which is why I decided to come here to ask.

Fn+F5 will toggle the touchpad on/off just fine when I’m using a KDE flavored distro. I often use a wireless mouse so I like to have the touchpad disabled. However, if I do so much as log out or restart, the touchpad will be turned back on. In Gnome and XFCE, for example, the touchpad stays disabled across restarts and log in/out which is how I like it. Something I noticed in these other environments is that if I go to the touchpad settings and use the hotkey to toggle it on and off, it actually checks/unchecks “Enable Touchpad”. The opposite happens with KDE environments; if I press the hotkey to toggle it on and off, Device Enabled is always left on.

Is there something that I can modify that would turn off/on the touchpad with Fn+F5 and be persistent? I went to Keyboard shortcuts, searched for Touchpad to pull up Touchpad off, Touchpad on, and Touchpad toggle. I made sure that toggle was set to Fn+F5 and it is.
User avatar
posiris
Registered Member
Posts
2
Karma
0
OS
With the help of the KDE Community Telegram group, I was able to find a workaround that works for me. I call this a workaround for a couple of reasons:

1. The touchpad will be enabled at the login screen. Which is fine as I can't use Fn+F5 to toggle it on/off there anyways.
2. This workaround will run a script after login that disables the touchpad. So it doesn't necessarily "save" the state before you logout/restart/shutdown.
3. The script is on the Arch Wiki so I'm unsure if this will work on Debian, Fedora, BSD, etc. I only have experience with doing this on Manjaro.

If this is something that is a bother then you could check out other DEs as this issue seems specific to KDE.

The first thing you will want to do is install xinput. This can be done by opening Add/Remove Software and searching for xorg-xinput, and then installing it. It's in official repositories. You will then be prompted to restart, which you should do so. Next, go to this link to find the software toggle bash script.

Open Terminal and enter
Code: Select all
sudo nano ~/.xprofile


Copy/paste the bash script:
Code: Select all
#!/bin/bash

declare -i ID
ID=`xinput list | grep -Eio '(touchpad|glidepoint)\s*id\=[0-9]{1,2}' | grep -Eo '[0-9]{1,2}'`
declare -i STATE
STATE=`xinput list-props $ID | grep 'Device Enabled' | awk '{print $4}'`
if [ $STATE -eq 1 ]
then
    xinput disable $ID
    # echo "Touchpad disabled."
    # notify-send -a 'Touchpad' 'Disabled' -i input-touchpad
else
    xinput enable $ID
    # echo "Touchpad enabled."
    # notify-send -a 'Touchpad' 'Enabled' -i input-touchpad
fi


Ctrl+X to exit and Y -> Enter to save the script.

Now you should be back to the Terminal. Now enter
Code: Select all
sudo chmod +x ~/.xprofile
to make it executable. You can now exit Terminal.

Last, open System Settings and go to Startup and Shutdown -> Autostart. Click Add... then choose Login Script and select .xprofile. If you are unable to see the file, press Ctrl+H to show hidden files.

That's it! You can now test it out by logging out and back in. Your touchpad should be disabled immediately.


Bookmarks



Who is online

Registered users: bancha, Bing [Bot], Evergrowing, Google [Bot], lockheed, mesutakcan, Sogou [Bot]