Skip to content
New issue

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

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

Already on GitHub? # to your account

Changing keymaps requires a restart #59

Closed
jboyens opened this issue Dec 13, 2018 · 8 comments
Closed

Changing keymaps requires a restart #59

jboyens opened this issue Dec 13, 2018 · 8 comments

Comments

@jboyens
Copy link

jboyens commented Dec 13, 2018

I use multiple keymaps (input sources) on my laptop. Dvorak when I'm on the internal keyboard and then US when I use my hardware Dvorak keyboard at the office.

Each time I switch between the different keymaps, I need to restart skhd in order for it to correctly get the new keymap and bind the right keys. If I don't restart, it holds the previous mapping so CMD-T is mapped to the action bound to CMD-K

My expectation would be that I could switch keymaps and not need to kill/restart the process.

@jboyens
Copy link
Author

jboyens commented Dec 13, 2018

Forgot to mention that this is on Mojave.

@koekeishiya
Copy link
Owner

koekeishiya commented Dec 13, 2018

So this is just due to a caching optimization done in skhd: https://github.com/koekeishiya/skhd/blob/master/src/locale.c#L88
Which is only called once, in the startup routine.

We'd need a way to track when a keymap switch occur (is there an API for this?).
I'd like to avoid having to call this every time we parse the config-file, but that may be the only approach if there is no public API available.

No ETA for now.

@jboyens
Copy link
Author

jboyens commented Dec 13, 2018

This seems like it might be a public API, but I'm no macOS developer: https://stackoverflow.com/a/26024628

@jboyens
Copy link
Author

jboyens commented Feb 13, 2019

I was able to fix this by using Hammerspoon's hs.keycodes.inputSourceChanged() and just running an hs.execute('pkill skhd')

The source for how they implement the watcher is here: Source

@koekeishiya
Copy link
Owner

Fixed on master.

@koekeishiya
Copy link
Owner

part of release 0.3.1. closing this.

@HyunggyuJang
Copy link

Is it possible to disable this feature? I use multiple languages daily, so I frequently switches between multiple input sources, but those layouts are all same. So I don't want skhd to reload config every time I switches windows, which might triggers input source switches, in turn, reloading skhd config.

@HyunggyuJang
Copy link

Ideally, it would be better to add an option for this feature, like the hotload option.

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

3 participants