Kitty: Remapping command+h on macos doesn't work

Created on 10 Sep 2018  路  8Comments  路  Source: kovidgoyal/kitty

A mapping such as map super+h previous_window doesn't override the system's Hide shortcut, so pressing command+h hides Kitty. There's probably some way around this, not too sure what it is.

Most helpful comment

One way around this is to set up an app-specific keybinding in Preferences, which can override the default keybinding. I've moved the Hide kitty option to hyper+h, which lets me use command+h freely in kitty.conf:

image

Some other potential options: https://apple.stackexchange.com/questions/101754/os-x-disable-cmd-h-or-hide-app-command

All 8 comments

I dont know of a way around it. As far as I understand cocoa key processing (and I am no expert) those shortcuts are intercepted by the OS before reaching the application.

One way around this is to set up an app-specific keybinding in Preferences, which can override the default keybinding. I've moved the Hide kitty option to hyper+h, which lets me use command+h freely in kitty.conf:

image

Some other potential options: https://apple.stackexchange.com/questions/101754/os-x-disable-cmd-h-or-hide-app-command

iTerm manages to do it if you specify a custom key binding, which is why I said there's probably a way.

Well, I am happy to learn from iTerm if you can figure out what it does.

If you figure out how to do it, feel free to send a PR (assuming it requires jumping through only a reasonable number of hoops). In the meantime closing this issue.

It turns out mappings for command+h do work in fullscreen, where the hide option in the menu is disabled. I normally work in fullscreen so that's good enough for me. For non fullscreen mode, manually removing the key equivalent on the hide menu item when command+h is mapped might work.

Hmm too much work at least for me. Patches welcome.

I use this to map "Hide Kitty" to something untypable, and then use Cmd-h in kitty shortcuts:

  if ! defaults read net.kovidgoyal.kitty NSUserKeyEquivalents | grep -q "Hide kitty"; then
    defaults write net.kovidgoyal.kitty NSUserKeyEquivalents -dict-add "Hide kitty" '~^$\\U00a7'
  fi

I find having it as a shell command I can run in my dotfiles makes it easy enough that a hack in kitty wouldn't be necessary.

Was this page helpful?
0 / 5 - 0 ratings