Numlock as standard?

Marcus Zingmark blackline at bodymodification.se
Mon Aug 15 19:55:05 UTC 2005


taharka skrev:

> Marcus Zingmark wrote:
>
>> taharka skrev:
>>
>>> Marcus Zingmark wrote:
>>>
>>>> How do I get Numlock to be on as standard in Fedora Core 4? Would 
>>>> like it for all users if possible.
>>>>
>>>> /// Marcus
>>>>
>>> If using Gnome, the following works for fc3 :-)
>>>
>>> GNOME Tips
>>> Numlock
>>>
>>> Some users like to have the numlock turned on automatically, 
>>> something that I don't think GNOME currently does. The solution is 
>>> to install a tiny binary that turns on the numlock for you, and have 
>>> GNOME run that at startup.
>>>
>>> You can install the numlock binary by downloading and installing the 
>>> following rpm:
>>> numlock-0.1-0.0.yjl.1.i386.rpm
>>>
>>> If you have configured yum to use my YJL Packages repository, you 
>>> can just (as root) run:
>>>
>>> yum install numlock
>>>
>>> Once numlock is installed, go to the Applications menu, select the 
>>> Preferences menu, select the More Preferences menu, and finally the 
>>> Sessions menu option.
>>>
>>> Select the Startup Items tab, and click on the Add button. You 
>>> should get a window like this:
>>>
>>> [Add Startup Program]
>>>
>>> Enter /usr/bin/numlock into the Startup Command field. You don't 
>>> really need to change the order, the default of 50 is fine. Click 
>>> the OK button, and you are done. Next time you log into GNOME it 
>>> will turn on the numlock for you.
>>>
>>> taharka
>>>
>>> Lexington, Kentucky U.S.A.
>>>
>> Oooh, this looks terrific. Follow up question then:
>>
>> How do I set up a startingprogram for all users? This guide only 
>> tells me how to start this program for each user...
>>
> Have a read here; http://linuxmafia.com/faq/Hardware/numlock.html the 
> following paragraph ;-)
>
> Because I use XDM, I just compiled
> the program, and then modified /etc/X11/xdm/Xsetup_0 to run the program,
> so numlock is on by default for everyone.
>
> taharka
>
> Lexington, Kentucky U.S.A.
>
Ok, just so I get this right, beacuse this is really out of my league, 
after installing numlock-0.1-0.0.yjl.1.i386.rpm I should enter:

//numlock.c
//compile using:
//gcc -I/usr/X11R6/include -L/usr/X11R6/lib -o setnumlock Numlock.c 
-lX11 -lXtst
#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;
}
//end numlock.c

into /etc/X11/xdm/Xsetup_0 - then everyone will have Numlock activated 
at startup?

The reason I'm double-checking is that I'm not sure I could fix things 
back if I do wrong :p

/// Marcus





More information about the fedora-list mailing list