LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Setting num lock to "on" at boot or log in. (https://www.linuxquestions.org/questions/linux-newbie-8/setting-num-lock-to-on-at-boot-or-log-in-333283/)

ToothlessRebel 06-13-2005 09:33 PM

Setting num lock to "on" at boot or log in.
 
Is there a way to mae it so that num lock isn't reset to off everytime the computer boots?
Using Slackware 9.1, KDE/KDM

synaptical 06-13-2005 09:54 PM

i've been using linux for a couple years, and i've never been able to get a gui to launch with numlock on. :p it's such a simple thing, you'd think someone would have an easy solution. but nothing i've tried has ever worked. search google and try the various methods, maybe you'll have better luck.

craigevil 06-13-2005 10:46 PM

In debian there is a small app called numlockx, that does just that. Turns the numlock on at login/boot.

If you are running KDE, you can open the Control Center>Peripherals>Keyboard>NumLock on KDE Startup and choose Turn on.

mdg 06-13-2005 11:31 PM

This is what works for me in Slack 10:

Code:

# This turns on numlock:
for tty in /dev/tty[1-6]; do
/usr/bin/setleds -D +num < $tty
done

Put it in the /etc/rc.d/rc.local file. Make sure rc.local is executable

heema 06-14-2005 03:00 AM

install numlockx and make sure it runs at startup

and here is a detailed howto ;)

http://startlinux.co.nz/articles/article_139.php

scuzzman 06-14-2005 06:19 AM

I have, in my ~/.xinitrc numlockx starting before my window manager - this does the job fine...

synaptical 06-14-2005 09:34 AM

numlockx doesn't work for me, either. :( maybe it's because i'm using xfce4 and it's not going through startx but startxfce4? after it didn't work in ~/.xinitrc, i put it in both ~/.xfce4/xinitrc and in the global xfce4 xinitrc, but still no numlock. it flashes for second while X is starting, then it turns off again, but it does that normally anyway. i've resigned myself to the fact that i'm just never going to have default numlock in linux. :p

bathory 06-14-2005 09:40 AM

numlockx didn't work for me either, so I found the following c program:
Code:

#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;
}

Compile it like this:
Code:

gcc -I/usr/X11R6/include -L/usr/X11R6/lib -o setnumlock setnumlock.c -lX11 -lXtst
and add the line:
Code:

/usr/X11R6/bin/setnumlock &
before invoking your wm.

Regards

rickh 05-30-2006 11:46 AM

An old reply to this often asked question by user: dracae (Hmmm. Haven't seen him lately.) Works great in Debian.
Quote:

install console-tools if not already, add
LEDS=+num
to /etc/console-tools/config
Edit: Oops I posted to this thread by accident. Guess I'll leave it. Might help somebody.


All times are GMT -5. The time now is 11:04 AM.