Skip to content

input: add tablet stylus button triggers and binds#3745

Open
youssefadly237 wants to merge 3 commits into
niri-wm:mainfrom
youssefadly237:tablet-stylus-binds
Open

input: add tablet stylus button triggers and binds#3745
youssefadly237 wants to merge 3 commits into
niri-wm:mainfrom
youssefadly237:tablet-stylus-binds

Conversation

@youssefadly237
Copy link
Copy Markdown

Add support for tablet stylus button bindings

Example

binds {
    Super+TabletStylusPrimary { spawn-sh "some-script.sh"; } 
    TabletStylusSecondary { toggle-overview; }
}

Notes

I did test with Wacom CTL-472, but it should work on all tablets

Button codes are BTN_STYLUS, BTN_STYLUS2 include/uapi/linux/input-event-codes.h lines 414-L415 as of 4bdb6a1659873dfc625ded30a68cb387e328f34e

Copy link
Copy Markdown
Member

@YaLTeR YaLTeR left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here are some comments. Maybe there's a chance this can make it into the release. :)

Thanks for the link to linux uapi include btw, that was helpful to double-check.

Comment thread niri-config/src/binds.rs Outdated
Comment thread src/input/mod.rs
Comment thread src/input/mod.rs
Comment thread src/input/mod.rs Outdated
Comment thread src/niri.rs
@youssefadly237
Copy link
Copy Markdown
Author

youssefadly237 commented Apr 24, 2026

could be relevant but I don't have the hardware to test it

Pad keys (Wacom M Pad)

Physical key Code (int) Code (hex) Name
Key 0 256 0x100 BTN_0
Key 1 257 0x101 BTN_1
Key 2 258 0x102 BTN_2
Key 3 259 0x103 BTN_3
Key 4 260 0x104 BTN_4
Key 5 261 0x105 BTN_5
Key 6 262 0x106 BTN_6
Key 7 263 0x107 BTN_7
Key 8 (ring center) 264 0x108 BTN_8
image

upper column is 0,1,2,3
bottom column is 4,5,6,7
ring center is 8

there is a touch ring around the center button is ABS_WHEEL I guess

pad buttons are almost standerd for wacom devices but it varies, some other companies just send keyboard or mouse events instead, drivers/hid/wacom_wac.c

@youssefadly237 youssefadly237 requested a review from YaLTeR April 24, 2026 03:22
@UnskilledWolf
Copy link
Copy Markdown

I just tested this on my Wacom Intuos Pro (PTH-451) and both stylus button bindings work as expected. My tablet also does only have two buttons on the stylus, so I was not able to try TabletStylusButton3.

I also tried implementing bindings for the other keys on the tablet, based on the key codes above. However, I could not get these to trigger. I am not very familiar with rust, so I may have missed something. My attempt is published as a fork of this PR's branch in case anyone would like to take a look.

@youssefadly237
Copy link
Copy Markdown
Author

youssefadly237 commented Apr 26, 2026

yeah I checked your fork, I don't think this is the way to implement it, because you are treating the pad buttons as if they were stylus buttons, after reconsidering, I guess this is out of the scope of this pr, I don't have a tablet with pad buttons to test it, but I will try to implement it and message you on element x for testing?

@youssefadly237
Copy link
Copy Markdown
Author

youssefadly237 commented Apr 26, 2026

@Sempyos Sempyos added area:input Keyboard, mouse, touchpad, tablet, gestures, pointer area:config Config parsing, default config, new settings pr kind:feature New features and functionality labels Apr 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:config Config parsing, default config, new settings area:input Keyboard, mouse, touchpad, tablet, gestures, pointer pr kind:feature New features and functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants