LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 3631|回复: 3

让NumLock自动打开!

[复制链接]
发表于 2003-9-30 17:51:41 | 显示全部楼层 |阅读模式
方法一:KDE环境下:
KDE控制中心(Control Center) --> 外设(Peripherals) --> 键盘(Keyboard) -->KDE启动时NumLock的状态设置为打开

方法二:WindowMaker下:

  1. #include </usr/X11R6/include/X11/extensions/XTest.h>
  2. #include </usr/X11R6/include/X11/keysym.h>



  3. int main(void)
  4. {
  5.         Display* disp = XOpenDisplay(NULL);
  6.         if (disp == NULL) return 1;
  7.         XTestFakeKeyEvent(disp, XKeysymToKeycode(disp, XK_Num_Lock), True,
  8.         CurrentTime);
  9.         XTestFakeKeyEvent(disp, XKeysymToKeycode(disp, XK_Num_Lock), False,
  10.         CurrentTime );
  11.         XCloseDisplay(disp);
  12.         return 0;
  13. }
复制代码

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
发表于 2003-10-18 10:33:15 | 显示全部楼层
哈,不错,回去弄弄看看灵验不~~
发表于 2003-10-21 14:24:33 | 显示全部楼层
第三种方法不灵:(
 楼主| 发表于 2003-11-29 11:05: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 ).
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表