r/hyprland • u/Jaded-Worry2641 • 1d ago
DISCUSSION Mouse controlls from keyboard?
Does anybody know how to set up full mouse controlls from keyboard? Like, I saw in the wiki the API for controlling the mouse cursors position, but I would like to replace mouse entirely, cause it broke and trackpad sucks and I need to work with portable laptop.
So does anybody know how its done?
I tried setting up wl-kbptr for jumps and its kinda good but like ... it still doesnt provide scroll.
And before constructing a francensteins monster of an AUR app per action I wanted to ask here for help.
2
u/Wiezyr 1d ago
Maybe you can use something like this https://github.com/MontyTheSoftwareEngineer/fievel/
1
u/Jolicristo 1d ago
seconding kanata, it handles scroll too if you put mouse wheel actions on a layer, way simpler than chaining random aur apps
1
u/lritzdorf 1d ago
It's a little cursed, but this is doable purely via Hyprland. The two dispatchers you need are hl.dsp.cursor.move({ x, y }) and hl.dsp.send_shortcut({ mods = "", key = "mouse:272" }), to move the cursor and click. For relative mouse movement, hl.get_cursor_pos() will also be helpful.
Edit: oh, scrolling is a bit more awkward. There are per-app solutions for this, like (usuallly) Ctrl-Shift-arrows for your terminal emulator and PgUp/PgDn (or even Vimium) in web browsers, but that may not be what you're looking for.
1
u/thisisnotmynicknam 1d ago
You don't need to configure this within Hyprland, you can use Kanata instead. It lets you set up bindings for inputs, layers and more.
So, you could create a Vim-like setup, with a navigation layer that includes mouse control and a separate typing layer or remap Caps Lock to act as a modifier for mouse control.