Add support to toggle touchpad state
What do you need?
Since a lot of people use laptop with a external mouse, many times it is just a nuisance because of accidental clicks and what not. My Personal reason for opening the issue is that my touchpad is glitched, it starts moving and clicking randomly so i want it to disable that. I have come up with a solution but it is hardcoded so it won't work for all devices so i am looking for a way to generalize it for all. Since i want to contribute to FOSS please let me try to solve this issue and raise a PR. Please guide me in this if possible Thankyou 🙏
Configuration i have done to achieve the required results
1. ~/.config/hypr/scripts/toggle-touchpad.sh
#!/usr/bin/env bash
export STATUS_FILE="/tmp/touchpad.status"
enable_touchpad() {
printf "true" > "$STATUS_FILE"
hyprctl keyword 'device[asue120a:00-04f3:319b-touchpad]:enabled' "true"
notify-send "Touchpad Enabled"
}
disable_touchpad() {
printf "false" >"$STATUS_FILE"
hyprctl keyword 'device[asue120a:00-04f3:319b-touchpad]:enabled' "false"
notify-send "Touchpad Disabled"
}
if ! [ -f "$STATUS_FILE" ]; then
disable_touchpad
else
if [ $(cat "$STATUS_FILE") = "true" ]; then
disable_touchpad
elif [ $(cat "$STATUS_FILE") = "false" ]; then
enable_touchpad
fi
fi
2. ~/.config/hypr/bindings.conf
# Toggle Touchpad
bindd = , XF86TouchpadToggle, Toggle Touchpad, exec, ~/.config/hypr/scripts/toggle-touchpad.sh
3. ~/.config/hypr/inputs.conf
device {
name = asue120a:00-04f3:319b-touchpad
enabled = true
}
Tasks
- [x] create a script to grep the name of touchpad from hyprctl devices
- [x] create a script to automate the whole setup
I don't use an external mouse. My touchpad worked pretty fine on gnome/KDE. But on Omarchy I got random cursor movements during typing almost every hour once.
@abuturabofficial For me it's actually a hardware issue since it was still exisiting when i was using mint before switching to omarchy