You are not logged in.

#1 2005-04-24 08:07:54

droog
Member
Registered: 2004-11-18
Posts: 877

xsetnumlock

heres something i've been using and thought someone else might use. It's a little c program to set the number lock at boot.
copy this code and rename it xsetnumlock.c

#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;
}

I got the code from here http://portal.suse.com/sdb/en/2001/01/c … mlock.html


heres the pkgbuild, its the first one i've made like this and wasnt sure how to do it,  but it works for me.

pkgname=xsetnumlock
pkgver=1.0
pkgrel=1
pkgdesc="A program to set you number lock"
depends=('gcc')
source=(xsetnumlock.c)

build() {
mkdir -p $startdir/pkg/usr/bin
gcc -I/usr/X11R6/include -L/usr/X11R6/lib -o xsetnumlock 
         xsetnumlock.c -lX11 -lXtst
chown root:root xsetnumlock
cp $startdir/src/xsetnumlock $startdir/pkg/usr/bin
chmod 0755 xsetnumlock
}

Add "xsetnumlock &" to your ~/.xinitrc

Offline

#2 2005-04-24 09:17:40

Pierluigi
Member
Registered: 2004-04-10
Posts: 90
Website

Re: xsetnumlock

good, but...

[pigi@localhost ~]$ pacman -Ss numlockx
extra/numlockx 1.0-2
    numlockx is a simple program that turns on the numlock key while you are in
    X Windows

Offline

#3 2005-04-24 09:38:09

droog
Member
Registered: 2004-11-18
Posts: 877

Re: xsetnumlock

This program does the same thing and is 5000 times smaller than that kde one.  but i guess it doesnt really matter. 

i just posted it cause its such a small simple program, and useful for people like me that always forget to hit num lock.

Offline

#4 2005-04-24 21:47:23

shadowhand
Member
From: MN, USA
Registered: 2004-02-19
Posts: 1,142
Website

Re: xsetnumlock

numlockx isn't a KDE program....


·¬»· i am shadowhand, powered by webfaction

Offline

#5 2005-04-25 02:25:56

droog
Member
Registered: 2004-11-18
Posts: 877

Re: xsetnumlock

http://ktown.kde.org/~seli/numlockx/numlockx-1.0.tar.gz

Its a kde  url, and i've read somewhere else that it was from kde too. what i use is just the simplest solution i could find for what it does.

Offline

Board footer

Powered by FluxBB