set_leds(3)

๐Ÿ“ฆ version 4.4.3.1, in fedora 43, fedora 44

๐Ÿ’– set_leds โ€” a manual page bestie

okay so this is set_leds(3), straight out of the Allegro manual โ€” yes, that Allegro, the Allegro game programming library ๐Ÿ’… she's a classic and she's serving.


โœจ NAME โœจ

set_leds โ€” sets the state of the keyboard LED indicators. that's it, that's the job. Allegro game programming library, no cap ๐ŸŽ€


๐Ÿฆ‹ SYNOPSIS ๐Ÿฆ‹

#include <allegro.h>

void set_leds(int leds);

like, one include, one function, one int. we love a low-effort icon โญ


๐ŸŒธ DESCRIPTION ๐ŸŒธ

so basically, set_leds overrides the state of the keyboard LED indicators. yes, those little lights on your keyboard. the ones your gamer keyboard has like 47 of. she's taking the wheel ๐ŸŽฎ

the parameter you pass in is a bitmask, and it can hold any of these:

  • KB_SCROLOCK_FLAG โ€” scroll lock, the forgotten one ๐Ÿ˜ญ
  • KB_NUMLOCK_FLAG โ€” num lock, the diva
  • KB_CAPSLOCK_FLAG โ€” caps lock, the one that ruins your whole group chat message

or you can pass -1 to restore the default behavior. like a little "nvm bestie, carry on" ๐Ÿซถ

here's the example, verbatim, because we do not touch the code:

/* Cycle led indicators. */
set_leds(KB_SCROLOCK_FLAG);
rest(1000);
set_leds(KB_CAPSLOCK_FLAG);
rest(1000);
set_leds(KB_NUMLOCK_FLAG);
rest(1000);
set_leds(-1);

it's giving โœจkeyboard raveโœจ and honestly? obsessed.

โš ๏ธ okay bestie, real talk, this part matters โš ๏ธ note that the led behaviour cannot be guaranteed on some platforms. some leds might not react, or none at all. ๐Ÿ’€ so you shouldn't rely only on them to communicate information to the user, just in case it doesn't get through. fr fr, don't make the blinking lights your whole communication strategy ๐Ÿ™ˆ

๐ŸŒˆ SEE ALSO ๐ŸŒˆ

go read those too, they're friends of the family ๐Ÿงš


and that's the whole page, bestie!! this one came from the Allegro manual, version 4.4.3, and yeah โ€” it's the set_leds(3) page, so you already knew that ๐Ÿ’– tysm for reading, mwah ๐ŸŽ€โœจ๐Ÿ‘‘

๐Ÿ“ฆ where this page comes from