Skip to content

Instantly share code, notes, and snippets.

@kozo2
Last active August 29, 2015 14:21
Show Gist options
  • Select an option

  • Save kozo2/7db6375a195decd41ae1 to your computer and use it in GitHub Desktop.

Select an option

Save kozo2/7db6375a195decd41ae1 to your computer and use it in GitHub Desktop.
English readme for iron-maiden-cl

iron-maiden-cl

iron-maiden-cl is a powerful utility for keyboard customization. iron-maiden-cl supports

  • remapping sticky keys
  • remapping for each keyboard

Installation

Ubuntu Linux Desktop installation

sudo apt-get install git sbcl
git clone https://bitbucket.org/anekos/iron-maiden-cl.git
cd iron-maiden-cl
make

Running iron-maiden and the configuration example

How to use iron-maiden

sudo ./iron-maiden THE_CONFIGURATION_FILE

Configuration example (please save this as a file [for example, name this like rc.cl])

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