XkbGetIndicatorState(3)
π XkbGetIndicatorState(3) β aka the XKB FUNCTIONS girlies
okay so bestie, buckle up, we're diving into XkbGetIndicatorState from the XKB FUNCTIONS corner of the universe β¨ this is a libX11 situation and it's lowkey iconic.
πΈ NAME πΈ
XkbGetIndicatorState β literally just goes and gets you the current state of the keyboard indicators π that's it, that's the whole job, and she does it well.
β¨ SYNOPSIS β¨
Status XkbGetIndicatorState (Display *display, unsigned int device_spec,
unsigned int state_return);
copy that exactly, bestie, don't get creative with the types π
π¦ ARGUMENTS π¦
displayβ the connection to the X server, your little phone line to the mothership πdevice_specβ the device ID, or you can passXkbUseCoreKbdif you're feeling basic πstate_returnβ gets backfilled with a mask of the indicator state, so it comes back changed, like a glow-up but for a variable π«Ά
π DESCRIPTION π
okay so here's the tea: Xkb lets applications get info about indicators using two different methods, and they are not the same vibe at all.
Method one is giving core X implementation energy β you use a mask to specify the indicators. very old school, very "we've been doing it this way forever." π₯
Method two is the interop-friendly one, and it uses indicator names instead. this is the one you pick when you actually care about applications talking to each other, iykyk π
the correspondence between the indicator name and the bit position in masks is as follows: one of the parameters returned from XkbGetNamedIndicators is an index that is the bit position to use in any function call that requires a mask of indicator bits, as well as the indicator's index into the XkbIndicatorRec array of indicator maps. like, that index is your girl for basically everything mask-related π
so what does XkbGetIndicatorState actually do? she queries the display for the state of the indicators on the device specified by device_spec. and for each indicator that is "turned on" on the device, the associated bit is set in state_return. every single one. very thorough, we love a detail-oriented queen π
now the plot twist π β if a compatible version of the Xkb extension is not available in the server, XkbGetIndicatorState returns a BadMatch error. rude, honestly. but otherwise? it sends the request to the X server, places the state of the indicators into state_return, and returns Success. slay π
so like, the value reported by XkbGetIndicatorState is identical to the value reported by the core protocol. fr fr. no cap. same value, different font π
π DIAGNOSTICS π
BadMatchβ a compatible version of Xkb was not available in the server, or an argument has correct type and range, but is otherwise invalid. two very different crimes, same error card π
β SEE ALSO β
XkbGetNamedIndicators(3)β go read her too, she's the one handing out those indices π
and that's the whole page bestie, you ate that π β¨
this has been brought to you by X Version 11 and libX11 1.8.14 β go off, kings ππ«Ά
π¦ 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