[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [K12OSN] Num Lock

I wrote a how to about this a little while back.  I found that even though I had it set in my BIOS, when Linux started, it would turn it back off.  I used it on a desktop system.  It worked when I carried over to the K12LTSP server at school.  Check it out.

(sent as attachment cause I don't remeber the URL -- check out justlinux.org to find it)

On Tue, 28 Oct 2003 08:46:34 -1000 (HST)
Nakashima <pnakashi k12 hi us> wrote:

> Hi all,
> Has anyone figured out how to activate Num Lock by default?
> --
>  Peter Nakashima
>  Computer Teacher
>  Liholiho Elementary
> --
> _______________________________________________
> K12OSN mailing list
> K12OSN redhat com
> https://www.redhat.com/mailman/listinfo/k12osn
> For more info see <http://www.k12os.org>

  Associate yourself with men of good quality if you esteeem    
  your own reputattion; for 'tis better to be alone then in bad 
  company.        - George Washington, Rules of Civility        

How to get the NumLock to stay on

Written by "gentgeen" and verified by Loren (thanks ;-} )
contact at gentgeen NOSPAM linuxmail org (just remove the NOSPAM.


If you are like me, you use the number pad a lot. I found it very frustrating that every time I started my Linux box I would have to turn the NumLock on, then when I started X, I would have to turn it on again. And at least for my system, setting the NumLock on in the BIOS did not do the trick. This NHF will describe how to have the NumLock's on as the default setting in the console, and how to keep it on when you boot into X.

In Console mode

You will first have to edit your /etc/rc.d/rc.local (or whatever your local boot script is), so you will need root privileges. You will also need the setleds program. (I think it is pretty standard with all distributions.)

To find out if you have the setleds program, I would type setle at the console, then press TAB. This should finish the command for you. If nothing happens, press TAB twice, you may then get a list of all programs on your computer that start with setle. If you see setleds in the list, then your ready to go. If you still do not see setleds, then you need to install it.

Getting and Installing setleds

If you do have setleds, then you can skip this section, otherwise, continue. setleds is part of a larger package called "console-tools". Before you download, check your CDs, you probably already have it. If it is not part of your distribution, then go to http://lct.sourceforge.net and download a package. If you do not know how to install your package, check your documentation, or check out Josh's Linux Guide at http://jgo.local.net/LinuxGuide/ (NOTE: if you are fairly new to Linux, you may want to check out Josh's work, it has helped me a great deal.)

Editing the boot script

Now that you have setleds, you are ready to edit the rc.local file. You will have to be logged in as root, or at least use the su command. At the console, type pico /etc/rc.d/rc.local. You can replace pico with your favorite editor (like vi, elvis, joe, vim, emacs), if you have never used any of these, I would suggest pico since it has a menu at the bottom of the screen. Go to the end of the file and add:

        for t in 1 2 3 4 5 6 7 8
           setleds -D +num < /dev/tty$t > /dev/null

Now whenever you are in the console, Numlocks default will be on. That is, you have to press the NumLock key if you want to turn it off. Unfortunately, this does not carry over to the X server (at least in my X server). Read the next section for how to keep NumLocks on when the X server boots up.

In your X server

You would think that if you set the default setting to on in the console, that it would carry over to you X server, but NO. That would not be that easy. (Hopefully they will fix this in future versions) As of now the only way I know how to do this is with the help of a little program called numlockx. You can find numlockx at http://dforce.sh.cvut.cz/~seli/en/numlockx/ or I have also placed a copy at my website http://ourworld.cs.com/kvsmaster/files/numlockx-1.0.tar.gz.

Installing numlockx

If you have never installed from source, don't worry this one is simple. If you have installed from source before, then you can skip this section.

  1. Change to the directory where you saved the file, and extract the archive by typing:
    tar -zxvf numlockx-1.0.tar.gz
  2. Change into the new directory by typing:
    cd numlockx-1.0
  3. Install the program. I know there are different ways to do this, but to keep it simple, I use the following method:
    1. su to root if you are not already logged in as root.
    2. Type ./configure && make && make install
      You will see a lot of text fly by, but as long as you do not see the word ERROR, your ok.
  4. I usually check to see if things went O.K. by logging out as root (if you used su then just type exit), then type numloc and press TAB, if the command is completed, your OK.

Now that you have numlockx installed, you will have to include it into your X server start-up file. This should be a hidden file named .xinitrc in your HOME directory. You can check by doing a ls -a at your HOME directory. If you do not have one, then you can just create one.

If you have a .xinitrc file

If you already have one, then use pico (or what ever text editor from above), and just add the line numlockx on & somewhere before the line that calls your windows manager (probably the last line calls your windows manager).

If you do not have a .xinitrc file

User your favorite editor and create a file. I would do it like this:

  1. At your home directory type pico .xinitrc
  2. Copy to following into your file:
            # This is my X server start up file
            # Add any programs you want to have running when X starts here
            # Make sure they all end with a &
            numlockx on &
            # Now add your windows manager here.
            # I have included some examples, just remove the # in the beginning for yours
            # exec gnome-session
            # exec startkde
            # exec blackbox
  3. Save the file, and your ready to go.
Now, every time you start Linux or start your X server, your NumLock will already be on.

If you have any comments, corrections, or questions, please feel free to contact me at gentgeen NOSPAM linuxmail org (Just remove the NOSPAM.)

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]