cyber-sushi / makima

Linux daemon to remap and create macros for keyboards, mice and controllers
GNU General Public License v3.0
145 stars 1 forks source link

Remap on per application basis? #3

Closed 097115 closed 7 months ago

097115 commented 11 months ago

Hi!

Sorry if I missed it, but it would be great if makima could also handle remaps limited to a certain application (window class?).

Like, if I want to remap KEY_CAPSLOCK to KEY_ESC in the terminal and to KEY_F11 in the browser.

cyber-sushi commented 10 months ago

Hello, sorry for the late answer.

I've added this feature today with the release of Makima 0.3.0, although Hyprland is the only supported compositor atm. You can read about it in the Readme.

Anyway, each Wayland compositor has its own way of retrieving the active window, some of them are pretty straightforward, like Hyprland and Sway, some of them are fairly exotic, like Gnome (and X11, I guess), some others straight up look like a nightmarish endeavor, like Plasma. I will probably add support for Sway in the near future. In the meantime, I'll pray for a miracle and wish that the Wayland devs come up with a shared API so that other developers don't have to implement ten different ways of interacting with the display server for each application.

097115 commented 10 months ago

Thanks for your interest and for the detailed reply!

BTW, while speaking of X11, may be this similar utility's code could help (it's Python, though).

Thanks again!

cyber-sushi commented 10 months ago

Yeah, the X11 bindings for Python are pretty simple, 3 or 4 lines of code are enough to get the active window's class. The same can't be said of the Rust bindings as they're much lower level, but I can definitely try after Sway

cyber-sushi commented 10 months ago

Quick update, I've added support for Sway in version 0.3.1, so X11 will be next

cyber-sushi commented 7 months ago

I added support for X11 in version 0.4.1, I think I can close this issue. If someone needs app-specific bindings for other compositors, please open an issue specific to that compositor.