Skip to content

Instantly share code, notes, and snippets.

@svallory
Created September 17, 2023 01:31
Show Gist options
  • Save svallory/0cc08750e5ae837adad3ee3dde3599c9 to your computer and use it in GitHub Desktop.
Save svallory/0cc08750e5ae837adad3ee3dde3599c9 to your computer and use it in GitHub Desktop.
Quake-style Hotkey Window for Wezterm
{
"title": "Quake-style Hotkey Window for Wezterm",
"rules": [
{
"description": "Launch/show Wezterm if it is not in foreground",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "escape",
"modifiers": {
"mandatory": ["control"]
}
},
"to": [
{
"shell_command": "open '/Applications/WezTerm.app'"
}
],
"conditions": [
{
"type": "frontmost_application_unless",
"bundle_identifiers": ["^com\\.github\\.wez\\.wezterm$"]
}
]
}
]
},
{
"description": "Minimize Wezterm if it is in foreground",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "escape",
"modifiers": {
"mandatory": ["control"]
}
},
"to": [
{
"key_code": "h",
"modifiers": ["command"]
}
],
"conditions": [
{
"type": "frontmost_application_if",
"bundle_identifiers": ["^com\\.github\\.wez\\.wezterm$"]
}
]
}
]
}
]
}
@ThePython10110
Copy link

What is this for? Wezterm uses Lua for configuration... and this is obviously JSON.

@svallory
Copy link
Author

What is this for? Wezterm uses Lua for configuration... and this is obviously JSON.

Oh… I wasn't expecting anyone to find this :)

This is a rule configuration for Karabiner

@xaviergmail
Copy link

Thanks!

@svallory
Copy link
Author

Thanks!

You are welcome! :)

@gkampolis
Copy link

Hi! I'm getting an error when trying to create a new Karabiner rule:

image

Any ideas why Karabiner thinks the manipulators field might be empty? Is this working with latest version of Karabiner for you (at the time of writing 15.0.0)? If not, have you moved to a different solution?

Many thanks in advance!

@SilfurSolargente
Copy link

Hi! I'm getting an error when trying to create a new Karabiner rule:

image

Any ideas why Karabiner thinks the manipulators field might be empty? Is this working with latest version of Karabiner for you (at the time of writing 15.0.0)? If not, have you moved to a different solution?

Many thanks in advance!

Hello, a bit late but the format used here is to define a set of rules, and outside of importing I haven't found how to make Karabiner take a whole set of rules from a json. If you take the two rules separately (from {description... until the } before the next {description...) it will work !

@surgiie
Copy link

surgiie commented Feb 4, 2025

Posting this script in case its useful to anyone who was also hunting for this functionality on linux :

https://github.com/surgiie/quake

quake wezterm

It has some extra features for playing mp3 sounds during focus/hide. (I like to play the sound effect where navi the fairy hides/comes out of link's shield from the legend of zelda ocarina of time 😅 )

@in0vik
Copy link

in0vik commented Mar 11, 2025

Here is toggle quake mode (§ button) for karabiner 15

{
    "manipulators": [
        {
            "conditions": [
                {
                    "bundle_identifiers": [
                        "^com\\.github\\.wez\\.wezterm$"
                    ],
                    "type": "frontmost_application_unless"
                }
            ],
            "description": "Launch/show WezTerm if it is not in foreground",
            "from": {
                "key_code": "non_us_backslash",
                "modifiers": { "mandatory": [] }
            },
            "to": [{ "shell_command": "open -a '/Applications/WezTerm.app'" }],
            "type": "basic"
        },
        {
            "conditions": [
                {
                    "bundle_identifiers": [
                        "^com\\.github\\.wez\\.wezterm$"
                    ],
                    "type": "frontmost_application_if"
                }
            ],
            "description": "Hide WezTerm if it is in foreground",
            "from": {
                "key_code": "non_us_backslash",
                "modifiers": { "mandatory": [] }
            },
            "to": [
                {
                    "key_code": "h",
                    "modifiers": ["command"]
                }
            ],
            "type": "basic"
        }
    ],
    "title": "Toggle WezTerm with non_US_backslash"
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment