I would like my laptop’s touchpad to get disabled when I connect a mouse. I have seen an option like this on Mint with Cinnamon, but I can’t find anything like it in Endeavour with Plasma.
Also, my mouse has two side buttons for navigating forwards and backwards in browsers and such, but I would like to swap the buttons. I have found the “Re-bind additional mouse buttons” option in mouse settings, but it doesn’t look like it can be used to achieve what I need.
I have searched around, but most solutions were for Xorg and non-Arch distros. Does anyone have any advice, please?
yay -S wayland-mouse-mapper-git
From now on your creativity is needed. I haven’t tested this (edit it) /usr/bin/mousemapper
To understand more or to get lost
Hm, so I take your advice to mean there’s no built-in way to achieve what I need?
Ydotools isn’t working for me, when I get to the step to enable the service I get:
Failed to enable unit: Unit file ydotool.service does not exist.
This happens even after restart.
I have taken a look at the mousemapper script and read the Baeldung page. At a glance it looks like it should work, but I’m not good enough at bash to fully understand the script. I’ll need to take some time to sit down and take a proper look at it.
I have also taken a look at the input-remapper and I was able to remap the buttons on the mouse. I think a utility like this is preferable for me compared to scripting. I wasn’t able to make it turn off the touchpad yet, because of the ydotools issue…
find a unique string in journal when your mouse is plugged in /switched on and disconnected by this command: journalctl -f -p 6
The customized script may be autostarted.
Static query is below at Edit2
It seems a bit over-engineered.
Edit2
For me the RTFM is pretty valid. /usr/include/linux/input-event-codes.h
So having configured ydotool we also have touchpad on (531) and off (532) keycodes. Let’s wipe down the ‘white-board’ and simplify the case.
I inserted 2 scripts into Autostart a login and a logout one
cat momp.sh
#!/bin/sh
# Check whether mouse is plugged-in and disable/enable touchpad
while :
do
lsusb | grep -q Mouse
MOUSE="$?"
if [ "$MOUSE" != "$PREM" ]; then
case $MOUSE in
0)
ydotool key 532:1 532:0
;;
1)
ydotool key 531:1 531:0
;;
esac
PREM="$MOUSE"
fi
sleep 5
done
OK, so the final script does work. It is just unfortunate that it relies on a unique string relevant to each device - I don’t always use the same mouse, even now I have a different one than when I started this thread. I suppose I could just check the lsusb output against an array of identifiers… Ideally, it would be built-in, but I guess that’s a complaint for the Plasma devs.
That being said I think can make do with this solution for now. Thank you for your help and patience
BTW did you @bytehowl know that touchpad can be enabled/disabled by by assigning shortcuts out of the box. Never mind otherwise I would not have learned some new scripting stuff.
Just did this very easily and successfully on my wife’s laptop. In plasma, go to system settings > mouse & touchpad > touchpad. There are checkboxes for disabling the device entirely (if you always use the external mouse, which she does) and disable while typing. Check/ uncheck as you choose. You will need to reboot (not just logout) for the changes to take effect
I do, in fact I didn’t even need to assign anything, the Fn+F7 on my laptop works. However, I’m used to having this automated, and as I have mentioned earlier, Cinnamon has this and also Gnome (with a bit of digging).
Reboots shouldn’t actually be necessary, but again, not automated.