-   Linux - Newbie (
-   -   Num Lock (

mtb 11-25-2002 02:49 PM

Num Lock
How can i automatically turn the num lock on to use the numeric keyboard without pressing all the times num lock?

Thanx in adv.

Blitzkrieg 11-25-2002 02:58 PM

Some BIOS have an option to do that

albean 11-25-2002 03:10 PM

If you use KDE you can set this setting in the control center.

Start control center
click Peripherals | Keyboard | Advanced Tab. Then click the "Turn on" radio button.

MasterC 11-25-2002 08:16 PM

What distro, and what window manager do you use?


born4linux 11-26-2002 12:20 AM

man setleds

u can add a command in your startup script (.bash_profile)

are u just in text mode? the setleds command should help u here. not sure how to do this in X. :D

peeples 11-26-2002 11:46 AM

You have to do two seperate things to get NumLock to work: the first for CommandLineInterface and the second for X. Both ways are outlined on my Webpage (click below) . And both ways are independent of which Window Manager/GUI you are using.


adam_boz 11-26-2002 07:02 PM

for the console, I put this file in a /etc/rc.d/rcsysinit.d file, but you can probably throw it in your /etc/profile like what was said before.

for tty in /dev/tty[1-9]*; do
setleds -D +num < $tty

I just found this one today on the lfs mailing list for turning on numlock when you start x:

use a text editor to create a file called setnumlock.c that has this in it:

#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);
return 0;

Then compile with:
gcc -I/usr/X11R6/include -L/usr/X11R6/lib -o setnumlock setnumlock.c \ -lX11 -lXtst

then you can move the setnumlock executable to any dir in you path (I put it in /usr/X11r6/bin), and place it in you ~/.xinitrc file

I hopt that helps

p.s.- Peebles... I didn't see a link to your web site :-(

peeples 11-26-2002 07:39 PM

adam_boz: It's the "www" button on the bottom of the reply :D

adam_boz 11-27-2002 12:39 AM

hehe... my bad.

looks good!
(especially the setnumlock method :-)

All times are GMT -5. The time now is 07:41 AM.