Created
June 24, 2021 06:51
-
-
Save RauliL/c67bb7345d3964aa4b9158ccf1339c53 to your computer and use it in GitHub Desktop.
CLI utility for turning off capslock
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Kompilera med: cc TURN-OFF-CAPSLOCK.c -lX11 -o TURN-OFF-CAPSLOCK */ | |
#include <stdlib.h> | |
#include <stdio.h> | |
#include <X11/X.h> | |
#include <X11/XKBlib.h> | |
int main() | |
{ | |
Display* display; | |
Bool sent; | |
int err; | |
if (!(display = XOpenDisplay(NULL))) | |
{ | |
fprintf(stderr, "Couldn't open display\n"); | |
exit(EXIT_FAILURE); | |
} | |
if (!(sent = XkbLockModifiers(display, XkbUseCoreKbd, LockMask, 0))) | |
{ | |
fprintf(stderr, "Couldn't send LatchLockState\n"); | |
exit(EXIT_FAILURE); | |
} | |
if ((err = XCloseDisplay(display))) | |
{ | |
fprintf(stderr, "XCloseDisplay returned %d\n", err); | |
exit(EXIT_FAILURE); | |
} | |
return EXIT_SUCCESS; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment