Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remapping command+h on macos doesn't work #948

Closed
tbodt opened this issue Sep 10, 2018 · 11 comments · Fixed by #5796
Closed

Remapping command+h on macos doesn't work #948

tbodt opened this issue Sep 10, 2018 · 11 comments · Fixed by #5796

Comments

@tbodt
Copy link
Contributor

tbodt commented Sep 10, 2018

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.

@kovidgoyal
Copy link
Owner

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.

@YellowKirby
Copy link

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

@tbodt
Copy link
Contributor Author

tbodt commented Sep 10, 2018

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

@kovidgoyal
Copy link
Owner

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

@kovidgoyal
Copy link
Owner

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.

@tbodt
Copy link
Contributor Author

tbodt commented Sep 12, 2018

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.

@kovidgoyal
Copy link
Owner

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

@gibfahn
Copy link
Contributor

gibfahn commented Sep 12, 2018

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.

@liouk
Copy link

liouk commented Apr 22, 2022

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:

That was a great suggestion, thanks! The same method though does not work for cmd+k for some reason :/ It seems that it's still not released, even if "Clear to Cursor Line" is remapped to something else. Any solution for this one?

@page-down
Copy link
Contributor

@liouk

Any shortcuts that exist in the default configuration can be configured directly in kitty.conf. There is no need for these workarounds.

https://sw.kovidgoyal.net/kitty/conf/#keyboard-shortcuts

For example, for cmd+k, you can bind to no_op if you want the key to be sent to the program in the window, or bind to any other action.

kitty -o "map cmd+k no_op" kitty +kitten show_key -m kitty

@liouk
Copy link

liouk commented Apr 23, 2022

@page-down you are right, I managed to get this to work. Simply reloading the kitty.conf wasn't enough, but restarting kitty did the trick. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants