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
标签: