LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
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 02-25-2004, 09:08 PM   #1
compu73rg33k
Member
 
Registered: Feb 2004
Distribution: Ubuntu
Posts: 316

Rep: Reputation: 30
having Number lock turn on


what file and where do I edit the file so that when I log on the number lock automatically goes on?
 
Old 02-25-2004, 09:09 PM   #2
DrOzz
Senior Member
 
Registered: May 2003
Location: Sydney, Nova Scotia, Canada
Distribution: slackware
Posts: 4,185

Rep: Reputation: 59
well never heard anything of the such ...
just press the button ? its right by your hands ...
 
Old 02-25-2004, 09:11 PM   #3
compu73rg33k
Member
 
Registered: Feb 2004
Distribution: Ubuntu
Posts: 316

Original Poster
Rep: Reputation: 30
yeah but I forget and I'm typing some numbers and DAMNIT forgot to turn it on!
 
Old 02-25-2004, 09:15 PM   #4
DrOzz
Senior Member
 
Registered: May 2003
Location: Sydney, Nova Scotia, Canada
Distribution: slackware
Posts: 4,185

Rep: Reputation: 59
well i don't know what to tell ya ..
i mean to me, that still really isn't much of an issue ...
when you see the numbers aren't outputting on the screen then you press the numlock button ..
put a post it note or something on your monitor stating:
"when computer is booting press numlock key"
and then it should stay on the remainder of your session at your computer....
 
Old 02-25-2004, 09:17 PM   #5
compu73rg33k
Member
 
Registered: Feb 2004
Distribution: Ubuntu
Posts: 316

Original Poster
Rep: Reputation: 30
I know but I would just lik,e to have it number lock
 
Old 02-25-2004, 09:40 PM   #6
DrOzz
Senior Member
 
Registered: May 2003
Location: Sydney, Nova Scotia, Canada
Distribution: slackware
Posts: 4,185

Rep: Reputation: 59
well who knows .. maybe there is a way of doing it ..
and maybe someone knows how to do something like this ...
to me i don't think there would be such a file that you could edit that could make this happen, but weirder things have happened
 
Old 02-25-2004, 09:42 PM   #7
Kristijan
Member
 
Registered: Sep 2003
Location: Melbourne, Australia
Distribution: NetBSD 3.0.1, Slackware 10.1
Posts: 394

Rep: Reputation: 30
I know that KDE does it, but that's if your booting into the GUI. Never heard of a way from CLI.
 
Old 02-25-2004, 09:50 PM   #8
compu73rg33k
Member
 
Registered: Feb 2004
Distribution: Ubuntu
Posts: 316

Original Poster
Rep: Reputation: 30
what about Gnome?
 
Old 02-25-2004, 10:06 PM   #9
Wynd
Member
 
Registered: Jul 2001
Distribution: Slackware 12
Posts: 511

Rep: Reputation: 32
For console, put this in /etc/rc.d/rc.local:
Code:
for tty in /dev/tty[1-6];do
    setleds -D +num < $tty
done
That will run at next boot.


For X, save this C code in a file called "setnumlock.c" and compile it with "gcc -o setnumlock setnumlock.c"
Code:
#include <X11/extensions/XTest.h>
#include <X11/keysym.h>

int main(int argc, char **argv)
{
  Display* d = XOpenDisplay(NULL);

  if (d == NULL)
    return(-1);
  XTestFakeKeyEvent(d,XKeysymToKeycode(d,XK_Num_Lock),True,CurrentTime);
  XTestFakeKeyEvent(d,XKeysymToKeycode(d,XK_Num_Lock),False,CurrentTime );
  XCloseDisplay(d);
  return(0);
}
Run the program it makes to turn it on/off in X. I put mine in /usr/local/bin and have it run in .xinitrc so it does it automatically when I start X.
 
Old 02-25-2004, 10:16 PM   #10
compu73rg33k
Member
 
Registered: Feb 2004
Distribution: Ubuntu
Posts: 316

Original Poster
Rep: Reputation: 30
bash-2.05b# gcc -o setnumlock setnumlock.c
/tmp/ccsdFYdj.o(.text+0x16): In function `main':
: undefined reference to `XOpenDisplay'
/tmp/ccsdFYdj.o(.text+0x3c): In function `main':
: undefined reference to `XKeysymToKeycode'
/tmp/ccsdFYdj.o(.text+0x4d): In function `main':
: undefined reference to `XTestFakeKeyEvent'
/tmp/ccsdFYdj.o(.text+0x61): In function `main':
: undefined reference to `XKeysymToKeycode'
/tmp/ccsdFYdj.o(.text+0x72): In function `main':
: undefined reference to `XTestFakeKeyEvent'
/tmp/ccsdFYdj.o(.text+0x80): In function `main':
: undefined reference to `XCloseDisplay'
collect2: ld returned 1 exit status

that's what I recieved lol

what do I put in the .xinitrc ?

Last edited by compu73rg33k; 02-25-2004 at 10:20 PM.
 
Old 02-27-2004, 03:48 AM   #11
babanetcom
LQ Newbie
 
Registered: Feb 2004
Location: South Tuscany, IT
Distribution: Kubuntu, LinuxMint, DSLinux
Posts: 8

Rep: Reputation: 0
same question:

what do I put in the .xinitrc ?
 
Old 02-27-2004, 12:51 PM   #12
slackist
Member
 
Registered: Feb 2004
Location: Phuket
Distribution: Slackware 14.1 and Slackware Arm
Posts: 459

Rep: Reputation: 40
perhaps man xset will help


chefmark =
 
Old 03-27-2004, 10:44 PM   #13
jeffreybluml
Member
 
Registered: Mar 2004
Location: Minnesota
Distribution: Fedora Core 1, Mandrake 10
Posts: 405

Rep: Reputation: 30
any resoltuion to this?
I tried and got the same error messages, with no "program" created.

I know KDE lets you set this option, but still haven't found an answer as to how to successfully get it in Gnome.

Anybody?
 
Old 03-27-2004, 11:30 PM   #14
jeffreybluml
Member
 
Registered: Mar 2004
Location: Minnesota
Distribution: Fedora Core 1, Mandrake 10
Posts: 405

Rep: Reputation: 30
Okay, got it working. For those intersted, here's what I had to do...

First, go to
http://www.justlinux.com/nhf/Hardwar...o_Stay_On.html
and download the numlockx file. follow his intsructions to compile and install (very simple, even for the total newbie). Now, when it comes to creating/editing the .xinitrc file, that part did not get it starting automatically for me. I had to, using Gnome, open the preferences->More Preferences-> Sessions manager, and on the startup programs tab, choose "add" and enter numlockx. Set the order for it to very high, I used 75, so it starts absolutely last. If you dont do this it hangs things and gives problems.

Reboot or Log out/in, and all should be well.

Good luck...
 
  


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
Number lock in KDE compu73rg33k Linux - Software 4 10-24-2005 08:56 AM
How to automaticly turn on the num- and F Lock in Fluxbox VisitorQ Linux - Hardware 2 12-03-2004 08:53 AM
Mandrake Middle mouse button and number lock Boffy Linux - Hardware 1 04-21-2004 07:49 AM
thinkpad howto turn off number keys rootyard Linux - Laptop and Netbook 0 04-13-2004 11:51 AM
number lock? whaase Linux - General 6 11-03-2002 04:21 AM


All times are GMT -5. The time now is 12:59 AM.

Main Menu
Advertisement
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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration