hardwired
10/26/2016 - 8:00 AM

enthumble like keybind for Keyhac(Win)

import sys
import os
import datetime

import pyauto
from keyhac import *


def configure(keymap):

    # --------------------------------------------------------------------
    # Text editer setting for editting config.py file

    # Setting with program file path (Simple usage)
    if 1:
        keymap.editor = "notepad.exe"

    # Setting with callable object (Advanced usage)
    if 0:
        def editor(path):
            shellExecute( None, "notepad.exe", '"%s"'% path, "" )
        keymap.editor = editor

    # --------------------------------------------------------------------
    # Customizing the display

    # Font
    keymap.setFont( "MS Gothic", 12 )

    # Theme
    keymap.setTheme("black")

    # --------------------------------------------------------------------

    # Simple key replacement
    # keymap.replaceKey( "CapsLock", "LCtrl" )

    # User modifier key definition "Muhenkan"
    keymap.defineModifier( 29, "User0" )

    # Global keymap which affects any windows
    # enthumble like keybind

    if 1:
        keymap_global = keymap.defineWindowKeymap()

        # USER0-I/J/K/L : Move Cursor and backspace
        keymap_global[ "U0-I"  ] = "Up"
        keymap_global[ "U0-J" ] = "Left"
        keymap_global[ "U0-K"    ] = "Down"
        keymap_global[ "U0-L"  ] = "Right"

        keymap_global[ "U0-LS-I"  ] = "LS-Up"
        keymap_global[ "U0-LS-J" ] = "LS-Left"
        keymap_global[ "U0-LS-K"    ] = "LS-Down"
        keymap_global[ "U0-LS-L"  ] = "LS-Right"

        keymap_global[ "U0-S"  ] = "LC-S"
        keymap_global[ "U0-Z"  ] = "LC-Z"
        keymap_global[ "U0-A"  ] = "LC-A"

        keymap_global[ "U0-O"  ] = "Back"
        keymap_global[ "U0-Space"  ] = "Enter"
        keymap_global[ "U0-28"  ] = "Esc"

        keymap_global[ "O-29"  ] = "29"

        def minimize_window():
          wnd = keymap.getTopLevelWindow()
          if wnd and not wnd.isMinimized():
            wnd.minimize()

        keymap_global[ "U0-Atmark"  ] = minimize_window