V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
Distributions
Ubuntu
Fedora
CentOS
中文资源站
网易开源镜像站
thedevil7
V2EX  ›  Linux

Linux 下怎么样设置两把键盘不一样的布局?

  •  
  •   thedevil7 ·
    thedevil7 · 2012-05-14 15:49:48 +08:00 · 4313 次点击
    这是一个创建于 4370 天前的主题,其中的信息可能已经有所发展或是发生改变。
    笔记本是奇葩的松下 T5, 买的样垃圾, 所以是日式键盘的布局, 这个在 xorg.conf 设置了

    Option "XkbRules" "xorg"
    Option "XkbModel" "jp106"
    Option "XkbLayout" "jp"
    这样, 笔记本上的键盘就可以按照键盘上对应的符号输入了. 比如 7 的上面 jp 布局是 ' , 以及 l 旁边是分号, 而本应在分号上面的冒号则在分号旁边, 不用 Shift + 分号, 可以直接输入.

    现在买了一把键盘, 用 USB 外接, 也是一把奇葩, kbc 的 poker, 60% 键盘. 和笔记本键盘类似, 但是缺少功能键区(F1 ~ F12).
    我尝试在 xorg.conf 中添加如下设置, 但是对应的布局依然是 jp 布局.

    Section "InputDevice"
    Identifier "Keyboard1"
    Driver "kbd"
    Option "Dev Name" "USB Keyboard"
    Option "Dev Phys" "usb-0000*-1/input*"
    Option "XkbRules" "xorg"
    Option "XkbModel" "pc104"
    Option "XkbLayout" "us"
    EndSection

    附上 /proc/bus/imput/devices 中的相关信息
    ---------------------------------
    笔记本自带键盘.
    I: Bus=0011 Vendor=0001 Product=0001 Version=ab41
    N: Name="AT Translated Set 2 keyboard"
    P: Phys=isa0060/serio0/input0
    S: Sysfs=/devices/platform/i8042/serio0/input/input4
    U: Uniq=
    H: Handlers=sysrq kbd event4

    USB 的 Poker 键盘.
    I: Bus=0011 Vendor=0001 Product=0001 Version=ab41
    N: Name="AT Translated Set 2 keyboard"
    P: Phys=isa0060/serio0/input0
    S: Sysfs=/devices/platform/i8042/serio0/input/input4
    U: Uniq=
    H: Handlers=sysrq kbd event4
    ---------------------------------

    求解.
    21 条回复    1970-01-01 08:00:00 +08:00
    thedevil7
        1
    thedevil7  
    OP
       2012-05-14 15:55:45 +08:00
    poker 的信息贴错了, 又过了修改时间.

    I: Bus=0003 Vendor=04d9 Product=3113 Version=0110
    N: Name="USB Keyboard"
    P: Phys=usb-0000:00:1d.2-2/input0
    S: Sysfs=/devices/pci0000:00/0000:00:1d.2/usb4/4-2/4-2:1.0/input/input17
    U: Uniq=
    H: Handlers=sysrq kbd event7
    thedevil7
        2
    thedevil7  
    OP
       2012-05-14 16:13:30 +08:00
    发现问题所在, 有另一个设置文件里对所有键盘都设置了 jp 布局. 谢谢所有来看过帖子的人.
    ufo22940268
        3
    ufo22940268  
       2012-05-14 16:24:41 +08:00
    谢谢lz发贴
    18m
        4
    18m  
       2012-05-14 16:40:23 +08:00
    也许这个思路可以这样:
    创建一个快捷键,插入USB键盘时只需要每次执行一下就可以切换到相应的布局。
    或者你可以监听USB插入的事件,用脚本自动完成。
    来源:http://forums.bodhilinux.com/index.php?/topic/286-toggle-between-two-keyboard-layouts/
    参考例子:
    [Desktop Entry]
    Name=Keyboard-toggle
    GenericName=Keyboard-toggle
    Comment=Toggle between 2 layouts with Alt-Shift
    Encoding=UTF-8
    Exec=setxkbmap -option grp:switch,grp:alt_shift_toggle,grp_led:scroll us,ca
    Icon=
    Terminal=false
    Type=Application
    Categories=
    StartupNotify=false
    thedevil7
        5
    thedevil7  
    OP
       2012-05-14 17:36:44 +08:00
    @ufo22940268 这个感谢让我真是丈二和尚摸不着头脑阿, 请教为何感谢.
    thedevil7
        6
    thedevil7  
    OP
       2012-05-14 17:38:10 +08:00
    @18m 这个没看懂, 不过貌似 xorg.conf 里面可以设置两套布局, 而且可以用 setxkbmap 进行切换, arch wiki 的 xorg.conf 页面里面有.
    tokki
        7
    tokki  
       2012-05-14 18:12:05 +08:00
    果然是折腾帝-。- 看来当初我不折腾这机器是相当明智的 不过现在低端的本屏幕都是一坨屎 我基本上不能用黑白色浏览网站 对比度太差差劲了
    thedevil7
        8
    thedevil7  
    OP
       2012-05-14 19:41:16 +08:00
    @tokki 确实很折腾, 不过折腾帝的名号不敢当啊.
    萝卜青菜各有索爱嘛, 能够满足需求就可以了.
    ufo22940268
        9
    ufo22940268  
       2012-05-14 21:42:18 +08:00
    @thedevil7 不知道unix还可以这样玩。之前改个键盘布局都搞了好久。
    thedevil7
        10
    thedevil7  
    OP
       2012-05-14 21:55:55 +08:00
    @ufo22940268 需要我贴一份我的 xorg.conf 吗? Happy to help.
    ufo22940268
        11
    ufo22940268  
       2012-05-15 11:00:48 +08:00
    @thedevil7 不用了哦,我只是mark一下,暂时还用不上。poker好键盘。
    thedevil7
        12
    thedevil7  
    OP
       2012-05-15 11:04:09 +08:00
    @ufo22940268 确实不错, 只是我不太习惯青轴, 太吵. 可能红轴会比较适合我...
    ufo22940268
        13
    ufo22940268  
       2012-05-15 11:17:44 +08:00
    @thedevil7 我用了三年的茶轴。后来发现单输入速度过快的时候就手指会痛了。
    thedevil7
        14
    thedevil7  
    OP
       2012-05-15 11:32:14 +08:00
    @ufo22940268 额.. 因为压力克数太大吗? 有没有尝试过改弹簧?
    ufo22940268
        15
    ufo22940268  
       2012-05-15 12:11:58 +08:00
    不知道,就一个plum。换成hhkb了,就没问题了
    thedevil7
        16
    thedevil7  
    OP
       2012-05-15 12:33:44 +08:00
    @ufo22940268 有钱银昂... hhkb 是静电容键盘吧? 是吗?
    ufo22940268
        17
    ufo22940268  
       2012-05-15 12:42:41 +08:00
    @thedevil7 是的。
    thedevil7
        18
    thedevil7  
    OP
       2012-05-15 12:45:40 +08:00
    @ufo22940268 手感如何? 和机械比起来?
    ufo22940268
        19
    ufo22940268  
       2012-05-15 15:33:54 +08:00
    @thedevil7 这样子聊天真的没问题吗?
    键帽触感类肤质。按键的声音明显少很多。我也不知道应该怎么形容,总之我换了键盘之后再怎么打字手都不会痛了。而且键位一旦熟悉了,还是很爽的。
    halfbloodrock
        20
    halfbloodrock  
       2012-05-15 20:40:05 +08:00
    额。。。如果你有KDE的界面的话,在设置里是可以设置键盘布局的。
    thedevil7
        21
    thedevil7  
    OP
       2012-05-15 23:34:52 +08:00
    @halfbloodrock 额, KDE 在 Gentoo 上编译貌似要 1,2 天的时间, 我从来都是挑轻量的软件用的. 况且, 配置好 xorg.conf 无论什么桌面都适用.


    @ufo22940268 额, 不知道也, V2EX 没有私信... 想了想价格... 算了吧. 哈哈.
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2240 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 534ms · UTC 04:19 · PVG 12:19 · LAX 21:19 · JFK 00:19
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.