Skip to content

Instantly share code, notes, and snippets.

@kozo2
Last active August 29, 2015 14:00
Show Gist options
  • Save kozo2/301c860ae06572238935 to your computer and use it in GitHub Desktop.
Save kozo2/301c860ae06572238935 to your computer and use it in GitHub Desktop.
ubuntu trustyでiron-madenをinstall、使用するためのdocumentです

ubuntu trusty64 への iron-maiden のinstall

依存するもののinstall (debian package)

sudo apt-get install sbcl cl-quicklisp make gcc

依存するもののinstall (common-lisp)

cd /usr/share/cl-quicklisp
sbcl --load quicklisp.lisp

sbclのinteractive shellに入ったらquicklispを使うために下の1行を評価(入力してenterを押)してください

(quicklisp-quickstart:install)

quicklispがinstallされたら下の各行を評価してください

(ql:quickload :clx)
(ql:quickload :cl-ppcre)

installが終わったらC-dでsbclのinteractive shellから抜けてください

iron-maidenのinstall

# sourceをdownloadします。現在は限定公開の段階です
cd iron-maiden
make

makeが終わってiron-maidenというbinary fileができていたらbuild成功です。

iron-maidenの使用方法

sudo ./iron-maiden 設定file

設定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")
(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))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment