V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
brucmao
V2EX  ›  macOS

Karabiner-Elements 不支持使用波浪键 ~ 作为修饰键吗

  •  
  •   brucmao · 289 天前 · 996 次点击
    这是一个创建于 289 天前的主题,其中的信息可能已经有所发展或是发生改变。
    {
      "title": "Map ~ + 3 to ctrl+3 in Browsers",
      "rules": [
        {
          "description": "Map ~ + 3 to ctrl+3 in Specific Browsers",
          "manipulators": [
            {
              "type": "basic",
              "from": {
                "key_code": "3",
                "modifiers": {
                  "mandatory": ["grave_accent_and_tilde"]
                }
              },
              "to": [
                {
                  "key_code": "3",
                  "modifiers": ["left_control"]
                }
              ],
              "conditions": [
                {
                  "type": "frontmost_application_if",
                  "bundle_identifiers": [
                    "^com\\.google\\.Chrome$",
                    "^com\\.vivaldi\\.Vivaldi$"
                  ]
                }
              ]
            }
          ]
        }
      ]
    }
    
    

    上面配置不生效,chatgpt 说不支持。 貌似这个程序也不能实现按 F1 输入 888888 这样的功能

    查了下 Hammerspoon 挺强大的,话说 win 下的 autohotkey 好用

    第 1 条附言  ·  288 天前

    感谢@fds, 最终配置

    {
      "title": "Vivaldi sessionbox Tilde+3 to Ctrl+3",
      "rules": [
        {
          "description": "Map Tilde+3 to Ctrl+3 in Vivaldi extension sessionbox",
          "manipulators": [
            {
              "type": "basic",
              "from": {
                "simultaneous": [
                  {
                    "key_code": "grave_accent_and_tilde"
                  },
                  {
                    "key_code": "3"
                  }
                ],
                "simultaneous_options": {
                  "key_down_order": "strict",
                  "to_after_key_up": [
                    {
                      "set_variable": {
                        "name": "sessionbox_g",
                        "value": 0
                      }
                    }
                  ]
                },
                "modifiers": {
                  "mandatory": [],
                  "optional": ["any"]
                }
              },
              "to": [
                {
                  "set_variable": {
                    "name": "sessionbox_g",
                    "value": 1
                  }
                },
                {
                  "key_code": "3",
                  "modifiers": ["left_control"]
                }
              ],
              "conditions": [
                {
                  "type": "frontmost_application_if",
                  "bundle_identifiers": [
                    "^com\\.google\\.Chrome$",
                    "^com\\.vivaldi\\.Vivaldi$"
                  ]
                }
              ],
              "parameters": {
                "basic.simultaneous_threshold_milliseconds": 500
              }
            }
          ]
        }
      ]
    }
    
    
    
    1 条回复    2024-02-27 20:23:30 +08:00
    fds
        1
    fds  
       289 天前   ❤️ 1
    想实现按住一个常规键,再按另一个常规键,可以参考里面的 Launcher Mode 例子。下面是按 g 和 t 调用 Todoist:
    ```
    {
    "type": "basic",
    "from": {
    "simultaneous": [
    {
    "key_code": "g"
    },
    {
    "key_code": "t"
    }
    ],
    "simultaneous_options": {
    "key_down_order": "strict",
    "key_up_order": "strict_inverse",
    "to_after_key_up": [
    {
    "set_variable": {
    "name": "launcher_g",
    "value": 0
    }
    }
    ]
    },
    "modifiers": {
    "mandatory": [],
    "optional": [
    "any"
    ]
    }
    },
    "to": [
    {
    "set_variable": {
    "name": "launcher_g",
    "value": 1
    }
    },
    {
    "shell_command": "open -a 'Todoist'"
    }
    ],
    "parameters": {
    "basic.simultaneous_threshold_milliseconds": 500
    }
    },
    ```
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   1000 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 22ms · UTC 18:48 · PVG 02:48 · LAX 10:48 · JFK 13:48
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.