apache_conf config.py - Keyhac配置
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了apache_conf config.py - Keyhac配置相关的知识,希望对你有一定的参考价值。
#
# config.py -- Configuration file for Keyhac
#
# Author: Kyota Iino <k.iino@outlook.com>
#
import sys
import os
import datetime
import pyauto
from keyhac import *
def configure(keymap):
# Keyhac が認識する Emacs クラス名
emacs_classes = "Emacs"
# Emacs キーバインディングを反映しないクラス名
not_emacs_binding_exe = ("cmd.exe")
# フォーカス先が Emacs か
def is_emacs(window):
# Emacs バインディング適用外の EXE なら適用しない
if window.getClassName() in emacs_classes:
return True
return False
# ファーカス先が Emacs キーバインディング適用外のクラスか
def is_excluded_from_emacs_bindings(window):
if window.getProcessName() in not_emacs_binding_exe:
return True
return False
#
# Emacs Like Key Bindings 対象外かの判定
#
def is_emacs_bindings(window):
return not is_emacs(window) \
and not is_excluded_from_emacs_bindings(window)
#
# Replace
#
# 「変換」キーを仮想モディファイアに変更
keymap.replaceKey( 28, 999 )
keymap.defineModifier( 999, "User0" )
# 「無変換」キーを Alt キーに変更
keymap.replaceKey( 29, "LAlt" )
# 矢印キーを Shift に変換
#keymap.replaceKey( "Up", "RShift" )
#keymap.replaceKey( "Left", "RShift" )
#keymap.replaceKey( "Down", "RShift" )
# JIS配列準拠の日本語配列のみ
keymap.replaceKey( "BackSlash", "RShift")
#
# Global Keymap
#
keymap_global = keymap.defineWindowKeymap()
# 上段のキーバインディング
keymap_global[ "U0-Q" ] = "ESC"
keymap_global[ "U0-I" ] = "OpenBracket"
keymap_global[ "U0-O" ] = "CloseBracket"
keymap_global[ "U0-P" ] = "BackSlash"
keymap_global[ "U0-Shift-I" ] = "Shift-OpenBracket"
keymap_global[ "U0-Shift-O" ] = "Shift-CloseBracket"
keymap_global[ "U0-Shift-P" ] = "Shift-Yen"
keymap_global[ "U0-Atmark" ] = "Shift-Underscore" # HHKB JP だとこれでアンスコになる。
# 中央段のキーバインディング
keymap_global[ "U0-A" ] = "1"
keymap_global[ "U0-S" ] = "2"
keymap_global[ "U0-D" ] = "3"
keymap_global[ "U0-F" ] = "4"
keymap_global[ "U0-G" ] = "5"
keymap_global[ "U0-H" ] = "6"
keymap_global[ "U0-J" ] = "7"
keymap_global[ "U0-K" ] = "8"
keymap_global[ "U0-L" ] = "9"
keymap_global[ "U0-Semicolon" ] = "0"
keymap_global[ "U0-Colon" ] = "Minus"
keymap_global[ "U0-CloseBracket" ] = "Caret"
keymap_global[ "U0-Shift-A" ] = "Shift-1"
keymap_global[ "U0-Shift-S" ] = "Shift-2"
keymap_global[ "U0-Shift-D" ] = "Shift-3"
keymap_global[ "U0-Shift-F" ] = "Shift-4"
keymap_global[ "U0-Shift-G" ] = "Shift-5"
keymap_global[ "U0-Shift-H" ] = "Shift-6"
keymap_global[ "U0-Shift-J" ] = "Shift-7"
keymap_global[ "U0-Shift-K" ] = "Shift-8"
keymap_global[ "U0-Shift-L" ] = "Shift-9"
keymap_global[ "U0-Shift-Semicolon" ] = "Shift-0"
keymap_global[ "U0-Shift-Colon" ] = "Shift-Minus"
keymap_global[ "U0-Shift-CloseBracket" ] = "Shift-Caret"
# 下段のキーバインディグ
# Emacs で IME 変換確定時の挙動変更のため
keymap_global[ "Ctrl-M" ] = "Return"
#
# Emacs Like Binding Keymap
#
keymap_not_emacs = keymap.defineWindowKeymap( check_func = is_emacs_bindings )
keymap_not_emacs[ "Ctrl-H" ] = "Back"
keymap_not_emacs[ "Ctrl-D" ] = "Delete"
keymap_not_emacs[ "Ctrl-M" ] = "Return"
keymap_not_emacs[ "Ctrl-P" ] = "Up"
keymap_not_emacs[ "Ctrl-N" ] = "Down"
keymap_not_emacs[ "Ctrl-B" ] = "Left"
keymap_not_emacs[ "Ctrl-F" ] = "Right"
keymap_not_emacs[ "Ctrl-M" ] = "Return"
keymap_not_emacs[ "Ctrl-O" ] = "Return", "Left"
keymap_not_emacs[ "Ctrl-E" ] = "End"
keymap_not_emacs[ "Ctrl-A" ] = "Home"
keymap_not_emacs[ "Ctrl-K" ] = "D-Shift", "End", "C-x", "U-Shift"
keymap_not_emacs[ "Ctrl-Y" ] = "C-v"
keymap_not_emacs[ "Ctrl-T" ] = "D-Shift", "Right", "C-x", "U-Shift", "Left", "C-v"
以上是关于apache_conf config.py - Keyhac配置的主要内容,如果未能解决你的问题,请参考以下文章