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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
04-03-2003, 05:34 PM
|
#1
|
|
Member
Registered: Mar 2003
Posts: 804
Rep:
|
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.
|
|
|
|
04-03-2003, 06:20 PM
|
#2
|
|
Member
Registered: Mar 2003
Posts: 804
Original Poster
Rep:
|
bah this shit doesnt work...anyone see what is wrong with dat script?
|
|
|
|
04-03-2003, 06:30 PM
|
#3
|
|
Member
Registered: Feb 2003
Distribution: Debian
Posts: 797
Rep:
|
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...
|
|
|
|
04-03-2003, 07:36 PM
|
#4
|
|
Member
Registered: Mar 2003
Posts: 804
Original Poster
Rep:
|
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?
|
|
|
|
04-03-2003, 07:56 PM
|
#5
|
|
Member
Registered: Feb 2003
Distribution: Debian
Posts: 797
Rep:
|
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.
|
|
|
|
04-03-2003, 07:59 PM
|
#6
|
|
Member
Registered: Mar 2003
Posts: 804
Original Poster
Rep:
|
**********FIGURED IT OUT***********************
Last edited by infamous41md; 04-03-2003 at 08:21 PM.
|
|
|
|
04-03-2003, 08:27 PM
|
#7
|
|
Member
Registered: Feb 2003
Distribution: Debian
Posts: 797
Rep:
|
Quote:
|
**********FIGURED IT OUT***********************
|
1. does it work?
2. what was the problem? (maybe someone will come by this thread...)
|
|
|
|
04-03-2003, 08:34 PM
|
#8
|
|
Member
Registered: Jan 2003
Posts: 167
Rep:
|
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.
|
|
|
|
04-04-2003, 01:03 AM
|
#9
|
|
Senior Member
Registered: Jan 2002
Distribution: Ubuntu, Debian
Posts: 1,055
Rep:
|
|
|
|
|
04-04-2003, 07:34 AM
|
#10
|
|
Senior Member
Registered: Jan 2003
Location: Kansas City, Missouri, USA
Distribution: Ubuntu
Posts: 1,040
Rep:
|
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....
|
|
|
|
02-11-2004, 12:28 PM
|
#11
|
|
Member
Registered: Oct 2003
Location: WA--USA
Distribution: Red Hat 9, Suse 10.2
Posts: 144
Rep:
|
PTBmilo,
Thanks for posting the code for the num lock utility. It works great!
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 03:58 PM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|