SuSE Linux: All versions
//numlock.c #include <X11/extensions/XTest.h> #include <X11/keysym.h> int main(void) { Display* disp = XOpenDisplay( NULL ); if( disp == NULL ) return 1; XTestFakeKeyEvent( disp, XKeysymToKeycode( disp, XK_Num_Lock), True, CurrentTime ); XTestFakeKeyEvent( disp, XKeysymToKeycode( disp, XK_Num_Lock), False, CurrentTime ); XCloseDisplay( disp ); return 0; }Create a file Numlock.c with the program code mentioned above and enter the command
gcc -I/usr/X11R6/include -L/usr/X11R6/lib -o setnumlock Numlock.c -lX11 -lXtstTo successfully invoke this command you need the C compiler(series d, package gcc) and the include files of the X libraries(package xdevel, series x). You will find a program called setnumlock in the current directory. You have to copy this file into the directory /usr/local/bin and make an entry in the file ~/.xinitrc.