LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Debian (https://www.linuxquestions.org/questions/debian-26/)
-   -   How can I make my debian turn NumLock on automatically? (https://www.linuxquestions.org/questions/debian-26/how-can-i-make-my-debian-turn-numlock-on-automatically-257973/)

LittlesnowLinux 11-22-2004 11:06 AM

How can I make my debian turn NumLock on automatically?
 
Every time,as I start up my debian, I must turn NumLock on myself.Though it was a little job,it still bother me very much.So I want to know,how can I make my debian turn it on automatically,as it start up?And edit what file?

Andrew Benton 11-22-2004 12:35 PM

If you use KDE there's a setting you can change somewhere http://www.linuxgazette.com/node/view/395 If you don't use KDE but you have a C compiler you can compile a small binary that will do the job. Copy and paste this into a text file and call it setnumlock.c
Code:

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

Then open a terminal and

gcc -I/usr/X11R6/include -L/usr/X11R6/lib -o setnumlock setnumlock.c -lX11 -lXtst

That will create a binary called setnumlock. Copy it somewhere convenient (in your $PATH?) To run it when you log in to Gnome run gnome-session-properties and enter setnumlock in the startup programs.

nedwardss 11-22-2004 12:47 PM

numlockx
 
there is a small program in apt called numlockx that has been working for me. just install it.

LittlesnowLinux 11-22-2004 10:07 PM

Thanks very much!!

LittlesnowLinux 11-25-2004 08:31 AM

I am sorry to bother you again, nedwardss.Because the program you recommened have been installed by me,But it doesn't work.
The problem is still the same.Every time I must turn it on by hand as the same.
How can you make it work?Can you tell me?

macondo 11-25-2004 10:10 AM

#apt-get install numlockx

afterwards a dialog pops up asking you if you want it to be activated, say 'yes' (default answer=.

OR

#dpkg-reconfigure numlockx

do as explained above.

utanja 11-25-2004 11:35 AM

Quote:

Originally posted by macondo
#apt-get install numlockx

afterwards a dialog pops up asking you if you want it to be activated, say 'yes' (default answer=.

OR

#dpkg-reconfigure numlockx

do as explained above.


works fine for me...:) :) :) :) :)

LittlesnowLinux 11-26-2004 06:25 AM

Oh,I see.Perhaps the former version of numlockx I downloaded is a crashed version.So it didn't pop up the dialog.Now I have changed my source.list.So it must be no problem.(Because I haven't restart my computer)

macondo 11-26-2004 06:40 AM

I can't remember if it exiist in Sarge, but for sure, it does in Sid.


All times are GMT -5. The time now is 02:57 AM.