LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   having Number lock turn on (https://www.linuxquestions.org/questions/linux-newbie-8/having-number-lock-turn-on-150549/)

compu73rg33k 02-25-2004 08:08 PM

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?

DrOzz 02-25-2004 08:09 PM

well never heard anything of the such ...
just press the button ? its right by your hands ...:confused: :confused:

compu73rg33k 02-25-2004 08:11 PM

yeah but I forget and I'm typing some numbers and DAMNIT forgot to turn it on!

DrOzz 02-25-2004 08:15 PM

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....

compu73rg33k 02-25-2004 08:17 PM

I know but I would just lik,e to have it number lock :)

DrOzz 02-25-2004 08:40 PM

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 ;)

Kristijan 02-25-2004 08:42 PM

I know that KDE does it, but that's if your booting into the GUI. Never heard of a way from CLI.

compu73rg33k 02-25-2004 08:50 PM

what about Gnome?

Wynd 02-25-2004 09:06 PM

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.

compu73rg33k 02-25-2004 09:16 PM

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 ?

babanetcom 02-27-2004 02:48 AM

same question:

what do I put in the .xinitrc ?
:confused:

slackist 02-27-2004 11:51 AM

perhaps man xset will help


chefmark = :newbie:

jeffreybluml 03-27-2004 09:44 PM

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?

jeffreybluml 03-27-2004 10:30 PM

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...


All times are GMT -5. The time now is 04:54 AM.