How to get Numlock on by default in X ?

drharlan at pacbell.net drharlan at pacbell.net
Mon Nov 25 18:36:36 PST 2002


On 24 Nov, Joe Morris wrote:
---------- 
> Here is what I do.  Pop the following in a .c file:
> 
> #include <X11/extensions/XTest.h>
> #include <X11//keysym.h>
> 
> int main(){
>         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;
> }
> 
> Then compile with: 
> gcc -I/usr/X11R6/include -L/usr/X11R6/lib -o setnumlock setnumlock.c -lX11 
> -lXtst
> 
> Then execute the command in your ~/.xinitrc.  Works for me.
> Joe
> -- 

Thanks for the help.  It does indeed work as advertised.

-- 
Wayne
I'd rather be a free electron than a loose cannon.

-- 
Unsubscribe: send email to listar at linuxfromscratch.org
and put 'unsubscribe blfs-support' in the subject header of the message



More information about the blfs-support mailing list