AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / ubuntu / 问题 / 6618
In Process
Gödel
Gödel
Asked: 2010-10-13 15:11:15 +0800 CST2010-10-13 15:11:15 +0800 CST 2010-10-13 15:11:15 +0800 CST

让修饰键充当 X 下的切换

  • 772

有没有办法让Shift,Ctrl和Alt键在 X 下表现为切换?我知道如何在 CLI 下做到这一点(例如,通过这样做),但在 X 下没有找到这样做的参考。

请注意,这不是关于粘滞键的问题,它可以通过辅助功能选项启用。

gnome keyboard gui xorg xkb
  • 3 3 个回答
  • 674 Views

3 个回答

  • Voted
  1. scottl
    2010-10-19T02:30:21+08:002010-10-19T02:30:21+08:00

    这是在 DE 级别 AFAIK 上实现的。KDE 可以选择锁定粘滞键:

    启用锁定粘滞键:

    如果您按下该Shift键两次然后按下该F键,计算机会将其解释为Shift+ F。现在,如果您键入 P,计算机会将其解释为字母 P ( Shift+ P)。要取消选择 Shift 键,请再次按下它。

    http://docs.kde.org/stable/en/kdebase-workspace/kcontrol/kcmaccess/index.html

    • 1
  2. sroecker
    2010-10-16T10:49:54+08:002010-10-16T10:49:54+08:00

    X11 中的键使用 xmodmap 重新映射,但 /usr/include/X11/keysymdef.h 中没有 Control_Lock

    如果您有几个键,则可以将 Control 映射到 ISO_Next_Group_Lock 之类的东西,并使用Control+定义该组中的键Key。

    我在这里找到了一些信息: https ://bbs.archlinux.org/viewtopic.php?id=75771

    • 0
  3. user.dz
    2015-02-19T15:30:07+08:002015-02-19T15:30:07+08:00

    这可以使用 XKB 兼容组件来实现

    1. 检查您正在使用的兼容性变体

      $ setxkbmap -v -query
      Trying to build keymap using the following components:
      keycodes:   evdev+aliases(qwerty)
      types:      complete
      compat:     complete
      symbols:    pc+us(altgr-intl)+us:2+inet(evdev)
      geometry:   pc(pc105)
      rules:      evdev
      model:      pc105
      layout:     us,us
      variant:    altgr-intl,
      
      $ more /usr/share/X11/xkb/compat/complete 
      default xkb_compatibility "complete"  {
          include "basic"
          augment "iso9995"
          augment "mousekeys"
          augment "accessx(full)"
          augment "misc"
          augment "xfree86"
          augment "level5"
          augment "caps(caps_lock)"
      };
      
    2. 修改misc文件,其中包含所需的修饰符解释

      sudo nano /usr/share/X11/xkb/compat/misc
      

      我已将Shift_L, Alt_L&Alt_R动作从SetModsto更改为LockMods, 添加了新Shift_R的 , Control_L&Control_R解释LockMods和评论//setMods.clearLocks(不确定是否需要)。这是完整的文件:

      default partial xkb_compatibility "misc"  {
      
          virtual_modifiers   Alt,Meta,Super,Hyper,ScrollLock;
      
          // Interpretations for some other useful keys
      
          interpret Terminate_Server {
              action = Terminate();
          };
      
          //setMods.clearLocks= True;
      
          // Sets the "Alt" virtual modifier
      
          interpret Alt_L+Any     {
              //useModMapMods= level1;
          virtualModifier= Alt;
          action = LockMods(modifiers=modMapMods);
          };
      
          interpret Alt_L {
          action = LockMods(modifiers=Alt);
          };
      
          interpret Alt_R+Any     {
              //useModMapMods= level1;
          virtualModifier= Alt;
          action = LockMods(modifiers=modMapMods);
          };
      
          interpret Alt_R {
          action = LockMods(modifiers=Alt);
          };
      
          // Sets the "Meta" virtual modifier
      
          interpret Meta_L+Any     {
      //        useModMapMods= level1;
          virtualModifier= Meta;
          action = SetMods(modifiers=modMapMods);
          };
      
          interpret Meta_L    {
          action = SetMods(modifiers=Meta);
          };
      
          interpret Meta_R+Any     {
              //useModMapMods= level1;
          virtualModifier= Meta;
          action = SetMods(modifiers=modMapMods);
          };
      
          interpret Meta_R    {
          action = SetMods(modifiers=Meta);
          };
      
          // Sets the "Super" virtual modifier
      
          interpret Super_L+Any     {
      //        useModMapMods= level1;
          virtualModifier= Super;
          action = SetMods(modifiers=modMapMods);
          };
      
          interpret Super_L   {
          action = SetMods(modifiers=Super);
          };
      
          interpret Super_R+Any     {
              //useModMapMods= level1;
          virtualModifier= Super;
          action = SetMods(modifiers=modMapMods);
          };
      
          interpret Super_R   {
          action = SetMods(modifiers=Super);
          };
      
          // Sets the "Hyper" virtual modifier
      
          interpret Hyper_L+Any     {
      //        useModMapMods= level1;
          virtualModifier= Hyper;
          action = SetMods(modifiers=modMapMods);
          };
      
          interpret Hyper_L   {
          action = SetMods(modifiers=Hyper);
          };
      
          interpret Hyper_R+Any     {
              //useModMapMods= level1;
          virtualModifier= Hyper;
          action = SetMods(modifiers=modMapMods);
          };
      
          interpret Hyper_R   {
          action = SetMods(modifiers=Hyper);
          };
      
          // Sets the "ScrollLock" virtual modifier and
          // makes it actually lock when pressed.  Sets
          // up a map for the scroll lock indicator.
          interpret Scroll_Lock+Any   {
          virtualModifier= ScrollLock;
          action = LockMods(modifiers=modMapMods);
          };
      
          include "ledscroll"
      
          include "misc(assign_shift_left_action)"
      };
      
      partial xkb_compatibility "assign_shift_left_action"  {
          // Because of the irrevertable modifier mapping in symbols/pc <LFSH> is 
          // getting bound to the Lock modifier when using 
          // symbols/shift(both_capslock), creating unwanted behaviour. 
          // This is a quirk, to circumvent the problem.
          interpret Shift_L {
              action = LockMods(modifiers = Shift);
          };
      
          interpret Shift_R {
              action = LockMods(modifiers = Shift);
          };
      
          interpret Control_L {
              action = LockMods(modifiers = Control);
          };
      
          interpret Control_R {
              action = LockMods(modifiers = Control);
          };
      
      };
      
    3. 编译更改并更新 initramfs 映像

      sudo dpkg-reconfigure xkb-data
      sudo update-initramfs -u -k all
      
    4. 重启

    参考:

    • Archlinux Wiki:X 键盘扩展
    • XKB 配置的不可靠指南
    • XKB 配置文件
    • 0

相关问题

  • 帮助让 Flash 播放器在第二个屏幕上工作?

  • 是否有适用于 IMAP 邮件帐户的 Gnome 小程序?

  • iptables 的图形用户界面?

  • 从共享 NFS /home 到完整的 LDAP 解决方案

  • 如果顶部面板中缺少会话小程序,如何注销?

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    如何安装 .run 文件?

    • 7 个回答
  • Marko Smith

    如何列出所有已安装的软件包

    • 24 个回答
  • Marko Smith

    如何获得 CPU 温度?

    • 21 个回答
  • Marko Smith

    无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗?

    • 25 个回答
  • Marko Smith

    如何使用命令行将用户添加为新的 sudoer?

    • 7 个回答
  • Marko Smith

    更改文件夹权限和所有权

    • 9 个回答
  • Marko Smith

    你如何重新启动Apache?

    • 13 个回答
  • Marko Smith

    如何卸载软件?

    • 11 个回答
  • Marko Smith

    如何删除 PPA?

    • 26 个回答
  • Martin Hope
    NES 如何启用或禁用服务? 2010-12-30 13:03:32 +0800 CST
  • Martin Hope
    Ivan 如何列出所有已安装的软件包 2010-12-17 18:08:49 +0800 CST
  • Martin Hope
    La Ode Adam Saputra 无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗? 2010-11-30 18:12:48 +0800 CST
  • Martin Hope
    Olivier Lalonde 如何在结束 ssh 会话后保持进程运行? 2010-10-22 04:09:13 +0800 CST
  • Martin Hope
    David B 如何使用命令行将用户添加为新的 sudoer? 2010-10-16 04:02:45 +0800 CST
  • Martin Hope
    Hans 如何删除旧内核版本以清理启动菜单? 2010-08-21 19:37:01 +0800 CST
  • Martin Hope
    David Barry 如何从命令行确定目录(文件夹)的总大小? 2010-08-06 10:20:23 +0800 CST
  • Martin Hope
    jfoucher “以下软件包已被保留:”为什么以及如何解决? 2010-08-01 13:59:22 +0800 CST
  • Martin Hope
    David Ashford 如何删除 PPA? 2010-07-30 01:09:42 +0800 CST

热门标签

10.10 10.04 gnome networking server command-line package-management software-recommendation sound xorg

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve