Feature Request: Application-specific input remapping in KWin (Wayland)

The Problem

I’ve been using Solaar for years to set up application-specific mouse button remapping. For example, my back/forward buttons do Alt+Left/Right in Firefox but Ctrl+Z/Ctrl+Y in GIMP. My thumb wheel switches tabs in browsers but navigates files in Dolphin. It’s incredibly useful and I have about 15 different apps configured with specific rules.

The issue is that this completely breaks under Wayland. Solaar (and similar tools like input-remapper) can’t work because they need to:

  • Know which app is currently active

  • Intercept and modify input events system-wide

Both of these are impossible for regular apps under Wayland by design. So I’m stuck on X11 even though I’d prefer to use Wayland.

Proposed Solution

Since KWin already knows which app is active and has full access to input events, couldn’t this be implemented directly in KWin? It would be similar to how global shortcuts work, just with per-application rules.

The basic idea:

  1. User creates rules like “When Firefox is active: Mouse Button 4 → Alt+Left”

  2. KWin intercepts the mouse button press

  3. Checks if there’s a rule for the current app

  4. Sends the remapped key combo instead

This wouldn’t break Wayland’s security model at all - apps still can’t spy on each other, it’s just KWin doing the remapping before passing events to apps.

What I’d Need

Just the basics would already be incredibly helpful:

Per-app input rules:

  • Remap mouse buttons to keyboard shortcuts

  • Remap mouse wheel/thumb wheel to keyboard shortcuts

  • Support for modifier keys (only trigger if Shift is pressed, etc.)

  • Basic conditions (button held, scroll threshold, etc.)

GUI in System Settings:

  • Similar to the existing Custom Shortcuts interface

  • Add app → add rule → test it

  • Enable/disable per app

Real Use Cases (from my actual setup)

Browsers (Firefox, Brave, Thunderbird):

  • Back button → Alt+Left

  • Forward button → Alt+Right

  • Thumb wheel up → Ctrl+Tab (next tab)

  • Thumb wheel down → Ctrl+Shift+Tab (previous tab)

Creative apps (GIMP, LibreOffice, Xournalpp):

  • Back button → Ctrl+Z (undo)

  • Forward button → Ctrl+Y or Ctrl+Shift+Z (redo)

Dolphin:

  • Back/Forward → Alt+Left/Right for navigation

  • Thumb wheel → Up/Down arrows

Default (everything else):

  • Back button → Ctrl+Z

  • Forward button → Ctrl+Shift+Z

I have way more complex rules than this (mouse gestures, conditional rules based on other buttons, etc.) but even basic support would solve 80% of my needs.

Why This Matters

I know I’m not the only one stuck on X11 because of this. Lots of people with programmable mice or keyboards rely on these workflows. Some alternatives:

  • Hardware profiles: Not all mice support this, and it’s way less flexible

  • Per-app configuration: Would require every single app to implement support

  • Keep using X11: Not really a long-term solution

Having this natively in KWin would be the cleanest solution and would help a lot of power users finally migrate to Wayland.

Technical Note

This should be pretty safe security-wise since:

  • Everything happens in KWin (trusted code)

  • Apps remain completely isolated

  • No app can know what’s happening in other apps

  • It’s just input transformation at the compositor level

I’m happy to provide more details about my setup or help test if anyone’s interested in implementing this. My full Solaar config is pretty complex and could serve as a reference for what kind of features people actually use.


Would really appreciate this feature - it’s honestly the main thing keeping me on X11 right now.

4 Likes