iron-maiden-cl is a powerful utility for keyboard customization. iron-maiden-cl supports
- remapping sticky keys
- remapping for each keyboard
sudo apt-get install git sbcl
git clone https://bitbucket.org/anekos/iron-maiden-cl.git
cd iron-maiden-cl
make
sudo ./iron-maiden THE_CONFIGURATION_FILE
(in-package :im-user)
; SandSのような動作を実現するmacro, 押しっぱなして他keyと組みあわせて使う場合、
; origianl-keyはmodifier-keyとして機能し、単独押下ではoriginal-keyは
; change-keyとして機能する。 original-keyとchange-keyが同じになるように設定
; したい場合はchange-keyをnilとし省略が可能
(defmacro x-and-y (original-key change-key modifier-key)
(with-gensyms (pressing any-key-pressed)
(eval `(defvar ,pressing nil))
(eval `(defvar ,any-key-pressed nil))
`(when-key-press
(if (= code ,original-key)
(equal-case
value
(imv:value-down
(setf ,pressing t)
(next-event))
(imv:value-repeat
(next-event))
(imv:value-up
(if ,any-key-pressed
(progn
(send-event im imv:ev-key ,modifier-key imv:value-up)
(setf ,any-key-pressed nil))
(progn
(let ((send-key (or ,change-key ,original-key)))
(send-event im imv:ev-key send-key imv:value-down)
(send-event im imv:ev-key send-key imv:value-up))))
(setf ,pressing nil)
(next-event)))
(when (and (= value imv:value-down) ,pressing (not ,any-key-pressed))
(send-event im imv:ev-key ,modifier-key imv:value-down)
(setf ,any-key-pressed t))))))
(iron-maiden
; iron-maidenを適用するkeyboardの定義が必要。
; :pathは/dev/input/by-path下にそれらしいものがあるはずです。
; 下記はLet's noteのある機種のkeyboardの:pathになります
(define-keyboard "lets"
:path #P"/dev/input/by-path/platform-i8042-serio-0-event-kbd")
; thinkpad-usb-keyboard
(define-keyboard "thinkpad-usb-keyboard"
:path #P"/dev/input/by-path/pci-0000:00:1d.2-usb-0:2:1.0-event-kbd")
(define-processor
(for-device "lets"
; SandSならぬCandSです
(x-and-y key-space nil key-leftctrl)
(change key-capslock key-enter)
(change key-muhenkan key-leftshift)
; 変換keyを右windows keyに。
; key-rightmetaなどのkey定義はsourceに含まれているconstants.txt中に記載されています
(change key-henkan key-rightmeta)
(change key-katakanahiragana key-rightalt))))