XkbSetDeviceButtonActions(3)
π XkbSetDeviceButtonActions(3)
okay so bestie, we're in the XKB FUNCTIONS section of the manual β yes, that XKB, the X KeyBoard extension, and this one is called XkbSetDeviceButtonActions. the way this function is so specific and so cute: it changes only the button actions for an input extension device. nothing else. not the whole device, just the button actions. main character energy fr fr π
β¨ NAME β¨
XkbSetDeviceButtonActions β change only the button actions for an input extension device π¦
β¨ SYNOPSIS β¨
Bool XkbSetDeviceButtonActions (Display *dpy, XkbDeviceInfoPtr device,
unsigned int first_button, unsigned int num_buttons);
β¨ ARGUMENTS β¨
dpyβ your connection to the X server, obvs πdeviceβ the structure that defines the device and the modifications you want to make to itfirst_buttonβ the number of the first button to update, and yes it's 0 relative (zero-based, bestie, we start counting at zero here)num_buttonsβ how many buttons you wanna update
β¨ DESCRIPTION β¨
so here's the tea β XkbSetDeviceButtonActions assigns actions to the buttons of the device specified in device_info->device_spec. it grabs the actions from device_info->btn_acts and hands them out to num_buttons buttons, starting at first_button. slay. π
but like β vibe check first, okay? if the server does not support assignment of Xkb actions to extension device buttons, thenXkbSetDeviceButtonActionshas no effect and returnsFalse. not me getting rejected by the server π
same deal if the device has no buttons at all, or if first_button or num_buttons point at buttons outside the valid range as determined by device_info->num_btns β the function has no effect and returns False. ngl, nothing happens, no notes. π
otherwise?? oh we're so back π¦ XkbSetDeviceButtonActions sends a request to the server to change the actions for the specified buttons and returns True. periodt. π₯
and now the dramatic part, the warnings, listen up π:
- if the actual request sent to the server involved illegal button numbers, a
BadValueprotocol error is generated. - if an invalid device identifier is specified in
device_info->device_spec, aBadKeyboardprotocol error results. - if the actual device specified in
device_info->device_specdoes not contain buttons and a request affecting buttons is made, aBadMatchprotocol error is generated.
lowkey these errors are giving "read the docs before you send the request" π
β¨ DIAGNOSTICS β¨
BadKeyboardβ the device specified was not a valid core or input extension device πBadMatchβ a compatible version of Xkb was not available in the server, or an argument has the correct type and range but is otherwise invalid πBadValueβ an argument is out of range π©
and that's the whole page bestie, you ate that π«Ά this iconic lil number comes to you from X Version 11, shipping with libX11 1.8.14 β go forth and set those button actions, mwah πβ¨πΈ
π¦ where this page comes from
- alpine 3.24: libx11-doc 1.8.14-r0 Β· X11
- arch rolling: libx11 1.8.14-1 Β· MIT AND X11
- nixos 26.05: libx11 1.8.14
- nixpkgs unstable: libx11 1.8.14
- Copyright (c) 1999, Oracle and/or its affiliates
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms