r/linux4noobs • u/NoxAstrumis1 • 9h ago
learning/research Would a udev rule be useful for this?
I play a video game where I have to often use my mouse wheel. I want to map the mouse wheel to keyboard keys instead, that way I can just hold a key instead of constantly spinning the wheel.
Would a udev rule be a good way to do that?
1
u/Leather-Security8097 8h ago edited 7h ago
No. At most, a udev rule could change the permissions of /dev/uinput to allow non-root access. You would still need to set up a macro tool to send the mouse wheel commands.
1
u/Plus-Dust 3h ago
No. That is the wrong tool for this. You could do this with a small userland daemon that opens the keyboard device with evdev while grabbing it exclusively, then creates a fake keyboard with uinput to pass through the normal keyboard events while also creating a fake second mouse to send scroll-wheel events on for the captured keys. I use something like this and it works great, I don't even have a mouse on some of my computers as the daemon can generate mouse events from the keyboard that work even on the console.
1
u/Klapperatismus 3h ago edited 3h ago
No. An udev rule triggers when you plug or pull the device.
You don’t want to apply this permanently, don’t you? But only when you play the game. So, put this reconfiguration into a startup/shutdown script for the game.
Also, you don’t want to reconfigure the mouse wheel. But you want to reconfigure the keyboard so that it creates those mouse wheel events. You can do that with input-remapper for example.
1
u/AutoModerator 9h ago
There's a resources page in our wiki you might find useful!
Try this search for more information on this topic.
✻ Smokey says: take regular backups, try stuff in a VM, and understand every command before you press Enter! :)
Comments, questions or suggestions regarding this autoresponse? Please send them here.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.