Skip to content

Switch input layout (keyboard) from the command line for macOSX

License

Notifications You must be signed in to change notification settings

1dancook/kbswitch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

kbswitch

A keyboard switching program for the command line.

Code is from this stackoverflow question

Installation

  • requires xcode command line tools
  • run make
  • copy build/kbswitch to place in path

Usage

  • kbswitch list list all available inputs
  • kbswitch com.apple.keylayout.ABC for English (macos Ventura)
  • kbswitch com.apple.inputmethod.Kotoeri.RomajiTyping.Japanese for Japanese (macos Ventura)

Notes

There is an objective-c version kbswitch.m that can be compiled with clang -framework Carbon -framework Foundation filename.m -o filename. However, this doesn't necessarily work as is because it requires com.apple.keylayout prepended to the keyboard layout.

Switch to English keyboard in Vim

If you want to switch from (other language) to English when going from insert mode to normal mode in vim/neovim, add this to your config:

inoremap <ESC> <ESC>:execute 'silent! !kbswitch com.apple.keylayout.ABC'<CR>:echon ''<CR>

Note that the exectuble must be in your $PATH.

About

Switch input layout (keyboard) from the command line for macOSX

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published