+ -
当前位置:首页 → 问答吧 → 让NumLock自动打开!

让NumLock自动打开!

时间:2003-09-30

来源:互联网

方法一:KDE环境下:
KDE控制中心(Control Center) --> 外设(Peripherals) --> 键盘(Keyboard) -->KDE启动时NumLock的状态设置为打开

方法二:WindowMaker下:
代码:
#include </usr/X11R6/include/X11/extensions/XTest.h> 
#include </usr/X11R6/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; 
}
1) 保存上面的代码为 numlock.c
2).gcc -I/usr/X11R6/include -L/usr/X11R6/lib -o setnumlock numlock.c -lX11 -lXtst
3).编辑 .xinitrc 或者 .xsession 在里面加入如下内容
/usr/X11R6/bin/setnumlock

方法三:修改/etc/X11/XF86Config:
在Keyboard 段加入:
# Let the server do the NumLock processing. This should only be
# required when using pre-R6 clients
ServerNumLock

作者: Freebird   发布时间: 2003-09-30

哈,不错,回去弄弄看看灵验不~~

作者: malen   发布时间: 2003-10-18

第三种方法不灵:(

作者: malen   发布时间: 2003-10-21

Another way:Inatall the numlockx from ports.
#cd /usr/ports/x11/numlockx
#make install distclean

This little thingy allows you to start X with NumLock turned on ( which is a feature that a lot of people seem to miss and nobody really knew how to achieve this ).

作者: Freebird   发布时间: 2003-11-29