Skip to content

Instantly share code, notes, and snippets.

@kasecato
Created September 23, 2016 13:11
Show Gist options
  • Save kasecato/b262c40a1234f368ba17e27af44768df to your computer and use it in GitHub Desktop.
Save kasecato/b262c40a1234f368ba17e27af44768df to your computer and use it in GitHub Desktop.
Toggle input source - Shift-Space
import sys
import os
from keyhac import *
def configure(keymap):
# Global keymap which affects any windows
keymap_global = keymap.defineWindowKeymap()
# Select input source
selectRomaji = keymap.InputKeyCommand( "Ctrl-Shift-Semicolon" )
selectHiragana = keymap.InputKeyCommand( "Ctrl-Shift-J" )
keymap.ime_status = 0
def toggleInputSource():
if keymap.ime_status:
selectRomaji()
keymap.ime_status = 0
else:
selectHiragana()
keymap.ime_status = 1
# Moving active window by keyboard
if 1:
keymap_global[ "Shift-Space" ] = toggleInputSource
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment