View Full Version : FAQ: Enabling 'NumLock' upon Boot/Entering X
vorte[x]
31st January 2004, 05:44 PM
Throw into rc.sysinit
[code:1]
for tty in /dev/tty[1-9]*; do
setleds -D +num < $tty
done
[/code:1]
Then for X, try putting this in .xinitrc
[code:1]
xset led 1
[/code:1]
redhat71
2nd February 2004, 06:56 AM
only "xset led 3" works for me, but it's not numlock, any idea?
vorte[x]
2nd February 2004, 07:00 PM
only "xset led 3" works for me, but it's not numlock, any idea?
I ran into that as well on my laptop, hence the reason I said 'try' ;) I'm not sure if xset is working properly on ANY hardware configuration! I'll let you know if I find something better.
Linz
7th February 2004, 05:08 PM
Found this on http://phuzz.org/archive.php?name=linux:
To enable NumLock in the console paste this code into rc.local or make a script for to put into /etc/init.d/:
[code:1]echo "Enabling NumLock..."
for tty in /dev/tty{1,2,3,4,5,6,7,8,9,10,11,12}; do
setleds -D +num < $tty
done[/code:1]
X windows is nice enough to turn this off again... so paste the following code into a file named xsetnumlock.c:
[code:1]#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;
}[/code:1]
Run this command to compile it:
[code:1]$ gcc -I/usr/X11R6/include -L/usr/X11R6/lib -o xsetnumlock xsetnumlock.c -lX11 -lXtst[/code:1]
Run xsetnumlock from ~/.Xclients (or any of its alternatives: .xsession, .xinitrc or whatever...)
Haven't restarted yet, but running the compiled xsetnumlock turns numlock on/off.
vorte[x]
7th February 2004, 08:53 PM
Excellent tip, I'll be sure to try it.
amazoneveryday
18th June 2004, 08:29 AM
it works pefectly, thank you. I put the executable in my ~/.kde/Autostart folder since I'm the only user on my box.
mpsii
18th June 2004, 08:33 AM
Is there not a numlock rpm? Or can someone make one for Fedora?
mandrake rpm (http://rpm.pbone.net/index.php3/stat/4/idpl/1087058/com/numlock-2.0-ipl9mdk.i586.rpm.html)
ewdi
18th June 2004, 06:36 PM
i think there is under contrib, let me search around for it
RuiP
22nd June 2004, 10:06 AM
I never find a numlockx for fedora and mandrakes version fails (of course) due to dependencies not satisfied... (maybe this one (http://www.tuxfinder.com/packages/searchdl.php?name=numlockx-1.0-1ark.i586.rpm&country=US)?... in case of despair )
but thereis a good how-to here (http://www.justlinux.com/nhf/Hardware/How_to_Get_the_NumLock_Key_to_Stay_On.html) and a link to tar.gz here (http://freshmeat.net/redir/numlockx/48161/url_tgz/numlockx-1.0.tar.gz).
I solved the beginnig-at-X problem with a muuuch easier way... I just run gnome-session-properties and at 'Startup Programs' Add a new entry, a simple 'numlockx' (I have to do it for all users... only two) works great!
april
26th June 2010, 04:13 AM
;4096']Throw into rc.sysinit
[code:1]
for tty in /dev/tty[1-9]*; do
setleds -D +num < $tty
done
[/code:1]
Then for X, try putting this in .xinitrc
[code:1]
xset led 1
[/code:1]
Be careful with this !!
I just spent 3 Hours trying to get these lines back out with a VI editor under rescue system being the only way
The syntax is wrong for Fedora 12
Hlingler
26th June 2010, 04:23 AM
You are correct: this thread is so old, and applies to a Fedora release(s) that is so that it's dangerous. Thread closed. Caveat Emptor.
V
vBulletin® v3.8.7, Copyright ©2000-2013, vBulletin Solutions, Inc.