LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 04-03-2003, 05:34 PM   #1
infamous41md
Member
 
Registered: Mar 2003
Posts: 804

Rep: Reputation: 30
Turning on NUM LOCK automatically at startup


This is super newb question, and not really of the utmost importance, but it is kind of annoying and maybe someone knows this, how do u set it so NUMLOCK is always on when u startup? BIOS takes care of that for windows but it doesnt seem to affect RH8.

aha i have figured it out:

Turn on NumLock automatically

Add the following lines to /etc/rc.d/rc.local:

echo -n "Turning on numlock ... "
for tty in /dev/tty[1-6] /dev/tty1[2]; do
setleds -D +num < $tty &
done
echo "done "

Last edited by infamous41md; 04-03-2003 at 05:39 PM.
 
Old 04-03-2003, 06:20 PM   #2
infamous41md
Member
 
Registered: Mar 2003
Posts: 804

Original Poster
Rep: Reputation: 30
bah this shit doesnt work...anyone see what is wrong with dat script?
 
Old 04-03-2003, 06:30 PM   #3
cuckoopint
Member
 
Registered: Feb 2003
Distribution: Debian
Posts: 797

Rep: Reputation: 30
Assuming you boot into X, you don't actually use /dev/tty[1-6]. Also, I don't think you need that second argument. basically:

echo -n "Turning on numlock ... "
for tty in /dev/tty[1-8]; do
setleds -D +num < $tty
done
echo "done "

I don't think you have to necessarily make it go in the background wither (ie. no '&'). I coud be wrong...
 
Old 04-03-2003, 07:36 PM   #4
infamous41md
Member
 
Registered: Mar 2003
Posts: 804

Original Poster
Rep: Reputation: 30
heh, now it turns on numlock at startup, but once i log on it goes off. LOL
is there a script that runs after login that i could stick that code into?
 
Old 04-03-2003, 07:56 PM   #5
cuckoopint
Member
 
Registered: Feb 2003
Distribution: Debian
Posts: 797

Rep: Reputation: 30
you could try using an ~/.xsession

something like:

setleds -D +num&
exec openbox

#assuming you run openbox. i think kde's executable is startkde, but I'm not sure. you can check that.

then when your X is started, either by 'startx' or by logging in, it will parse that file, run setleds (dont forget the &), and then start kde, or whatever.
 
Old 04-03-2003, 07:59 PM   #6
infamous41md
Member
 
Registered: Mar 2003
Posts: 804

Original Poster
Rep: Reputation: 30
**********FIGURED IT OUT***********************

Last edited by infamous41md; 04-03-2003 at 08:21 PM.
 
Old 04-03-2003, 08:27 PM   #7
cuckoopint
Member
 
Registered: Feb 2003
Distribution: Debian
Posts: 797

Rep: Reputation: 30
Quote:
**********FIGURED IT OUT***********************
1. does it work?
2. what was the problem? (maybe someone will come by this thread...)
 
Old 04-03-2003, 08:34 PM   #8
PTBmilo
Member
 
Registered: Jan 2003
Posts: 167

Rep: Reputation: 30
I was just about to post this when i saw that the problem was solved, but if people are curious, here's the way that I do it:

create a source file with this:
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;
}
then compile with:

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

Then run 'setnumlock' from the xinitrc file.
 
Old 04-04-2003, 01:03 AM   #9
macewan
Senior Member
 
Registered: Jan 2002
Distribution: Ubuntu, Debian
Posts: 1,055
Blog Entries: 1

Rep: Reputation: 45
http://www.deadmule.com/macewan/scre...ckx-1.0.tar.gz
 
Old 04-04-2003, 07:34 AM   #10
jonr
Senior Member
 
Registered: Jan 2003
Location: Kansas City, Missouri, USA
Distribution: Ubuntu
Posts: 1,040

Rep: Reputation: 47
Mandrake users--Mandrake 8.0 or 8.2 (or both?) offered a way to configure startup with NUMLOCK turned on, in one of the checkbox-type things you could work with. I've been unable to locate it in Mandrake 9.0 so far!

Seems like a fairly common thing for people to want, and I wish the default were NUMLOCK on. I can set NUMLOCK on in my machine's BIOS, but it gets changed again to "off" by Linux....
 
Old 02-11-2004, 12:28 PM   #11
andrewstr
Member
 
Registered: Oct 2003
Location: WA--USA
Distribution: Red Hat 9, Suse 10.2
Posts: 144

Rep: Reputation: 15
PTBmilo,

Thanks for posting the code for the num lock utility. It works great!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
NumLock in X pentalive Linux - General 1 06-10-2005 04:56 PM
NumLock bad_andy Slackware 1 01-27-2005 02:58 PM
Boot with numlock on? Possible? MillyFish Fedora 14 06-10-2004 08:05 AM
numlock bitterjack Linux - Newbie 4 10-02-2003 05:16 AM
Need Numlock help wjsulliv Linux - General 5 02-23-2002 11:56 AM


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

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration