diff --git a/.bin/karabiner-keymap-hud b/.bin/karabiner-keymap-hud index 51c7a27..34cf0fa 100755 --- a/.bin/karabiner-keymap-hud +++ b/.bin/karabiner-keymap-hud @@ -13,12 +13,17 @@ readonly PID_FILE="$STATE_DIR/daemon.pid" readonly CMD_FILE="$STATE_DIR/command" readonly LOG_FILE="$STATE_DIR/hud.log" readonly HIDUTIL="${KARABINER_HUD_HIDUTIL:-/usr/bin/hidutil}" +readonly BATTERY_SWIFT="${KARABINER_TORABO_BATTERY_SWIFT:-$DOTFILES_DIR/.config/karabiner/scripts/torabo-battery.swift}" +readonly BATTERY_BIN="$STATE_DIR/torabo-battery" +readonly BATTERY_JSON="$STATE_DIR/torabo-battery.json" +readonly BATTERY_LOCK="$STATE_DIR/torabo-battery.lock" usage() { cat <<'USAGE' Usage: karabiner-keymap-hud show|hide|status|start|stop f + b で使用するキー一覧を表示または非表示にします。 +Torabo 接続時は直近の電池残量も見出しに出します。 USAGE } @@ -66,19 +71,55 @@ start_daemon() { } } +# ビルドと取得を別プロセスで行い、取得結果を一度に置き換える。 +refresh_battery_async() { + ( + mkdir "$BATTERY_LOCK" 2>/dev/null || exit 0 + local binary_tmp="" output_tmp="" + trap 'rm -f -- "$binary_tmp" "$output_tmp"; rmdir "$BATTERY_LOCK"' EXIT + trap 'exit 1' HUP INT TERM + [[ -f "$BATTERY_SWIFT" ]] || exit 0 + if [[ ! -x "$BATTERY_BIN" || "$BATTERY_SWIFT" -nt "$BATTERY_BIN" ]]; then + binary_tmp="$(mktemp "$STATE_DIR/torabo-battery-bin.XXXXXX")" || exit 1 + /usr/bin/swiftc -module-cache-path "$STATE_DIR/swift-cache" -O "$BATTERY_SWIFT" -o "$binary_tmp" || exit 1 + mv -f "$binary_tmp" "$BATTERY_BIN" || exit 1 + fi + output_tmp="$(mktemp "$STATE_DIR/torabo-battery-data.XXXXXX")" || exit 1 + if "$BATTERY_BIN" >"$output_tmp"; then + mv -f "$output_tmp" "$BATTERY_JSON" + else + rm -f "$BATTERY_JSON" + fi + ) >"$LOG_FILE" 2>&1 & + disown || true +} + show_hud() { start_daemon - local display=show - if torabo_connected; then display='show torabo'; fi - printf '%s\n' "$display" >"$CMD_FILE" + local connection + connection="$(torabo_connection)" || connection="" + if [[ -z "$connection" ]]; then + printf 'show\n' >"$CMD_FILE" + return + fi + printf 'show torabo\n' >"$CMD_FILE" + if [[ "$connection" == zmk-ble ]]; then + refresh_battery_async + fi } -torabo_connected() { +torabo_connection() { local devices # USB と Bluetooth で共通の機器番号を使い、トラックボールだけの項目は数えない。 devices="$("$HIDUTIL" list --matching '{"VendorID":65261,"ProductID":48301,"PrimaryUsagePage":1,"PrimaryUsage":6}' 2>/dev/null)" || return 1 - /usr/bin/awk 'tolower($1) == "0xfeed" && tolower($2) == "0xbcad" && $4 == "1" && $5 == "6" { found = 1 } END { exit !found }' <<<"$devices" + /usr/bin/awk ' + tolower($1) == "0xfeed" && tolower($2) == "0xbcad" && $4 == "1" && $5 == "6" { + found = 1 + if ($7 == "Bluetooth" && tolower($0) ~ / torabo-tsuki s([[:space:]]|$)/) zmk_ble = 1 + } + END { if (found) print (zmk_ble ? "zmk-ble" : "torabo") } + ' <<<"$devices" } hide_hud() { diff --git a/.config/karabiner/assets/complex_modifications/f_hjkl_arrows.json b/.config/karabiner/assets/complex_modifications/f_hjkl_arrows.json index 4555047..6af9d25 100644 --- a/.config/karabiner/assets/complex_modifications/f_hjkl_arrows.json +++ b/.config/karabiner/assets/complex_modifications/f_hjkl_arrows.json @@ -2,98 +2,62 @@ "title": "f layer + d number pad + v punctuation + 英数/かな/space tap-hold", "rules": [ { - "description": "Torabo-tsuki (S) の f 長押し中に b を押してキー一覧を表示する", - "manipulators": [ - { - "type": "basic", - "from": { - "key_code": "f24", - "modifiers": { - "optional": [ - "any" - ] - } - }, - "conditions": [ - { - "type": "device_if", - "identifiers": [ - { - "vendor_id": 65261, - "product_id": 48301, - "is_keyboard": true - } - ] - } - ], - "to": [ - { - "shell_command": "/bin/bash -lc '$HOME/.bin/karabiner-keymap-hud show'" - } - ], - "to_after_key_up": [ - { - "shell_command": "/bin/bash -lc '$HOME/.bin/karabiner-keymap-hud hide'" - } - ] - } - ] - }, - { - "description": "f layer; f+n=ABC f+m=あいう; f+b=HUD; 英数 tap=Enter hold=⌘; f↔英数 either order +a = app switcher; space hold=Shift", + "description": "Torabo-tsuki (S) の f 長押し中に b を押してキー一覧を表示する", "manipulators": [ { "type": "basic", "from": { - "key_code": "f", + "key_code": "f24", "modifiers": { - "mandatory": [ - "command" - ], "optional": [ "any" ] } }, - "to": [ - { - "set_variable": { - "name": "f_cmd_layer", - "value": true, - "key_up_value": false - } - }, + "conditions": [ { - "set_variable": { - "name": "f_held", - "value": true, - "key_up_value": false - } + "type": "device_if", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] } ], - "to_if_alone": [ + "to": [ { - "key_code": "f", - "modifiers": [ - "left_command" - ] + "shell_command": "/bin/bash -lc '$HOME/.bin/karabiner-keymap-hud show'" } ], - "parameters": { - "basic.to_if_alone_timeout_milliseconds": 200 - } - }, + "to_after_key_up": [ + { + "shell_command": "/bin/bash -lc '$HOME/.bin/karabiner-keymap-hud hide'" + } + ] + } + ] + }, + { + "description": "Torabo の F1–F12 を macOS の設定に合わせて標準ファンクションキーとして送る", + "manipulators": [ { "type": "basic", "conditions": [ { - "type": "variable_if", - "name": "eisuu_cmd", - "value": true + "type": "device_if", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] } ], "from": { - "key_code": "f", + "key_code": "f1", "modifiers": { "optional": [ "any" @@ -102,43 +66,46 @@ }, "to": [ { - "set_variable": { - "name": "f_cmd_layer", - "value": true, - "key_up_value": false - } + "key_code": "f1", + "conditions": [ + { + "type": "variable_if", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] }, { - "set_variable": { - "name": "f_held", - "value": true, - "key_up_value": false - } - } - ], - "to_if_alone": [ - { - "key_code": "f", + "key_code": "f1", "modifiers": [ - "left_command" + "fn" + ], + "conditions": [ + { + "type": "variable_unless", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } ] } - ], - "parameters": { - "basic.to_if_alone_timeout_milliseconds": 200 - } + ] }, { "type": "basic", "conditions": [ { - "type": "variable_if", - "name": "f_cmd_layer", - "value": true + "type": "device_if", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] } ], "from": { - "key_code": "h", + "key_code": "f2", "modifiers": { "optional": [ "any" @@ -147,7 +114,27 @@ }, "to": [ { - "key_code": "left_arrow" + "key_code": "f2", + "conditions": [ + { + "type": "variable_if", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] + }, + { + "key_code": "f2", + "modifiers": [ + "fn" + ], + "conditions": [ + { + "type": "variable_unless", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] } ] }, @@ -155,13 +142,18 @@ "type": "basic", "conditions": [ { - "type": "variable_if", - "name": "f_cmd_layer", - "value": true + "type": "device_if", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] } ], "from": { - "key_code": "j", + "key_code": "f3", "modifiers": { "optional": [ "any" @@ -170,7 +162,27 @@ }, "to": [ { - "key_code": "down_arrow" + "key_code": "f3", + "conditions": [ + { + "type": "variable_if", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] + }, + { + "key_code": "f3", + "modifiers": [ + "fn" + ], + "conditions": [ + { + "type": "variable_unless", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] } ] }, @@ -178,13 +190,18 @@ "type": "basic", "conditions": [ { - "type": "variable_if", - "name": "f_cmd_layer", - "value": true + "type": "device_if", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] } ], "from": { - "key_code": "k", + "key_code": "f4", "modifiers": { "optional": [ "any" @@ -193,7 +210,27 @@ }, "to": [ { - "key_code": "up_arrow" + "key_code": "f4", + "conditions": [ + { + "type": "variable_if", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] + }, + { + "key_code": "f4", + "modifiers": [ + "fn" + ], + "conditions": [ + { + "type": "variable_unless", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] } ] }, @@ -201,13 +238,18 @@ "type": "basic", "conditions": [ { - "type": "variable_if", - "name": "f_cmd_layer", - "value": true + "type": "device_if", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] } ], "from": { - "key_code": "l", + "key_code": "f5", "modifiers": { "optional": [ "any" @@ -216,7 +258,27 @@ }, "to": [ { - "key_code": "right_arrow" + "key_code": "f5", + "conditions": [ + { + "type": "variable_if", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] + }, + { + "key_code": "f5", + "modifiers": [ + "fn" + ], + "conditions": [ + { + "type": "variable_unless", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] } ] }, @@ -224,18 +286,18 @@ "type": "basic", "conditions": [ { - "type": "variable_if", - "name": "f_held", - "value": true - }, - { - "type": "variable_if", - "name": "eisuu_cmd", - "value": true + "type": "device_if", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] } ], "from": { - "key_code": "a", + "key_code": "f6", "modifiers": { "optional": [ "any" @@ -244,9 +306,26 @@ }, "to": [ { - "key_code": "tab", + "key_code": "f6", + "conditions": [ + { + "type": "variable_if", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] + }, + { + "key_code": "f6", "modifiers": [ - "left_command" + "fn" + ], + "conditions": [ + { + "type": "variable_unless", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } ] } ] @@ -255,18 +334,18 @@ "type": "basic", "conditions": [ { - "type": "variable_if", - "name": "f_cmd_layer", - "value": true - }, - { - "type": "variable_if", - "name": "space_shift", - "value": true + "type": "device_if", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] } ], "from": { - "key_code": "a", + "key_code": "f7", "modifiers": { "optional": [ "any" @@ -275,10 +354,26 @@ }, "to": [ { - "key_code": "tab", + "key_code": "f7", + "conditions": [ + { + "type": "variable_if", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] + }, + { + "key_code": "f7", "modifiers": [ - "left_command", - "left_shift" + "fn" + ], + "conditions": [ + { + "type": "variable_unless", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } ] } ] @@ -287,13 +382,18 @@ "type": "basic", "conditions": [ { - "type": "variable_if", - "name": "f_cmd_layer", - "value": true + "type": "device_if", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] } ], "from": { - "key_code": "a", + "key_code": "f8", "modifiers": { "optional": [ "any" @@ -302,32 +402,47 @@ }, "to": [ { - "key_code": "tab", + "key_code": "f8", + "conditions": [ + { + "type": "variable_if", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] + }, + { + "key_code": "f8", "modifiers": [ - "left_command" + "fn" + ], + "conditions": [ + { + "type": "variable_unless", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } ] } ] }, { "type": "basic", + "conditions": [ + { + "type": "device_if", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + } + ], "from": { - "simultaneous": [ - { - "key_code": "f" - }, - { - "key_code": "h" - } - ], - "simultaneous_options": { - "key_down_order": "strict", - "key_up_when": "all" - }, + "key_code": "f9", "modifiers": { - "mandatory": [ - "command" - ], "optional": [ "any" ] @@ -335,21 +450,3463 @@ }, "to": [ { - "key_code": "left_arrow" + "key_code": "f9", + "conditions": [ + { + "type": "variable_if", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] + }, + { + "key_code": "f9", + "modifiers": [ + "fn" + ], + "conditions": [ + { + "type": "variable_unless", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] } - ], - "parameters": { - "basic.simultaneous_threshold_milliseconds": 500 - } + ] }, { "type": "basic", - "from": { - "simultaneous": [ - { - "key_code": "f" - }, - { + "conditions": [ + { + "type": "device_if", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + } + ], + "from": { + "key_code": "f10", + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "key_code": "f10", + "conditions": [ + { + "type": "variable_if", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] + }, + { + "key_code": "f10", + "modifiers": [ + "fn" + ], + "conditions": [ + { + "type": "variable_unless", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] + } + ] + }, + { + "type": "basic", + "conditions": [ + { + "type": "device_if", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + } + ], + "from": { + "key_code": "f11", + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "key_code": "f11", + "conditions": [ + { + "type": "variable_if", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] + }, + { + "key_code": "f11", + "modifiers": [ + "fn" + ], + "conditions": [ + { + "type": "variable_unless", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] + } + ] + }, + { + "type": "basic", + "conditions": [ + { + "type": "device_if", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + } + ], + "from": { + "key_code": "f12", + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "key_code": "f12", + "conditions": [ + { + "type": "variable_if", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] + }, + { + "key_code": "f12", + "modifiers": [ + "fn" + ], + "conditions": [ + { + "type": "variable_unless", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] + } + ] + } + ] + }, + { + "description": "Torabo 以外で右 Shift の左隣のキーをハイフンにする", + "manipulators": [ + { + "type": "basic", + "from": { + "key_code": "international1", + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "key_code": "hyphen" + } + ], + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + } + ] + } + ] + }, + { + "description": "f layer (=Torabo L2); hjkl arrows; q Esc; e/u ⌫; p ⌦; a/s Tab; d ⌘; f+n=ABC f+m=あいう; f+b=HUD; 英数 tap=Enter hold=⌘; space hold=Shift", + "manipulators": [ + { + "type": "basic", + "from": { + "key_code": "f", + "modifiers": { + "mandatory": [ + "command" + ], + "optional": [ + "any" + ] + } + }, + "to": [ + { + "set_variable": { + "name": "f_cmd_layer", + "value": true, + "key_up_value": false + } + }, + { + "set_variable": { + "name": "f_held", + "value": true, + "key_up_value": false + } + } + ], + "to_if_alone": [ + { + "key_code": "f", + "modifiers": [ + "left_command" + ] + } + ], + "parameters": { + "basic.to_if_alone_timeout_milliseconds": 200 + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + } + ] + }, + { + "type": "basic", + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_if", + "name": "eisuu_cmd", + "value": true + } + ], + "from": { + "key_code": "f", + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "set_variable": { + "name": "f_cmd_layer", + "value": true, + "key_up_value": false + } + }, + { + "set_variable": { + "name": "f_held", + "value": true, + "key_up_value": false + } + } + ], + "to_if_alone": [ + { + "key_code": "f", + "modifiers": [ + "left_command" + ] + } + ], + "parameters": { + "basic.to_if_alone_timeout_milliseconds": 200 + } + }, + { + "type": "basic", + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_if", + "name": "f_cmd_layer", + "value": true + } + ], + "from": { + "key_code": "h", + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "key_code": "left_arrow" + } + ] + }, + { + "type": "basic", + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_if", + "name": "f_cmd_layer", + "value": true + } + ], + "from": { + "key_code": "j", + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "key_code": "down_arrow" + } + ] + }, + { + "type": "basic", + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_if", + "name": "f_cmd_layer", + "value": true + } + ], + "from": { + "key_code": "k", + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "key_code": "up_arrow" + } + ] + }, + { + "type": "basic", + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_if", + "name": "f_cmd_layer", + "value": true + } + ], + "from": { + "key_code": "l", + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "key_code": "right_arrow" + } + ] + }, + { + "type": "basic", + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_if", + "name": "f_held", + "value": true + }, + { + "type": "variable_if", + "name": "eisuu_cmd", + "value": true + } + ], + "from": { + "key_code": "a", + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "key_code": "tab", + "modifiers": [ + "left_command" + ] + } + ] + }, + { + "type": "basic", + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_if", + "name": "f_cmd_layer", + "value": true + }, + { + "type": "variable_if", + "name": "space_shift", + "value": true + } + ], + "from": { + "key_code": "a", + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "key_code": "tab", + "modifiers": [ + "left_command", + "left_shift" + ] + } + ] + }, + { + "type": "basic", + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_if", + "name": "f_cmd_layer", + "value": true + } + ], + "from": { + "key_code": "a", + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "key_code": "tab", + "modifiers": [ + "left_command" + ] + } + ] + }, + { + "type": "basic", + "from": { + "simultaneous": [ + { + "key_code": "f" + }, + { + "key_code": "h" + } + ], + "simultaneous_options": { + "key_down_order": "strict", + "key_up_when": "all" + }, + "modifiers": { + "mandatory": [ + "command" + ], + "optional": [ + "any" + ] + } + }, + "to": [ + { + "key_code": "left_arrow" + } + ], + "parameters": { + "basic.simultaneous_threshold_milliseconds": 500 + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + } + ] + }, + { + "type": "basic", + "from": { + "simultaneous": [ + { + "key_code": "f" + }, + { + "key_code": "j" + } + ], + "simultaneous_options": { + "key_down_order": "strict", + "key_up_when": "all" + }, + "modifiers": { + "mandatory": [ + "command" + ], + "optional": [ + "any" + ] + } + }, + "to": [ + { + "key_code": "down_arrow" + } + ], + "parameters": { + "basic.simultaneous_threshold_milliseconds": 500 + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + } + ] + }, + { + "type": "basic", + "from": { + "simultaneous": [ + { + "key_code": "f" + }, + { + "key_code": "k" + } + ], + "simultaneous_options": { + "key_down_order": "strict", + "key_up_when": "all" + }, + "modifiers": { + "mandatory": [ + "command" + ], + "optional": [ + "any" + ] + } + }, + "to": [ + { + "key_code": "up_arrow" + } + ], + "parameters": { + "basic.simultaneous_threshold_milliseconds": 500 + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + } + ] + }, + { + "type": "basic", + "from": { + "simultaneous": [ + { + "key_code": "f" + }, + { + "key_code": "l" + } + ], + "simultaneous_options": { + "key_down_order": "strict", + "key_up_when": "all" + }, + "modifiers": { + "mandatory": [ + "command" + ], + "optional": [ + "any" + ] + } + }, + "to": [ + { + "key_code": "right_arrow" + } + ], + "parameters": { + "basic.simultaneous_threshold_milliseconds": 500 + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + } + ] + }, + { + "type": "basic", + "from": { + "simultaneous": [ + { + "key_code": "f" + }, + { + "key_code": "a" + } + ], + "simultaneous_options": { + "key_down_order": "strict", + "key_up_when": "all" + }, + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "key_code": "tab", + "modifiers": [ + "left_command" + ] + } + ], + "parameters": { + "basic.simultaneous_threshold_milliseconds": 500 + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_if", + "name": "eisuu_cmd", + "value": true + } + ] + }, + { + "type": "basic", + "from": { + "key_code": "f", + "modifiers": { + "optional": [ + "caps_lock" + ] + } + }, + "to": [ + { + "set_variable": { + "name": "f_held", + "value": true, + "key_up_value": false + } + } + ], + "to_if_alone": [ + { + "key_code": "f" + } + ], + "parameters": { + "basic.to_if_alone_timeout_milliseconds": 200 + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + } + ] + }, + { + "type": "basic", + "from": { + "simultaneous": [ + { + "key_code": "f" + }, + { + "key_code": "h" + } + ], + "simultaneous_options": { + "key_down_order": "strict", + "key_up_when": "all" + }, + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "set_variable": { + "name": "f_held", + "value": true, + "key_up_value": false + } + }, + { + "key_code": "left_arrow" + } + ], + "parameters": { + "basic.simultaneous_threshold_milliseconds": 250 + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + } + ] + }, + { + "type": "basic", + "from": { + "simultaneous": [ + { + "key_code": "f" + }, + { + "key_code": "j" + } + ], + "simultaneous_options": { + "key_down_order": "strict", + "key_up_when": "all" + }, + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "set_variable": { + "name": "f_held", + "value": true, + "key_up_value": false + } + }, + { + "key_code": "down_arrow" + } + ], + "parameters": { + "basic.simultaneous_threshold_milliseconds": 250 + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + } + ] + }, + { + "type": "basic", + "from": { + "simultaneous": [ + { + "key_code": "f" + }, + { + "key_code": "k" + } + ], + "simultaneous_options": { + "key_down_order": "strict", + "key_up_when": "all" + }, + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "set_variable": { + "name": "f_held", + "value": true, + "key_up_value": false + } + }, + { + "key_code": "up_arrow" + } + ], + "parameters": { + "basic.simultaneous_threshold_milliseconds": 250 + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + } + ] + }, + { + "type": "basic", + "from": { + "simultaneous": [ + { + "key_code": "f" + }, + { + "key_code": "l" + } + ], + "simultaneous_options": { + "key_down_order": "strict", + "key_up_when": "all" + }, + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "set_variable": { + "name": "f_held", + "value": true, + "key_up_value": false + } + }, + { + "key_code": "right_arrow" + } + ], + "parameters": { + "basic.simultaneous_threshold_milliseconds": 250 + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + } + ] + }, + { + "type": "basic", + "from": { + "simultaneous": [ + { + "key_code": "f" + }, + { + "key_code": "e" + } + ], + "simultaneous_options": { + "key_down_order": "strict", + "key_up_when": "all" + }, + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "set_variable": { + "name": "f_held", + "value": true, + "key_up_value": false + } + }, + { + "key_code": "delete_or_backspace" + } + ], + "parameters": { + "basic.simultaneous_threshold_milliseconds": 250 + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + } + ] + }, + { + "type": "basic", + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_if", + "name": "f_held", + "value": true + } + ], + "from": { + "key_code": "h", + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "key_code": "left_arrow" + } + ] + }, + { + "type": "basic", + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_if", + "name": "f_held", + "value": true + } + ], + "from": { + "key_code": "j", + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "key_code": "down_arrow" + } + ] + }, + { + "type": "basic", + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_if", + "name": "f_held", + "value": true + } + ], + "from": { + "key_code": "k", + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "key_code": "up_arrow" + } + ] + }, + { + "type": "basic", + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_if", + "name": "f_held", + "value": true + } + ], + "from": { + "key_code": "l", + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "key_code": "right_arrow" + } + ] + }, + { + "type": "basic", + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_if", + "name": "f_held", + "value": true + } + ], + "from": { + "key_code": "e", + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "key_code": "delete_or_backspace" + } + ] + }, + { + "type": "basic", + "from": { + "simultaneous": [ + { + "key_code": "f" + }, + { + "key_code": "a" + } + ], + "simultaneous_options": { + "key_down_order": "strict", + "key_up_when": "all" + }, + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "set_variable": { + "name": "f_held", + "value": true, + "key_up_value": false + } + }, + { + "key_code": "tab" + } + ], + "parameters": { + "basic.simultaneous_threshold_milliseconds": 250 + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + } + ] + }, + { + "type": "basic", + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_if", + "name": "f_held", + "value": true + } + ], + "from": { + "key_code": "a", + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "key_code": "tab" + } + ] + }, + { + "type": "basic", + "from": { + "simultaneous": [ + { + "key_code": "f" + }, + { + "key_code": "q" + } + ], + "simultaneous_options": { + "key_down_order": "strict", + "key_up_when": "all" + }, + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "set_variable": { + "name": "f_held", + "value": true, + "key_up_value": false + } + }, + { + "key_code": "escape" + } + ], + "parameters": { + "basic.simultaneous_threshold_milliseconds": 250 + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + } + ] + }, + { + "type": "basic", + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_if", + "name": "f_held", + "value": true + } + ], + "from": { + "key_code": "q", + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "key_code": "escape" + } + ] + }, + { + "type": "basic", + "from": { + "simultaneous": [ + { + "key_code": "f" + }, + { + "key_code": "u" + } + ], + "simultaneous_options": { + "key_down_order": "strict", + "key_up_when": "all" + }, + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "set_variable": { + "name": "f_held", + "value": true, + "key_up_value": false + } + }, + { + "key_code": "delete_or_backspace" + } + ], + "parameters": { + "basic.simultaneous_threshold_milliseconds": 250 + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + } + ] + }, + { + "type": "basic", + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_if", + "name": "f_held", + "value": true + } + ], + "from": { + "key_code": "u", + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "key_code": "delete_or_backspace" + } + ] + }, + { + "type": "basic", + "from": { + "simultaneous": [ + { + "key_code": "f" + }, + { + "key_code": "s" + } + ], + "simultaneous_options": { + "key_down_order": "strict", + "key_up_when": "all" + }, + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "set_variable": { + "name": "f_held", + "value": true, + "key_up_value": false + } + }, + { + "key_code": "tab" + } + ], + "parameters": { + "basic.simultaneous_threshold_milliseconds": 250 + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + } + ] + }, + { + "type": "basic", + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_if", + "name": "f_held", + "value": true + } + ], + "from": { + "key_code": "s", + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "key_code": "tab" + } + ] + }, + { + "type": "basic", + "from": { + "simultaneous": [ + { + "key_code": "f" + }, + { + "key_code": "d" + } + ], + "simultaneous_options": { + "key_down_order": "strict", + "key_up_when": "all" + }, + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "set_variable": { + "name": "f_held", + "value": true, + "key_up_value": false + } + }, + { + "key_code": "left_command" + } + ], + "parameters": { + "basic.simultaneous_threshold_milliseconds": 250 + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + } + ] + }, + { + "type": "basic", + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_if", + "name": "f_held", + "value": true + } + ], + "from": { + "key_code": "d", + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "key_code": "left_command" + } + ] + }, + { + "type": "basic", + "from": { + "simultaneous": [ + { + "key_code": "f" + }, + { + "key_code": "p" + } + ], + "simultaneous_options": { + "key_down_order": "strict", + "key_up_when": "all" + }, + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "set_variable": { + "name": "f_held", + "value": true, + "key_up_value": false + } + }, + { + "key_code": "delete_forward" + } + ], + "parameters": { + "basic.simultaneous_threshold_milliseconds": 250 + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + } + ] + }, + { + "type": "basic", + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_if", + "name": "f_held", + "value": true + } + ], + "from": { + "key_code": "p", + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "key_code": "delete_forward" + } + ] + }, + { + "type": "basic", + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_if", + "name": "f_cmd_layer", + "value": true + } + ], + "from": { + "key_code": "spacebar", + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "set_variable": { + "name": "space_shift", + "value": true, + "key_up_value": false + } + }, + { + "key_code": "left_shift" + } + ] + }, + { + "type": "basic", + "from": { + "key_code": "spacebar", + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "set_variable": { + "name": "space_shift", + "value": true, + "key_up_value": false + } + }, + { + "key_code": "left_shift", + "lazy": true + } + ], + "to_if_alone": [ + { + "key_code": "spacebar" + } + ], + "parameters": { + "basic.to_if_alone_timeout_milliseconds": 200 + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + } + ] + }, + { + "type": "basic", + "from": { + "simultaneous": [ + { + "key_code": "f" + }, + { + "key_code": "n" + } + ], + "simultaneous_options": { + "key_down_order": "strict", + "key_up_when": "all" + }, + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "set_variable": { + "name": "f_held", + "value": true, + "key_up_value": false + } + }, + { + "key_code": "japanese_eisuu" + } + ], + "parameters": { + "basic.simultaneous_threshold_milliseconds": 250 + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + } + ] + }, + { + "type": "basic", + "from": { + "simultaneous": [ + { + "key_code": "f" + }, + { + "key_code": "m" + } + ], + "simultaneous_options": { + "key_down_order": "strict", + "key_up_when": "all" + }, + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "set_variable": { + "name": "f_held", + "value": true, + "key_up_value": false + } + }, + { + "key_code": "japanese_kana" + } + ], + "parameters": { + "basic.simultaneous_threshold_milliseconds": 250 + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + } + ] + }, + { + "type": "basic", + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_if", + "name": "f_held", + "value": true + } + ], + "from": { + "key_code": "n", + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "key_code": "japanese_eisuu" + } + ] + }, + { + "type": "basic", + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_if", + "name": "f_held", + "value": true + } + ], + "from": { + "key_code": "m", + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "key_code": "japanese_kana" + } + ] + }, + { + "type": "basic", + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_if", + "name": "f_held", + "value": true + } + ], + "from": { + "key_code": "japanese_eisuu", + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "set_variable": { + "name": "eisuu_cmd", + "value": true, + "key_up_value": false + } + }, + { + "set_variable": { + "name": "f_cmd_layer", + "value": true, + "key_up_value": false + } + }, + { + "key_code": "left_command" + } + ] + }, + { + "type": "basic", + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + } + ], + "from": { + "key_code": "japanese_eisuu", + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "set_variable": { + "name": "eisuu_cmd", + "value": true, + "key_up_value": false + } + }, + { + "key_code": "left_command" + } + ], + "to_if_alone": [ + { + "key_code": "return_or_enter" + } + ], + "parameters": { + "basic.to_if_alone_timeout_milliseconds": 200 + } + }, + { + "type": "basic", + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + } + ], + "from": { + "key_code": "japanese_kana", + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "key_code": "right_command" + } + ], + "to_if_alone": [ + { + "key_code": "return_or_enter" + } + ], + "parameters": { + "basic.to_if_alone_timeout_milliseconds": 200 + } + }, + { + "type": "basic", + "from": { + "simultaneous": [ + { + "key_code": "f" + }, + { + "key_code": "b" + } + ], + "simultaneous_options": { + "key_down_order": "strict", + "key_up_when": "any", + "to_after_key_up": [ + { + "shell_command": "/bin/bash -lc '$HOME/.bin/karabiner-keymap-hud hide'" + } + ] + }, + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "set_variable": { + "name": "f_held", + "value": true, + "key_up_value": false + } + }, + { + "shell_command": "/bin/bash -lc '$HOME/.bin/karabiner-keymap-hud show'" + } + ], + "parameters": { + "basic.simultaneous_threshold_milliseconds": 350 + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + } + ] + }, + { + "type": "basic", + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_if", + "name": "f_held", + "value": true + } + ], + "from": { + "key_code": "b", + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "shell_command": "/bin/bash -lc '$HOME/.bin/karabiner-keymap-hud show'" + } + ], + "to_after_key_up": [ + { + "shell_command": "/bin/bash -lc '$HOME/.bin/karabiner-keymap-hud hide'" + } + ] + } + ] + }, + { + "description": "d layer: n m , j k l u i o p → 1-0 number pad", + "manipulators": [ + { + "type": "basic", + "from": { + "key_code": "d", + "modifiers": { + "optional": [ + "caps_lock", + "shift" + ] + } + }, + "to": [ + { + "set_variable": { + "name": "d_held", + "value": true, + "key_up_value": false + } + } + ], + "to_if_alone": [ + { + "key_code": "d" + } + ], + "parameters": { + "basic.to_if_alone_timeout_milliseconds": 200 + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_unless", + "name": "f_held", + "value": true + } + ] + }, + { + "type": "basic", + "from": { + "simultaneous": [ + { + "key_code": "d" + }, + { + "key_code": "n" + } + ], + "simultaneous_options": { + "key_down_order": "strict", + "key_up_when": "all" + }, + "modifiers": { + "optional": [ + "caps_lock", + "shift" + ] + } + }, + "to": [ + { + "set_variable": { + "name": "d_held", + "value": true, + "key_up_value": false + } + }, + { + "key_code": "1" + } + ], + "parameters": { + "basic.simultaneous_threshold_milliseconds": 250 + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_unless", + "name": "f_held", + "value": true + } + ] + }, + { + "type": "basic", + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_if", + "name": "d_held", + "value": true + } + ], + "from": { + "key_code": "n", + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "key_code": "1" + } + ] + }, + { + "type": "basic", + "from": { + "simultaneous": [ + { + "key_code": "d" + }, + { + "key_code": "m" + } + ], + "simultaneous_options": { + "key_down_order": "strict", + "key_up_when": "all" + }, + "modifiers": { + "optional": [ + "caps_lock", + "shift" + ] + } + }, + "to": [ + { + "set_variable": { + "name": "d_held", + "value": true, + "key_up_value": false + } + }, + { + "key_code": "2" + } + ], + "parameters": { + "basic.simultaneous_threshold_milliseconds": 250 + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_unless", + "name": "f_held", + "value": true + } + ] + }, + { + "type": "basic", + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_if", + "name": "d_held", + "value": true + } + ], + "from": { + "key_code": "m", + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "key_code": "2" + } + ] + }, + { + "type": "basic", + "from": { + "simultaneous": [ + { + "key_code": "d" + }, + { + "key_code": "comma" + } + ], + "simultaneous_options": { + "key_down_order": "strict", + "key_up_when": "all" + }, + "modifiers": { + "optional": [ + "caps_lock", + "shift" + ] + } + }, + "to": [ + { + "set_variable": { + "name": "d_held", + "value": true, + "key_up_value": false + } + }, + { + "key_code": "3" + } + ], + "parameters": { + "basic.simultaneous_threshold_milliseconds": 250 + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_unless", + "name": "f_held", + "value": true + } + ] + }, + { + "type": "basic", + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_if", + "name": "d_held", + "value": true + } + ], + "from": { + "key_code": "comma", + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "key_code": "3" + } + ] + }, + { + "type": "basic", + "from": { + "simultaneous": [ + { + "key_code": "d" + }, + { + "key_code": "j" + } + ], + "simultaneous_options": { + "key_down_order": "strict", + "key_up_when": "all" + }, + "modifiers": { + "optional": [ + "caps_lock", + "shift" + ] + } + }, + "to": [ + { + "set_variable": { + "name": "d_held", + "value": true, + "key_up_value": false + } + }, + { + "key_code": "4" + } + ], + "parameters": { + "basic.simultaneous_threshold_milliseconds": 250 + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_unless", + "name": "f_held", + "value": true + } + ] + }, + { + "type": "basic", + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_if", + "name": "d_held", + "value": true + } + ], + "from": { + "key_code": "j", + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "key_code": "4" + } + ] + }, + { + "type": "basic", + "from": { + "simultaneous": [ + { + "key_code": "d" + }, + { + "key_code": "k" + } + ], + "simultaneous_options": { + "key_down_order": "strict", + "key_up_when": "all" + }, + "modifiers": { + "optional": [ + "caps_lock", + "shift" + ] + } + }, + "to": [ + { + "set_variable": { + "name": "d_held", + "value": true, + "key_up_value": false + } + }, + { + "key_code": "5" + } + ], + "parameters": { + "basic.simultaneous_threshold_milliseconds": 250 + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_unless", + "name": "f_held", + "value": true + } + ] + }, + { + "type": "basic", + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_if", + "name": "d_held", + "value": true + } + ], + "from": { + "key_code": "k", + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "key_code": "5" + } + ] + }, + { + "type": "basic", + "from": { + "simultaneous": [ + { + "key_code": "d" + }, + { + "key_code": "l" + } + ], + "simultaneous_options": { + "key_down_order": "strict", + "key_up_when": "all" + }, + "modifiers": { + "optional": [ + "caps_lock", + "shift" + ] + } + }, + "to": [ + { + "set_variable": { + "name": "d_held", + "value": true, + "key_up_value": false + } + }, + { + "key_code": "6" + } + ], + "parameters": { + "basic.simultaneous_threshold_milliseconds": 250 + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_unless", + "name": "f_held", + "value": true + } + ] + }, + { + "type": "basic", + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_if", + "name": "d_held", + "value": true + } + ], + "from": { + "key_code": "l", + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "key_code": "6" + } + ] + }, + { + "type": "basic", + "from": { + "simultaneous": [ + { + "key_code": "d" + }, + { + "key_code": "u" + } + ], + "simultaneous_options": { + "key_down_order": "strict", + "key_up_when": "all" + }, + "modifiers": { + "optional": [ + "caps_lock", + "shift" + ] + } + }, + "to": [ + { + "set_variable": { + "name": "d_held", + "value": true, + "key_up_value": false + } + }, + { + "key_code": "7" + } + ], + "parameters": { + "basic.simultaneous_threshold_milliseconds": 250 + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_unless", + "name": "f_held", + "value": true + } + ] + }, + { + "type": "basic", + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_if", + "name": "d_held", + "value": true + } + ], + "from": { + "key_code": "u", + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "key_code": "7" + } + ] + }, + { + "type": "basic", + "from": { + "simultaneous": [ + { + "key_code": "d" + }, + { + "key_code": "i" + } + ], + "simultaneous_options": { + "key_down_order": "strict", + "key_up_when": "all" + }, + "modifiers": { + "optional": [ + "caps_lock", + "shift" + ] + } + }, + "to": [ + { + "set_variable": { + "name": "d_held", + "value": true, + "key_up_value": false + } + }, + { + "key_code": "8" + } + ], + "parameters": { + "basic.simultaneous_threshold_milliseconds": 250 + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_unless", + "name": "f_held", + "value": true + } + ] + }, + { + "type": "basic", + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_if", + "name": "d_held", + "value": true + } + ], + "from": { + "key_code": "i", + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "key_code": "8" + } + ] + }, + { + "type": "basic", + "from": { + "simultaneous": [ + { + "key_code": "d" + }, + { + "key_code": "o" + } + ], + "simultaneous_options": { + "key_down_order": "strict", + "key_up_when": "all" + }, + "modifiers": { + "optional": [ + "caps_lock", + "shift" + ] + } + }, + "to": [ + { + "set_variable": { + "name": "d_held", + "value": true, + "key_up_value": false + } + }, + { + "key_code": "9" + } + ], + "parameters": { + "basic.simultaneous_threshold_milliseconds": 250 + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_unless", + "name": "f_held", + "value": true + } + ] + }, + { + "type": "basic", + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_if", + "name": "d_held", + "value": true + } + ], + "from": { + "key_code": "o", + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "key_code": "9" + } + ] + }, + { + "type": "basic", + "from": { + "simultaneous": [ + { + "key_code": "d" + }, + { + "key_code": "p" + } + ], + "simultaneous_options": { + "key_down_order": "strict", + "key_up_when": "all" + }, + "modifiers": { + "optional": [ + "caps_lock", + "shift" + ] + } + }, + "to": [ + { + "set_variable": { + "name": "d_held", + "value": true, + "key_up_value": false + } + }, + { + "key_code": "0" + } + ], + "parameters": { + "basic.simultaneous_threshold_milliseconds": 250 + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_unless", + "name": "f_held", + "value": true + } + ] + }, + { + "type": "basic", + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_if", + "name": "d_held", + "value": true + } + ], + "from": { + "key_code": "p", + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "key_code": "0" + } + ] + } + ] + }, + { + "description": "v layer: punctuation + h→~ + y→¥", + "manipulators": [ + { + "type": "basic", + "from": { + "key_code": "v", + "modifiers": { + "optional": [ + "caps_lock", + "shift" + ] + } + }, + "to": [ + { + "set_variable": { + "name": "v_held", + "value": true, + "key_up_value": false + } + } + ], + "to_if_alone": [ + { + "key_code": "v" + } + ], + "parameters": { + "basic.to_if_alone_timeout_milliseconds": 200 + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_unless", + "name": "f_held", + "value": true + } + ] + }, + { + "type": "basic", + "from": { + "simultaneous": [ + { + "key_code": "v" + }, + { + "key_code": "n" + } + ], + "simultaneous_options": { + "key_down_order": "strict", + "key_up_when": "all" + }, + "modifiers": { + "optional": [ + "caps_lock", + "shift" + ] + } + }, + "to": [ + { + "set_variable": { + "name": "v_held", + "value": true, + "key_up_value": false + } + }, + { + "key_code": "comma" + } + ], + "parameters": { + "basic.simultaneous_threshold_milliseconds": 250 + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_unless", + "name": "f_held", + "value": true + } + ] + }, + { + "type": "basic", + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_if", + "name": "v_held", + "value": true + } + ], + "from": { + "key_code": "n", + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "key_code": "comma" + } + ] + }, + { + "type": "basic", + "from": { + "simultaneous": [ + { + "key_code": "v" + }, + { + "key_code": "m" + } + ], + "simultaneous_options": { + "key_down_order": "strict", + "key_up_when": "all" + }, + "modifiers": { + "optional": [ + "caps_lock", + "shift" + ] + } + }, + "to": [ + { + "set_variable": { + "name": "v_held", + "value": true, + "key_up_value": false + } + }, + { + "key_code": "period" + } + ], + "parameters": { + "basic.simultaneous_threshold_milliseconds": 250 + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_unless", + "name": "f_held", + "value": true + } + ] + }, + { + "type": "basic", + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_if", + "name": "v_held", + "value": true + } + ], + "from": { + "key_code": "m", + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "key_code": "period" + } + ] + }, + { + "type": "basic", + "from": { + "simultaneous": [ + { + "key_code": "v" + }, + { + "key_code": "comma" + } + ], + "simultaneous_options": { + "key_down_order": "strict", + "key_up_when": "all" + }, + "modifiers": { + "optional": [ + "caps_lock", + "shift" + ] + } + }, + "to": [ + { + "set_variable": { + "name": "v_held", + "value": true, + "key_up_value": false + } + }, + { + "key_code": "slash" + } + ], + "parameters": { + "basic.simultaneous_threshold_milliseconds": 250 + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_unless", + "name": "f_held", + "value": true + } + ] + }, + { + "type": "basic", + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_if", + "name": "v_held", + "value": true + } + ], + "from": { + "key_code": "comma", + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "key_code": "slash" + } + ] + }, + { + "type": "basic", + "from": { + "simultaneous": [ + { + "key_code": "v" + }, + { "key_code": "j" } ], @@ -358,29 +3915,84 @@ "key_up_when": "all" }, "modifiers": { - "mandatory": [ - "command" - ], "optional": [ - "any" + "caps_lock", + "shift" ] } }, "to": [ { - "key_code": "down_arrow" + "set_variable": { + "name": "v_held", + "value": true, + "key_up_value": false + } + }, + { + "key_code": "semicolon" } ], "parameters": { - "basic.simultaneous_threshold_milliseconds": 500 - } + "basic.simultaneous_threshold_milliseconds": 250 + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_unless", + "name": "f_held", + "value": true + } + ] + }, + { + "type": "basic", + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_if", + "name": "v_held", + "value": true + } + ], + "from": { + "key_code": "j", + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "key_code": "semicolon" + } + ] }, { "type": "basic", "from": { "simultaneous": [ { - "key_code": "f" + "key_code": "v" }, { "key_code": "k" @@ -391,29 +4003,84 @@ "key_up_when": "all" }, "modifiers": { - "mandatory": [ - "command" - ], "optional": [ - "any" + "caps_lock", + "shift" ] } }, "to": [ { - "key_code": "up_arrow" + "set_variable": { + "name": "v_held", + "value": true, + "key_up_value": false + } + }, + { + "key_code": "quote" } ], "parameters": { - "basic.simultaneous_threshold_milliseconds": 500 - } + "basic.simultaneous_threshold_milliseconds": 250 + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_unless", + "name": "f_held", + "value": true + } + ] + }, + { + "type": "basic", + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_if", + "name": "v_held", + "value": true + } + ], + "from": { + "key_code": "k", + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "key_code": "quote" + } + ] }, { "type": "basic", "from": { "simultaneous": [ { - "key_code": "f" + "key_code": "v" }, { "key_code": "l" @@ -424,32 +4091,87 @@ "key_up_when": "all" }, "modifiers": { - "mandatory": [ - "command" - ], "optional": [ - "any" + "caps_lock", + "shift" ] } }, "to": [ { - "key_code": "right_arrow" + "set_variable": { + "name": "v_held", + "value": true, + "key_up_value": false + } + }, + { + "key_code": "backslash" } ], "parameters": { - "basic.simultaneous_threshold_milliseconds": 500 - } + "basic.simultaneous_threshold_milliseconds": 250 + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_unless", + "name": "f_held", + "value": true + } + ] + }, + { + "type": "basic", + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_if", + "name": "v_held", + "value": true + } + ], + "from": { + "key_code": "l", + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "key_code": "backslash" + } + ] }, { "type": "basic", "from": { "simultaneous": [ { - "key_code": "f" + "key_code": "v" }, { - "key_code": "a" + "key_code": "u" } ], "simultaneous_options": { @@ -458,66 +4180,86 @@ }, "modifiers": { "optional": [ - "any" + "caps_lock", + "shift" ] } }, "to": [ { - "key_code": "tab", - "modifiers": [ - "left_command" - ] + "set_variable": { + "name": "v_held", + "value": true, + "key_up_value": false + } + }, + { + "key_code": "hyphen" } ], "parameters": { - "basic.simultaneous_threshold_milliseconds": 500 + "basic.simultaneous_threshold_milliseconds": 250 }, "conditions": [ { - "type": "variable_if", - "name": "eisuu_cmd", + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_unless", + "name": "f_held", "value": true } ] }, { "type": "basic", + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_if", + "name": "v_held", + "value": true + } + ], "from": { - "key_code": "f", + "key_code": "u", "modifiers": { "optional": [ - "caps_lock" + "any" ] } }, "to": [ { - "set_variable": { - "name": "f_held", - "value": true, - "key_up_value": false - } - } - ], - "to_if_alone": [ - { - "key_code": "f" + "key_code": "hyphen" } - ], - "parameters": { - "basic.to_if_alone_timeout_milliseconds": 200 - } + ] }, { "type": "basic", "from": { "simultaneous": [ { - "key_code": "f" + "key_code": "v" }, { - "key_code": "h" + "key_code": "i" } ], "simultaneous_options": { @@ -526,41 +4268,65 @@ }, "modifiers": { "optional": [ - "any" + "caps_lock", + "shift" ] } }, "to": [ { "set_variable": { - "name": "f_held", + "name": "v_held", "value": true, "key_up_value": false } }, { - "key_code": "left_arrow" + "key_code": "equal_sign" } ], "parameters": { "basic.simultaneous_threshold_milliseconds": 250 - } + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_unless", + "name": "f_held", + "value": true + } + ] }, { "type": "basic", - "from": { - "simultaneous": [ - { - "key_code": "f" - }, - { - "key_code": "j" - } - ], - "simultaneous_options": { - "key_down_order": "strict", - "key_up_when": "all" + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] }, + { + "type": "variable_if", + "name": "v_held", + "value": true + } + ], + "from": { + "key_code": "i", "modifiers": { "optional": [ "any" @@ -569,29 +4335,19 @@ }, "to": [ { - "set_variable": { - "name": "f_held", - "value": true, - "key_up_value": false - } - }, - { - "key_code": "down_arrow" + "key_code": "equal_sign" } - ], - "parameters": { - "basic.simultaneous_threshold_milliseconds": 250 - } + ] }, { "type": "basic", "from": { "simultaneous": [ { - "key_code": "f" + "key_code": "v" }, { - "key_code": "k" + "key_code": "o" } ], "simultaneous_options": { @@ -600,41 +4356,65 @@ }, "modifiers": { "optional": [ - "any" + "caps_lock", + "shift" ] } }, "to": [ { "set_variable": { - "name": "f_held", + "name": "v_held", "value": true, "key_up_value": false } }, { - "key_code": "up_arrow" + "key_code": "open_bracket" } ], "parameters": { "basic.simultaneous_threshold_milliseconds": 250 - } + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_unless", + "name": "f_held", + "value": true + } + ] }, { "type": "basic", - "from": { - "simultaneous": [ - { - "key_code": "f" - }, - { - "key_code": "l" - } - ], - "simultaneous_options": { - "key_down_order": "strict", - "key_up_when": "all" + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] }, + { + "type": "variable_if", + "name": "v_held", + "value": true + } + ], + "from": { + "key_code": "o", "modifiers": { "optional": [ "any" @@ -643,29 +4423,19 @@ }, "to": [ { - "set_variable": { - "name": "f_held", - "value": true, - "key_up_value": false - } - }, - { - "key_code": "right_arrow" + "key_code": "open_bracket" } - ], - "parameters": { - "basic.simultaneous_threshold_milliseconds": 250 - } + ] }, { "type": "basic", "from": { "simultaneous": [ { - "key_code": "f" + "key_code": "v" }, { - "key_code": "e" + "key_code": "p" } ], "simultaneous_options": { @@ -674,60 +4444,65 @@ }, "modifiers": { "optional": [ - "any" + "caps_lock", + "shift" ] } }, "to": [ { "set_variable": { - "name": "f_held", + "name": "v_held", "value": true, "key_up_value": false } }, { - "key_code": "delete_or_backspace" + "key_code": "close_bracket" } ], "parameters": { "basic.simultaneous_threshold_milliseconds": 250 - } - }, - { - "type": "basic", + }, "conditions": [ { - "type": "variable_if", - "name": "f_held", - "value": true - } - ], - "from": { - "key_code": "h", - "modifiers": { - "optional": [ - "any" + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } ] - } - }, - "to": [ + }, { - "key_code": "left_arrow" + "type": "variable_unless", + "name": "f_held", + "value": true } ] }, { "type": "basic", "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, { "type": "variable_if", - "name": "f_held", + "name": "v_held", "value": true } ], "from": { - "key_code": "j", + "key_code": "p", "modifiers": { "optional": [ "any" @@ -736,67 +4511,89 @@ }, "to": [ { - "key_code": "down_arrow" + "key_code": "close_bracket" } ] }, { "type": "basic", - "conditions": [ - { - "type": "variable_if", - "name": "f_held", - "value": true - } - ], "from": { - "key_code": "k", + "simultaneous": [ + { + "key_code": "v" + }, + { + "key_code": "h" + } + ], + "simultaneous_options": { + "key_down_order": "strict", + "key_up_when": "all" + }, "modifiers": { "optional": [ - "any" + "caps_lock", + "shift" ] } }, "to": [ { - "key_code": "up_arrow" - } - ] - }, - { - "type": "basic", - "conditions": [ + "set_variable": { + "name": "v_held", + "value": true, + "key_up_value": false + } + }, { - "type": "variable_if", - "name": "f_held", - "value": true - } - ], - "from": { - "key_code": "l", - "modifiers": { - "optional": [ - "any" + "key_code": "grave_accent_and_tilde", + "modifiers": [ + "left_shift" ] } + ], + "parameters": { + "basic.simultaneous_threshold_milliseconds": 250 }, - "to": [ + "conditions": [ { - "key_code": "right_arrow" + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_unless", + "name": "f_held", + "value": true } ] }, { "type": "basic", "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, { "type": "variable_if", - "name": "f_held", + "name": "v_held", "value": true } ], "from": { - "key_code": "e", + "key_code": "h", "modifiers": { "optional": [ "any" @@ -805,7 +4602,10 @@ }, "to": [ { - "key_code": "delete_or_backspace" + "key_code": "grave_accent_and_tilde", + "modifiers": [ + "left_shift" + ] } ] }, @@ -814,10 +4614,10 @@ "from": { "simultaneous": [ { - "key_code": "f" + "key_code": "v" }, { - "key_code": "a" + "key_code": "y" } ], "simultaneous_options": { @@ -826,60 +4626,65 @@ }, "modifiers": { "optional": [ - "any" + "caps_lock", + "shift" ] } }, "to": [ { "set_variable": { - "name": "f_held", + "name": "v_held", "value": true, "key_up_value": false } }, { - "key_code": "tab" + "key_code": "international3" } ], "parameters": { "basic.simultaneous_threshold_milliseconds": 250 - } - }, - { - "type": "basic", + }, "conditions": [ { - "type": "variable_if", - "name": "f_held", - "value": true - } - ], - "from": { - "key_code": "a", - "modifiers": { - "optional": [ - "any" + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } ] - } - }, - "to": [ + }, { - "key_code": "tab" + "type": "variable_unless", + "name": "f_held", + "value": true } ] }, { "type": "basic", "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, { "type": "variable_if", - "name": "f_cmd_layer", + "name": "v_held", "value": true } ], "from": { - "key_code": "spacebar", + "key_code": "y", "modifiers": { "optional": [ "any" @@ -888,58 +4693,70 @@ }, "to": [ { - "set_variable": { - "name": "space_shift", - "value": true, - "key_up_value": false - } - }, - { - "key_code": "left_shift" + "key_code": "international3" } ] - }, + } + ] + }, + { + "description": "c layer (=Torabo L5): macOS の設定に合わせて F1–F12 を標準ファンクションキーとして送る", + "manipulators": [ { "type": "basic", "from": { - "key_code": "spacebar", + "key_code": "c", "modifiers": { "optional": [ - "any" + "caps_lock", + "shift" ] } }, "to": [ { "set_variable": { - "name": "space_shift", + "name": "c_held", "value": true, "key_up_value": false } - }, - { - "key_code": "left_shift", - "lazy": true } ], "to_if_alone": [ { - "key_code": "spacebar" + "key_code": "c" } ], "parameters": { "basic.to_if_alone_timeout_milliseconds": 200 - } + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_unless", + "name": "f_held", + "value": true + } + ] }, { "type": "basic", "from": { "simultaneous": [ { - "key_code": "f" + "key_code": "c" }, { - "key_code": "n" + "key_code": "y" } ], "simultaneous_options": { @@ -948,35 +4765,126 @@ }, "modifiers": { "optional": [ - "any" + "caps_lock", + "shift" ] } }, "to": [ { "set_variable": { - "name": "f_held", + "name": "c_held", "value": true, "key_up_value": false } }, { - "key_code": "japanese_eisuu" + "key_code": "f12", + "conditions": [ + { + "type": "variable_if", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] + }, + { + "key_code": "f12", + "modifiers": [ + "fn" + ], + "conditions": [ + { + "type": "variable_unless", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] } ], "parameters": { "basic.simultaneous_threshold_milliseconds": 250 - } + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_unless", + "name": "f_held", + "value": true + } + ] + }, + { + "type": "basic", + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_if", + "name": "c_held", + "value": true + } + ], + "from": { + "key_code": "y", + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "key_code": "f12", + "conditions": [ + { + "type": "variable_if", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] + }, + { + "key_code": "f12", + "modifiers": [ + "fn" + ], + "conditions": [ + { + "type": "variable_unless", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] + } + ] }, { "type": "basic", "from": { "simultaneous": [ { - "key_code": "f" + "key_code": "c" }, { - "key_code": "m" + "key_code": "u" } ], "simultaneous_options": { @@ -985,144 +4893,213 @@ }, "modifiers": { "optional": [ - "any" + "caps_lock", + "shift" ] } }, "to": [ { "set_variable": { - "name": "f_held", + "name": "c_held", "value": true, "key_up_value": false } }, { - "key_code": "japanese_kana" + "key_code": "f7", + "conditions": [ + { + "type": "variable_if", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] + }, + { + "key_code": "f7", + "modifiers": [ + "fn" + ], + "conditions": [ + { + "type": "variable_unless", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] } ], "parameters": { "basic.simultaneous_threshold_milliseconds": 250 - } - }, - { - "type": "basic", + }, "conditions": [ { - "type": "variable_if", - "name": "f_held", - "value": true - } - ], - "from": { - "key_code": "n", - "modifiers": { - "optional": [ - "any" + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } ] - } - }, - "to": [ - { - "key_code": "japanese_eisuu" - } - ] - }, - { - "type": "basic", - "conditions": [ + }, { - "type": "variable_if", + "type": "variable_unless", "name": "f_held", "value": true } - ], - "from": { - "key_code": "m", - "modifiers": { - "optional": [ - "any" - ] - } - }, - "to": [ - { - "key_code": "japanese_kana" - } ] }, { "type": "basic", "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, { "type": "variable_if", - "name": "f_held", + "name": "c_held", "value": true } ], "from": { - "key_code": "japanese_eisuu", + "key_code": "u", "modifiers": { "optional": [ "any" ] } }, - "to": [ - { - "set_variable": { - "name": "eisuu_cmd", - "value": true, - "key_up_value": false - } - }, - { - "set_variable": { - "name": "f_cmd_layer", - "value": true, - "key_up_value": false - } + "to": [ + { + "key_code": "f7", + "conditions": [ + { + "type": "variable_if", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] }, { - "key_code": "left_command" + "key_code": "f7", + "modifiers": [ + "fn" + ], + "conditions": [ + { + "type": "variable_unless", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] } ] }, { "type": "basic", "from": { - "key_code": "japanese_eisuu", + "simultaneous": [ + { + "key_code": "c" + }, + { + "key_code": "i" + } + ], + "simultaneous_options": { + "key_down_order": "strict", + "key_up_when": "all" + }, "modifiers": { "optional": [ - "any" + "caps_lock", + "shift" ] } }, "to": [ { "set_variable": { - "name": "eisuu_cmd", + "name": "c_held", "value": true, "key_up_value": false } }, { - "key_code": "left_command" - } - ], - "to_if_alone": [ + "key_code": "f8", + "conditions": [ + { + "type": "variable_if", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] + }, { - "key_code": "return_or_enter" + "key_code": "f8", + "modifiers": [ + "fn" + ], + "conditions": [ + { + "type": "variable_unless", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] } ], "parameters": { - "basic.to_if_alone_timeout_milliseconds": 200 - } + "basic.simultaneous_threshold_milliseconds": 250 + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_unless", + "name": "f_held", + "value": true + } + ] }, { "type": "basic", + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_if", + "name": "c_held", + "value": true + } + ], "from": { - "key_code": "japanese_kana", + "key_code": "i", "modifiers": { "optional": [ "any" @@ -1131,71 +5108,126 @@ }, "to": [ { - "key_code": "right_command" - } - ], - "to_if_alone": [ + "key_code": "f8", + "conditions": [ + { + "type": "variable_if", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] + }, { - "key_code": "return_or_enter" + "key_code": "f8", + "modifiers": [ + "fn" + ], + "conditions": [ + { + "type": "variable_unless", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] } - ], - "parameters": { - "basic.to_if_alone_timeout_milliseconds": 200 - } + ] }, { "type": "basic", "from": { "simultaneous": [ { - "key_code": "f" + "key_code": "c" }, { - "key_code": "b" + "key_code": "o" } ], "simultaneous_options": { "key_down_order": "strict", - "key_up_when": "any", - "to_after_key_up": [ - { - "shell_command": "/bin/bash -lc '$HOME/.bin/karabiner-keymap-hud hide'" - } - ] + "key_up_when": "all" }, "modifiers": { "optional": [ - "any" + "caps_lock", + "shift" ] } }, "to": [ { "set_variable": { - "name": "f_held", + "name": "c_held", "value": true, "key_up_value": false } }, { - "shell_command": "/bin/bash -lc '$HOME/.bin/karabiner-keymap-hud show'" + "key_code": "f9", + "conditions": [ + { + "type": "variable_if", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] + }, + { + "key_code": "f9", + "modifiers": [ + "fn" + ], + "conditions": [ + { + "type": "variable_unless", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] } ], "parameters": { - "basic.simultaneous_threshold_milliseconds": 350 - } + "basic.simultaneous_threshold_milliseconds": 250 + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_unless", + "name": "f_held", + "value": true + } + ] }, { "type": "basic", "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, { "type": "variable_if", - "name": "f_held", + "name": "c_held", "value": true } ], "from": { - "key_code": "b", + "key_code": "o", "modifiers": { "optional": [ "any" @@ -1204,58 +5236,39 @@ }, "to": [ { - "shell_command": "/bin/bash -lc '$HOME/.bin/karabiner-keymap-hud show'" - } - ], - "to_after_key_up": [ - { - "shell_command": "/bin/bash -lc '$HOME/.bin/karabiner-keymap-hud hide'" - } - ] - } - ] - }, - { - "description": "d layer: n m , j k l u i o p → 1-0 number pad", - "manipulators": [ - { - "type": "basic", - "from": { - "key_code": "d", - "modifiers": { - "optional": [ - "caps_lock", - "shift" + "key_code": "f9", + "conditions": [ + { + "type": "variable_if", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } ] - } - }, - "to": [ - { - "set_variable": { - "name": "d_held", - "value": true, - "key_up_value": false - } - } - ], - "to_if_alone": [ + }, { - "key_code": "d" + "key_code": "f9", + "modifiers": [ + "fn" + ], + "conditions": [ + { + "type": "variable_unless", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] } - ], - "parameters": { - "basic.to_if_alone_timeout_milliseconds": 200 - } + ] }, { "type": "basic", "from": { "simultaneous": [ { - "key_code": "d" + "key_code": "c" }, { - "key_code": "n" + "key_code": "h" } ], "simultaneous_options": { @@ -1272,30 +5285,77 @@ "to": [ { "set_variable": { - "name": "d_held", + "name": "c_held", "value": true, "key_up_value": false } }, { - "key_code": "1" + "key_code": "f11", + "conditions": [ + { + "type": "variable_if", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] + }, + { + "key_code": "f11", + "modifiers": [ + "fn" + ], + "conditions": [ + { + "type": "variable_unless", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] } ], "parameters": { "basic.simultaneous_threshold_milliseconds": 250 - } + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_unless", + "name": "f_held", + "value": true + } + ] }, { "type": "basic", "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, { "type": "variable_if", - "name": "d_held", + "name": "c_held", "value": true } ], "from": { - "key_code": "n", + "key_code": "h", "modifiers": { "optional": [ "any" @@ -1304,7 +5364,27 @@ }, "to": [ { - "key_code": "1" + "key_code": "f11", + "conditions": [ + { + "type": "variable_if", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] + }, + { + "key_code": "f11", + "modifiers": [ + "fn" + ], + "conditions": [ + { + "type": "variable_unless", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] } ] }, @@ -1313,10 +5393,10 @@ "from": { "simultaneous": [ { - "key_code": "d" + "key_code": "c" }, { - "key_code": "m" + "key_code": "j" } ], "simultaneous_options": { @@ -1333,30 +5413,77 @@ "to": [ { "set_variable": { - "name": "d_held", + "name": "c_held", "value": true, "key_up_value": false } }, { - "key_code": "2" + "key_code": "f4", + "conditions": [ + { + "type": "variable_if", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] + }, + { + "key_code": "f4", + "modifiers": [ + "fn" + ], + "conditions": [ + { + "type": "variable_unless", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] } ], "parameters": { "basic.simultaneous_threshold_milliseconds": 250 - } + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_unless", + "name": "f_held", + "value": true + } + ] }, { "type": "basic", "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, { "type": "variable_if", - "name": "d_held", + "name": "c_held", "value": true } ], "from": { - "key_code": "m", + "key_code": "j", "modifiers": { "optional": [ "any" @@ -1365,7 +5492,27 @@ }, "to": [ { - "key_code": "2" + "key_code": "f4", + "conditions": [ + { + "type": "variable_if", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] + }, + { + "key_code": "f4", + "modifiers": [ + "fn" + ], + "conditions": [ + { + "type": "variable_unless", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] } ] }, @@ -1374,10 +5521,10 @@ "from": { "simultaneous": [ { - "key_code": "d" + "key_code": "c" }, { - "key_code": "comma" + "key_code": "k" } ], "simultaneous_options": { @@ -1394,30 +5541,77 @@ "to": [ { "set_variable": { - "name": "d_held", + "name": "c_held", "value": true, "key_up_value": false } }, { - "key_code": "3" + "key_code": "f5", + "conditions": [ + { + "type": "variable_if", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] + }, + { + "key_code": "f5", + "modifiers": [ + "fn" + ], + "conditions": [ + { + "type": "variable_unless", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] } ], "parameters": { "basic.simultaneous_threshold_milliseconds": 250 - } + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_unless", + "name": "f_held", + "value": true + } + ] }, { "type": "basic", "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, { "type": "variable_if", - "name": "d_held", + "name": "c_held", "value": true } ], "from": { - "key_code": "comma", + "key_code": "k", "modifiers": { "optional": [ "any" @@ -1426,7 +5620,27 @@ }, "to": [ { - "key_code": "3" + "key_code": "f5", + "conditions": [ + { + "type": "variable_if", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] + }, + { + "key_code": "f5", + "modifiers": [ + "fn" + ], + "conditions": [ + { + "type": "variable_unless", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] } ] }, @@ -1435,10 +5649,10 @@ "from": { "simultaneous": [ { - "key_code": "d" + "key_code": "c" }, { - "key_code": "j" + "key_code": "l" } ], "simultaneous_options": { @@ -1455,30 +5669,77 @@ "to": [ { "set_variable": { - "name": "d_held", + "name": "c_held", "value": true, "key_up_value": false } }, { - "key_code": "4" + "key_code": "f6", + "conditions": [ + { + "type": "variable_if", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] + }, + { + "key_code": "f6", + "modifiers": [ + "fn" + ], + "conditions": [ + { + "type": "variable_unless", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] } ], "parameters": { "basic.simultaneous_threshold_milliseconds": 250 - } + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_unless", + "name": "f_held", + "value": true + } + ] }, { "type": "basic", "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, { "type": "variable_if", - "name": "d_held", + "name": "c_held", "value": true } ], "from": { - "key_code": "j", + "key_code": "l", "modifiers": { "optional": [ "any" @@ -1487,7 +5748,27 @@ }, "to": [ { - "key_code": "4" + "key_code": "f6", + "conditions": [ + { + "type": "variable_if", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] + }, + { + "key_code": "f6", + "modifiers": [ + "fn" + ], + "conditions": [ + { + "type": "variable_unless", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] } ] }, @@ -1496,10 +5777,10 @@ "from": { "simultaneous": [ { - "key_code": "d" + "key_code": "c" }, { - "key_code": "k" + "key_code": "p" } ], "simultaneous_options": { @@ -1516,30 +5797,77 @@ "to": [ { "set_variable": { - "name": "d_held", + "name": "c_held", "value": true, "key_up_value": false } }, { - "key_code": "5" + "key_code": "f10", + "conditions": [ + { + "type": "variable_if", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] + }, + { + "key_code": "f10", + "modifiers": [ + "fn" + ], + "conditions": [ + { + "type": "variable_unless", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] } ], "parameters": { "basic.simultaneous_threshold_milliseconds": 250 - } + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_unless", + "name": "f_held", + "value": true + } + ] }, { "type": "basic", "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, { "type": "variable_if", - "name": "d_held", + "name": "c_held", "value": true } ], "from": { - "key_code": "k", + "key_code": "p", "modifiers": { "optional": [ "any" @@ -1548,7 +5876,27 @@ }, "to": [ { - "key_code": "5" + "key_code": "f10", + "conditions": [ + { + "type": "variable_if", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] + }, + { + "key_code": "f10", + "modifiers": [ + "fn" + ], + "conditions": [ + { + "type": "variable_unless", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] } ] }, @@ -1557,10 +5905,10 @@ "from": { "simultaneous": [ { - "key_code": "d" + "key_code": "c" }, { - "key_code": "l" + "key_code": "n" } ], "simultaneous_options": { @@ -1577,30 +5925,77 @@ "to": [ { "set_variable": { - "name": "d_held", + "name": "c_held", "value": true, "key_up_value": false } }, { - "key_code": "6" + "key_code": "f1", + "conditions": [ + { + "type": "variable_if", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] + }, + { + "key_code": "f1", + "modifiers": [ + "fn" + ], + "conditions": [ + { + "type": "variable_unless", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] } ], "parameters": { "basic.simultaneous_threshold_milliseconds": 250 - } + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_unless", + "name": "f_held", + "value": true + } + ] }, { "type": "basic", "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, { "type": "variable_if", - "name": "d_held", + "name": "c_held", "value": true } ], "from": { - "key_code": "l", + "key_code": "n", "modifiers": { "optional": [ "any" @@ -1609,7 +6004,27 @@ }, "to": [ { - "key_code": "6" + "key_code": "f1", + "conditions": [ + { + "type": "variable_if", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] + }, + { + "key_code": "f1", + "modifiers": [ + "fn" + ], + "conditions": [ + { + "type": "variable_unless", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] } ] }, @@ -1618,10 +6033,10 @@ "from": { "simultaneous": [ { - "key_code": "d" + "key_code": "c" }, { - "key_code": "u" + "key_code": "m" } ], "simultaneous_options": { @@ -1638,30 +6053,77 @@ "to": [ { "set_variable": { - "name": "d_held", + "name": "c_held", "value": true, "key_up_value": false } }, { - "key_code": "7" + "key_code": "f2", + "conditions": [ + { + "type": "variable_if", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] + }, + { + "key_code": "f2", + "modifiers": [ + "fn" + ], + "conditions": [ + { + "type": "variable_unless", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] } ], "parameters": { "basic.simultaneous_threshold_milliseconds": 250 - } + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_unless", + "name": "f_held", + "value": true + } + ] }, { "type": "basic", "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, { "type": "variable_if", - "name": "d_held", + "name": "c_held", "value": true } ], "from": { - "key_code": "u", + "key_code": "m", "modifiers": { "optional": [ "any" @@ -1670,7 +6132,27 @@ }, "to": [ { - "key_code": "7" + "key_code": "f2", + "conditions": [ + { + "type": "variable_if", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] + }, + { + "key_code": "f2", + "modifiers": [ + "fn" + ], + "conditions": [ + { + "type": "variable_unless", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] } ] }, @@ -1679,10 +6161,10 @@ "from": { "simultaneous": [ { - "key_code": "d" + "key_code": "c" }, { - "key_code": "i" + "key_code": "comma" } ], "simultaneous_options": { @@ -1699,30 +6181,77 @@ "to": [ { "set_variable": { - "name": "d_held", + "name": "c_held", "value": true, "key_up_value": false } }, { - "key_code": "8" + "key_code": "f3", + "conditions": [ + { + "type": "variable_if", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] + }, + { + "key_code": "f3", + "modifiers": [ + "fn" + ], + "conditions": [ + { + "type": "variable_unless", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] } ], "parameters": { "basic.simultaneous_threshold_milliseconds": 250 - } + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_unless", + "name": "f_held", + "value": true + } + ] }, { "type": "basic", "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, { "type": "variable_if", - "name": "d_held", + "name": "c_held", "value": true } ], "from": { - "key_code": "i", + "key_code": "comma", "modifiers": { "optional": [ "any" @@ -1731,25 +6260,39 @@ }, "to": [ { - "key_code": "8" + "key_code": "f3", + "conditions": [ + { + "type": "variable_if", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] + }, + { + "key_code": "f3", + "modifiers": [ + "fn" + ], + "conditions": [ + { + "type": "variable_unless", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] } ] - }, + } + ] + }, + { + "description": "x layer (=Torabo L9): 音量・再生・輝度・Launchpad / Mission Control", + "manipulators": [ { "type": "basic", "from": { - "simultaneous": [ - { - "key_code": "d" - }, - { - "key_code": "o" - } - ], - "simultaneous_options": { - "key_down_order": "strict", - "key_up_when": "all" - }, + "key_code": "x", "modifiers": { "optional": [ "caps_lock", @@ -1760,39 +6303,35 @@ "to": [ { "set_variable": { - "name": "d_held", + "name": "x_held", "value": true, "key_up_value": false } - }, + } + ], + "to_if_alone": [ { - "key_code": "9" + "key_code": "x" } ], "parameters": { - "basic.simultaneous_threshold_milliseconds": 250 - } - }, - { - "type": "basic", + "basic.to_if_alone_timeout_milliseconds": 200 + }, "conditions": [ { - "type": "variable_if", - "name": "d_held", - "value": true - } - ], - "from": { - "key_code": "o", - "modifiers": { - "optional": [ - "any" + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } ] - } - }, - "to": [ + }, { - "key_code": "9" + "type": "variable_unless", + "name": "f_held", + "value": true } ] }, @@ -1801,10 +6340,10 @@ "from": { "simultaneous": [ { - "key_code": "d" + "key_code": "x" }, { - "key_code": "p" + "key_code": "y" } ], "simultaneous_options": { @@ -1821,30 +6360,57 @@ "to": [ { "set_variable": { - "name": "d_held", + "name": "x_held", "value": true, "key_up_value": false } }, { - "key_code": "0" + "consumer_key_code": "volume_increment" } ], "parameters": { "basic.simultaneous_threshold_milliseconds": 250 - } + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_unless", + "name": "f_held", + "value": true + } + ] }, { "type": "basic", "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, { "type": "variable_if", - "name": "d_held", + "name": "x_held", "value": true } ], "from": { - "key_code": "p", + "key_code": "y", "modifiers": { "optional": [ "any" @@ -1853,53 +6419,19 @@ }, "to": [ { - "key_code": "0" + "consumer_key_code": "volume_increment" } ] - } - ] - }, - { - "description": "v layer: punctuation + h→~ + y→¥", - "manipulators": [ - { - "type": "basic", - "from": { - "key_code": "v", - "modifiers": { - "optional": [ - "caps_lock", - "shift" - ] - } - }, - "to": [ - { - "set_variable": { - "name": "v_held", - "value": true, - "key_up_value": false - } - } - ], - "to_if_alone": [ - { - "key_code": "v" - } - ], - "parameters": { - "basic.to_if_alone_timeout_milliseconds": 200 - } }, { "type": "basic", "from": { "simultaneous": [ { - "key_code": "v" + "key_code": "x" }, { - "key_code": "n" + "key_code": "u" } ], "simultaneous_options": { @@ -1916,30 +6448,57 @@ "to": [ { "set_variable": { - "name": "v_held", + "name": "x_held", "value": true, "key_up_value": false } }, { - "key_code": "comma" + "consumer_key_code": "rewind" } ], "parameters": { "basic.simultaneous_threshold_milliseconds": 250 - } + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_unless", + "name": "f_held", + "value": true + } + ] }, { "type": "basic", "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, { "type": "variable_if", - "name": "v_held", + "name": "x_held", "value": true } ], "from": { - "key_code": "n", + "key_code": "u", "modifiers": { "optional": [ "any" @@ -1948,7 +6507,7 @@ }, "to": [ { - "key_code": "comma" + "consumer_key_code": "rewind" } ] }, @@ -1957,10 +6516,10 @@ "from": { "simultaneous": [ { - "key_code": "v" + "key_code": "x" }, { - "key_code": "m" + "key_code": "i" } ], "simultaneous_options": { @@ -1977,30 +6536,57 @@ "to": [ { "set_variable": { - "name": "v_held", + "name": "x_held", "value": true, "key_up_value": false } }, { - "key_code": "period" + "consumer_key_code": "play_or_pause" } ], "parameters": { "basic.simultaneous_threshold_milliseconds": 250 - } + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_unless", + "name": "f_held", + "value": true + } + ] }, { "type": "basic", "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, { "type": "variable_if", - "name": "v_held", + "name": "x_held", "value": true } ], "from": { - "key_code": "m", + "key_code": "i", "modifiers": { "optional": [ "any" @@ -2009,7 +6595,7 @@ }, "to": [ { - "key_code": "period" + "consumer_key_code": "play_or_pause" } ] }, @@ -2018,10 +6604,10 @@ "from": { "simultaneous": [ { - "key_code": "v" + "key_code": "x" }, { - "key_code": "comma" + "key_code": "o" } ], "simultaneous_options": { @@ -2038,30 +6624,57 @@ "to": [ { "set_variable": { - "name": "v_held", + "name": "x_held", "value": true, "key_up_value": false } }, { - "key_code": "slash" + "consumer_key_code": "fast_forward" } ], "parameters": { "basic.simultaneous_threshold_milliseconds": 250 - } + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_unless", + "name": "f_held", + "value": true + } + ] }, { "type": "basic", "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, { "type": "variable_if", - "name": "v_held", + "name": "x_held", "value": true } ], "from": { - "key_code": "comma", + "key_code": "o", "modifiers": { "optional": [ "any" @@ -2070,7 +6683,7 @@ }, "to": [ { - "key_code": "slash" + "consumer_key_code": "fast_forward" } ] }, @@ -2079,10 +6692,10 @@ "from": { "simultaneous": [ { - "key_code": "v" + "key_code": "x" }, { - "key_code": "j" + "key_code": "h" } ], "simultaneous_options": { @@ -2099,30 +6712,57 @@ "to": [ { "set_variable": { - "name": "v_held", + "name": "x_held", "value": true, "key_up_value": false } }, { - "key_code": "semicolon" + "consumer_key_code": "volume_decrement" } ], "parameters": { "basic.simultaneous_threshold_milliseconds": 250 - } + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_unless", + "name": "f_held", + "value": true + } + ] }, { "type": "basic", "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, { "type": "variable_if", - "name": "v_held", + "name": "x_held", "value": true } ], "from": { - "key_code": "j", + "key_code": "h", "modifiers": { "optional": [ "any" @@ -2131,7 +6771,7 @@ }, "to": [ { - "key_code": "semicolon" + "consumer_key_code": "volume_decrement" } ] }, @@ -2140,10 +6780,10 @@ "from": { "simultaneous": [ { - "key_code": "v" + "key_code": "x" }, { - "key_code": "k" + "key_code": "j" } ], "simultaneous_options": { @@ -2160,30 +6800,57 @@ "to": [ { "set_variable": { - "name": "v_held", + "name": "x_held", "value": true, "key_up_value": false } }, { - "key_code": "quote" + "key_code": "launchpad" } ], "parameters": { "basic.simultaneous_threshold_milliseconds": 250 - } + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_unless", + "name": "f_held", + "value": true + } + ] }, { "type": "basic", "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, { "type": "variable_if", - "name": "v_held", + "name": "x_held", "value": true } ], "from": { - "key_code": "k", + "key_code": "j", "modifiers": { "optional": [ "any" @@ -2192,7 +6859,7 @@ }, "to": [ { - "key_code": "quote" + "key_code": "launchpad" } ] }, @@ -2201,10 +6868,10 @@ "from": { "simultaneous": [ { - "key_code": "v" + "key_code": "x" }, { - "key_code": "l" + "key_code": "k" } ], "simultaneous_options": { @@ -2221,30 +6888,57 @@ "to": [ { "set_variable": { - "name": "v_held", + "name": "x_held", "value": true, "key_up_value": false } }, { - "key_code": "backslash" + "key_code": "display_brightness_decrement" } ], "parameters": { "basic.simultaneous_threshold_milliseconds": 250 - } + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_unless", + "name": "f_held", + "value": true + } + ] }, { "type": "basic", "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, { "type": "variable_if", - "name": "v_held", + "name": "x_held", "value": true } ], "from": { - "key_code": "l", + "key_code": "k", "modifiers": { "optional": [ "any" @@ -2253,7 +6947,7 @@ }, "to": [ { - "key_code": "backslash" + "key_code": "display_brightness_decrement" } ] }, @@ -2262,10 +6956,10 @@ "from": { "simultaneous": [ { - "key_code": "v" + "key_code": "x" }, { - "key_code": "u" + "key_code": "l" } ], "simultaneous_options": { @@ -2282,30 +6976,57 @@ "to": [ { "set_variable": { - "name": "v_held", + "name": "x_held", "value": true, "key_up_value": false } }, { - "key_code": "hyphen" + "key_code": "display_brightness_increment" } ], "parameters": { "basic.simultaneous_threshold_milliseconds": 250 - } + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_unless", + "name": "f_held", + "value": true + } + ] }, { "type": "basic", "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, { "type": "variable_if", - "name": "v_held", + "name": "x_held", "value": true } ], "from": { - "key_code": "u", + "key_code": "l", "modifiers": { "optional": [ "any" @@ -2314,7 +7035,7 @@ }, "to": [ { - "key_code": "hyphen" + "key_code": "display_brightness_increment" } ] }, @@ -2323,10 +7044,10 @@ "from": { "simultaneous": [ { - "key_code": "v" + "key_code": "x" }, { - "key_code": "i" + "key_code": "p" } ], "simultaneous_options": { @@ -2343,30 +7064,57 @@ "to": [ { "set_variable": { - "name": "v_held", + "name": "x_held", "value": true, "key_up_value": false } }, { - "key_code": "equal_sign" + "consumer_key_code": "mute" } ], "parameters": { "basic.simultaneous_threshold_milliseconds": 250 - } + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_unless", + "name": "f_held", + "value": true + } + ] }, { "type": "basic", "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, { "type": "variable_if", - "name": "v_held", + "name": "x_held", "value": true } ], "from": { - "key_code": "i", + "key_code": "p", "modifiers": { "optional": [ "any" @@ -2375,7 +7123,7 @@ }, "to": [ { - "key_code": "equal_sign" + "consumer_key_code": "mute" } ] }, @@ -2384,10 +7132,10 @@ "from": { "simultaneous": [ { - "key_code": "v" + "key_code": "x" }, { - "key_code": "o" + "key_code": "n" } ], "simultaneous_options": { @@ -2404,30 +7152,57 @@ "to": [ { "set_variable": { - "name": "v_held", + "name": "x_held", "value": true, "key_up_value": false } }, { - "key_code": "open_bracket" + "key_code": "display_brightness_decrement" } ], "parameters": { "basic.simultaneous_threshold_milliseconds": 250 - } + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_unless", + "name": "f_held", + "value": true + } + ] }, { "type": "basic", "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, { "type": "variable_if", - "name": "v_held", + "name": "x_held", "value": true } ], "from": { - "key_code": "o", + "key_code": "n", "modifiers": { "optional": [ "any" @@ -2436,7 +7211,7 @@ }, "to": [ { - "key_code": "open_bracket" + "key_code": "display_brightness_decrement" } ] }, @@ -2445,10 +7220,10 @@ "from": { "simultaneous": [ { - "key_code": "v" + "key_code": "x" }, { - "key_code": "p" + "key_code": "m" } ], "simultaneous_options": { @@ -2465,30 +7240,57 @@ "to": [ { "set_variable": { - "name": "v_held", + "name": "x_held", "value": true, "key_up_value": false } }, { - "key_code": "close_bracket" + "key_code": "display_brightness_increment" } ], "parameters": { "basic.simultaneous_threshold_milliseconds": 250 - } + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_unless", + "name": "f_held", + "value": true + } + ] }, { "type": "basic", "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, { "type": "variable_if", - "name": "v_held", + "name": "x_held", "value": true } ], "from": { - "key_code": "p", + "key_code": "m", "modifiers": { "optional": [ "any" @@ -2497,7 +7299,7 @@ }, "to": [ { - "key_code": "close_bracket" + "key_code": "display_brightness_increment" } ] }, @@ -2506,10 +7308,10 @@ "from": { "simultaneous": [ { - "key_code": "v" + "key_code": "x" }, { - "key_code": "h" + "key_code": "comma" } ], "simultaneous_options": { @@ -2526,33 +7328,57 @@ "to": [ { "set_variable": { - "name": "v_held", + "name": "x_held", "value": true, "key_up_value": false } }, { - "key_code": "grave_accent_and_tilde", - "modifiers": [ - "left_shift" - ] + "key_code": "mission_control" } ], "parameters": { "basic.simultaneous_threshold_milliseconds": 250 - } + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_unless", + "name": "f_held", + "value": true + } + ] }, { "type": "basic", "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, { "type": "variable_if", - "name": "v_held", + "name": "x_held", "value": true } ], "from": { - "key_code": "h", + "key_code": "comma", "modifiers": { "optional": [ "any" @@ -2561,71 +7387,56 @@ }, "to": [ { - "key_code": "grave_accent_and_tilde", - "modifiers": [ - "left_shift" - ] + "key_code": "mission_control" } ] - }, + } + ] + }, + { + "description": "z hold=Control(Toraboと同じ)。単押しは z", + "manipulators": [ { "type": "basic", "from": { - "simultaneous": [ - { - "key_code": "v" - }, - { - "key_code": "y" - } - ], - "simultaneous_options": { - "key_down_order": "strict", - "key_up_when": "all" - }, + "key_code": "z", "modifiers": { "optional": [ - "caps_lock", - "shift" + "caps_lock" ] } }, "to": [ { "set_variable": { - "name": "v_held", + "name": "z_ctrl", "value": true, "key_up_value": false } }, { - "key_code": "international3" + "key_code": "left_control", + "lazy": true } ], - "parameters": { - "basic.simultaneous_threshold_milliseconds": 250 - } - }, - { - "type": "basic", - "conditions": [ + "to_if_alone": [ { - "type": "variable_if", - "name": "v_held", - "value": true + "key_code": "z" } ], - "from": { - "key_code": "y", - "modifiers": { - "optional": [ - "any" - ] - } + "parameters": { + "basic.to_if_alone_timeout_milliseconds": 200 }, - "to": [ + "conditions": [ { - "key_code": "international3" + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] } ] } diff --git a/.config/karabiner/karabiner.json b/.config/karabiner/karabiner.json index d9d665f..ce898a0 100644 --- a/.config/karabiner/karabiner.json +++ b/.config/karabiner/karabiner.json @@ -42,16 +42,25 @@ ] }, { - "description": "f layer; f+n=ABC f+m=あいう; f+b=HUD; 英数 tap=Enter hold=⌘; f↔英数 either order +a = app switcher; space hold=Shift", + "description": "Torabo の F1–F12 を macOS の設定に合わせて標準ファンクションキーとして送る", "manipulators": [ { "type": "basic", + "conditions": [ + { + "type": "device_if", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + } + ], "from": { - "key_code": "f", + "key_code": "f1", "modifiers": { - "mandatory": [ - "command" - ], "optional": [ "any" ] @@ -59,43 +68,46 @@ }, "to": [ { - "set_variable": { - "name": "f_cmd_layer", - "value": true, - "key_up_value": false - } + "key_code": "f1", + "conditions": [ + { + "type": "variable_if", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] }, { - "set_variable": { - "name": "f_held", - "value": true, - "key_up_value": false - } - } - ], - "to_if_alone": [ - { - "key_code": "f", + "key_code": "f1", "modifiers": [ - "left_command" + "fn" + ], + "conditions": [ + { + "type": "variable_unless", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } ] } - ], - "parameters": { - "basic.to_if_alone_timeout_milliseconds": 200 - } + ] }, { "type": "basic", "conditions": [ { - "type": "variable_if", - "name": "eisuu_cmd", - "value": true + "type": "device_if", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] } ], "from": { - "key_code": "f", + "key_code": "f2", "modifiers": { "optional": [ "any" @@ -104,43 +116,46 @@ }, "to": [ { - "set_variable": { - "name": "f_cmd_layer", - "value": true, - "key_up_value": false - } + "key_code": "f2", + "conditions": [ + { + "type": "variable_if", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] }, { - "set_variable": { - "name": "f_held", - "value": true, - "key_up_value": false - } - } - ], - "to_if_alone": [ - { - "key_code": "f", + "key_code": "f2", "modifiers": [ - "left_command" + "fn" + ], + "conditions": [ + { + "type": "variable_unless", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } ] } - ], - "parameters": { - "basic.to_if_alone_timeout_milliseconds": 200 - } + ] }, { "type": "basic", "conditions": [ { - "type": "variable_if", - "name": "f_cmd_layer", - "value": true + "type": "device_if", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] } ], "from": { - "key_code": "h", + "key_code": "f3", "modifiers": { "optional": [ "any" @@ -149,7 +164,27 @@ }, "to": [ { - "key_code": "left_arrow" + "key_code": "f3", + "conditions": [ + { + "type": "variable_if", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] + }, + { + "key_code": "f3", + "modifiers": [ + "fn" + ], + "conditions": [ + { + "type": "variable_unless", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] } ] }, @@ -157,13 +192,18 @@ "type": "basic", "conditions": [ { - "type": "variable_if", - "name": "f_cmd_layer", - "value": true + "type": "device_if", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] } ], "from": { - "key_code": "j", + "key_code": "f4", "modifiers": { "optional": [ "any" @@ -172,7 +212,27 @@ }, "to": [ { - "key_code": "down_arrow" + "key_code": "f4", + "conditions": [ + { + "type": "variable_if", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] + }, + { + "key_code": "f4", + "modifiers": [ + "fn" + ], + "conditions": [ + { + "type": "variable_unless", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] } ] }, @@ -180,13 +240,18 @@ "type": "basic", "conditions": [ { - "type": "variable_if", - "name": "f_cmd_layer", - "value": true + "type": "device_if", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] } ], "from": { - "key_code": "k", + "key_code": "f5", "modifiers": { "optional": [ "any" @@ -195,7 +260,27 @@ }, "to": [ { - "key_code": "up_arrow" + "key_code": "f5", + "conditions": [ + { + "type": "variable_if", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] + }, + { + "key_code": "f5", + "modifiers": [ + "fn" + ], + "conditions": [ + { + "type": "variable_unless", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] } ] }, @@ -203,13 +288,18 @@ "type": "basic", "conditions": [ { - "type": "variable_if", - "name": "f_cmd_layer", - "value": true + "type": "device_if", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] } ], "from": { - "key_code": "l", + "key_code": "f6", "modifiers": { "optional": [ "any" @@ -218,7 +308,27 @@ }, "to": [ { - "key_code": "right_arrow" + "key_code": "f6", + "conditions": [ + { + "type": "variable_if", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] + }, + { + "key_code": "f6", + "modifiers": [ + "fn" + ], + "conditions": [ + { + "type": "variable_unless", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] } ] }, @@ -226,18 +336,18 @@ "type": "basic", "conditions": [ { - "type": "variable_if", - "name": "f_held", - "value": true - }, - { - "type": "variable_if", - "name": "eisuu_cmd", - "value": true + "type": "device_if", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] } ], "from": { - "key_code": "a", + "key_code": "f7", "modifiers": { "optional": [ "any" @@ -246,9 +356,26 @@ }, "to": [ { - "key_code": "tab", + "key_code": "f7", + "conditions": [ + { + "type": "variable_if", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] + }, + { + "key_code": "f7", "modifiers": [ - "left_command" + "fn" + ], + "conditions": [ + { + "type": "variable_unless", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } ] } ] @@ -257,18 +384,18 @@ "type": "basic", "conditions": [ { - "type": "variable_if", - "name": "f_cmd_layer", - "value": true - }, - { - "type": "variable_if", - "name": "space_shift", - "value": true + "type": "device_if", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] } ], "from": { - "key_code": "a", + "key_code": "f8", "modifiers": { "optional": [ "any" @@ -277,10 +404,26 @@ }, "to": [ { - "key_code": "tab", + "key_code": "f8", + "conditions": [ + { + "type": "variable_if", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] + }, + { + "key_code": "f8", "modifiers": [ - "left_command", - "left_shift" + "fn" + ], + "conditions": [ + { + "type": "variable_unless", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } ] } ] @@ -289,13 +432,18 @@ "type": "basic", "conditions": [ { - "type": "variable_if", - "name": "f_cmd_layer", - "value": true + "type": "device_if", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] } ], "from": { - "key_code": "a", + "key_code": "f9", "modifiers": { "optional": [ "any" @@ -304,22 +452,3464 @@ }, "to": [ { - "key_code": "tab", + "key_code": "f9", + "conditions": [ + { + "type": "variable_if", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] + }, + { + "key_code": "f9", "modifiers": [ - "left_command" + "fn" + ], + "conditions": [ + { + "type": "variable_unless", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } ] } ] }, { "type": "basic", - "from": { - "simultaneous": [ - { - "key_code": "f" - }, + "conditions": [ + { + "type": "device_if", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + } + ], + "from": { + "key_code": "f10", + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "key_code": "f10", + "conditions": [ + { + "type": "variable_if", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] + }, + { + "key_code": "f10", + "modifiers": [ + "fn" + ], + "conditions": [ + { + "type": "variable_unless", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] + } + ] + }, + { + "type": "basic", + "conditions": [ + { + "type": "device_if", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + } + ], + "from": { + "key_code": "f11", + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "key_code": "f11", + "conditions": [ + { + "type": "variable_if", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] + }, + { + "key_code": "f11", + "modifiers": [ + "fn" + ], + "conditions": [ + { + "type": "variable_unless", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] + } + ] + }, + { + "type": "basic", + "conditions": [ + { + "type": "device_if", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + } + ], + "from": { + "key_code": "f12", + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "key_code": "f12", + "conditions": [ + { + "type": "variable_if", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] + }, + { + "key_code": "f12", + "modifiers": [ + "fn" + ], + "conditions": [ + { + "type": "variable_unless", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] + } + ] + } + ] + }, + { + "description": "Torabo 以外で右 Shift の左隣のキーをハイフンにする", + "manipulators": [ + { + "type": "basic", + "from": { + "key_code": "international1", + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "key_code": "hyphen" + } + ], + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + } + ] + } + ] + }, + { + "description": "f layer (=Torabo L2); hjkl arrows; q Esc; e/u ⌫; p ⌦; a/s Tab; d ⌘; f+n=ABC f+m=あいう; f+b=HUD; 英数 tap=Enter hold=⌘; space hold=Shift", + "manipulators": [ + { + "type": "basic", + "from": { + "key_code": "f", + "modifiers": { + "mandatory": [ + "command" + ], + "optional": [ + "any" + ] + } + }, + "to": [ + { + "set_variable": { + "name": "f_cmd_layer", + "value": true, + "key_up_value": false + } + }, + { + "set_variable": { + "name": "f_held", + "value": true, + "key_up_value": false + } + } + ], + "to_if_alone": [ + { + "key_code": "f", + "modifiers": [ + "left_command" + ] + } + ], + "parameters": { + "basic.to_if_alone_timeout_milliseconds": 200 + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + } + ] + }, + { + "type": "basic", + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_if", + "name": "eisuu_cmd", + "value": true + } + ], + "from": { + "key_code": "f", + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "set_variable": { + "name": "f_cmd_layer", + "value": true, + "key_up_value": false + } + }, + { + "set_variable": { + "name": "f_held", + "value": true, + "key_up_value": false + } + } + ], + "to_if_alone": [ + { + "key_code": "f", + "modifiers": [ + "left_command" + ] + } + ], + "parameters": { + "basic.to_if_alone_timeout_milliseconds": 200 + } + }, + { + "type": "basic", + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_if", + "name": "f_cmd_layer", + "value": true + } + ], + "from": { + "key_code": "h", + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "key_code": "left_arrow" + } + ] + }, + { + "type": "basic", + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_if", + "name": "f_cmd_layer", + "value": true + } + ], + "from": { + "key_code": "j", + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "key_code": "down_arrow" + } + ] + }, + { + "type": "basic", + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_if", + "name": "f_cmd_layer", + "value": true + } + ], + "from": { + "key_code": "k", + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "key_code": "up_arrow" + } + ] + }, + { + "type": "basic", + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_if", + "name": "f_cmd_layer", + "value": true + } + ], + "from": { + "key_code": "l", + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "key_code": "right_arrow" + } + ] + }, + { + "type": "basic", + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_if", + "name": "f_held", + "value": true + }, + { + "type": "variable_if", + "name": "eisuu_cmd", + "value": true + } + ], + "from": { + "key_code": "a", + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "key_code": "tab", + "modifiers": [ + "left_command" + ] + } + ] + }, + { + "type": "basic", + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_if", + "name": "f_cmd_layer", + "value": true + }, + { + "type": "variable_if", + "name": "space_shift", + "value": true + } + ], + "from": { + "key_code": "a", + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "key_code": "tab", + "modifiers": [ + "left_command", + "left_shift" + ] + } + ] + }, + { + "type": "basic", + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_if", + "name": "f_cmd_layer", + "value": true + } + ], + "from": { + "key_code": "a", + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "key_code": "tab", + "modifiers": [ + "left_command" + ] + } + ] + }, + { + "type": "basic", + "from": { + "simultaneous": [ + { + "key_code": "f" + }, + { + "key_code": "h" + } + ], + "simultaneous_options": { + "key_down_order": "strict", + "key_up_when": "all" + }, + "modifiers": { + "mandatory": [ + "command" + ], + "optional": [ + "any" + ] + } + }, + "to": [ + { + "key_code": "left_arrow" + } + ], + "parameters": { + "basic.simultaneous_threshold_milliseconds": 500 + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + } + ] + }, + { + "type": "basic", + "from": { + "simultaneous": [ + { + "key_code": "f" + }, + { + "key_code": "j" + } + ], + "simultaneous_options": { + "key_down_order": "strict", + "key_up_when": "all" + }, + "modifiers": { + "mandatory": [ + "command" + ], + "optional": [ + "any" + ] + } + }, + "to": [ + { + "key_code": "down_arrow" + } + ], + "parameters": { + "basic.simultaneous_threshold_milliseconds": 500 + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + } + ] + }, + { + "type": "basic", + "from": { + "simultaneous": [ + { + "key_code": "f" + }, + { + "key_code": "k" + } + ], + "simultaneous_options": { + "key_down_order": "strict", + "key_up_when": "all" + }, + "modifiers": { + "mandatory": [ + "command" + ], + "optional": [ + "any" + ] + } + }, + "to": [ + { + "key_code": "up_arrow" + } + ], + "parameters": { + "basic.simultaneous_threshold_milliseconds": 500 + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + } + ] + }, + { + "type": "basic", + "from": { + "simultaneous": [ + { + "key_code": "f" + }, + { + "key_code": "l" + } + ], + "simultaneous_options": { + "key_down_order": "strict", + "key_up_when": "all" + }, + "modifiers": { + "mandatory": [ + "command" + ], + "optional": [ + "any" + ] + } + }, + "to": [ + { + "key_code": "right_arrow" + } + ], + "parameters": { + "basic.simultaneous_threshold_milliseconds": 500 + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + } + ] + }, + { + "type": "basic", + "from": { + "simultaneous": [ + { + "key_code": "f" + }, + { + "key_code": "a" + } + ], + "simultaneous_options": { + "key_down_order": "strict", + "key_up_when": "all" + }, + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "key_code": "tab", + "modifiers": [ + "left_command" + ] + } + ], + "parameters": { + "basic.simultaneous_threshold_milliseconds": 500 + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_if", + "name": "eisuu_cmd", + "value": true + } + ] + }, + { + "type": "basic", + "from": { + "key_code": "f", + "modifiers": { + "optional": [ + "caps_lock" + ] + } + }, + "to": [ + { + "set_variable": { + "name": "f_held", + "value": true, + "key_up_value": false + } + } + ], + "to_if_alone": [ + { + "key_code": "f" + } + ], + "parameters": { + "basic.to_if_alone_timeout_milliseconds": 200 + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + } + ] + }, + { + "type": "basic", + "from": { + "simultaneous": [ + { + "key_code": "f" + }, + { + "key_code": "h" + } + ], + "simultaneous_options": { + "key_down_order": "strict", + "key_up_when": "all" + }, + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "set_variable": { + "name": "f_held", + "value": true, + "key_up_value": false + } + }, + { + "key_code": "left_arrow" + } + ], + "parameters": { + "basic.simultaneous_threshold_milliseconds": 250 + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + } + ] + }, + { + "type": "basic", + "from": { + "simultaneous": [ + { + "key_code": "f" + }, + { + "key_code": "j" + } + ], + "simultaneous_options": { + "key_down_order": "strict", + "key_up_when": "all" + }, + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "set_variable": { + "name": "f_held", + "value": true, + "key_up_value": false + } + }, + { + "key_code": "down_arrow" + } + ], + "parameters": { + "basic.simultaneous_threshold_milliseconds": 250 + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + } + ] + }, + { + "type": "basic", + "from": { + "simultaneous": [ + { + "key_code": "f" + }, + { + "key_code": "k" + } + ], + "simultaneous_options": { + "key_down_order": "strict", + "key_up_when": "all" + }, + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "set_variable": { + "name": "f_held", + "value": true, + "key_up_value": false + } + }, + { + "key_code": "up_arrow" + } + ], + "parameters": { + "basic.simultaneous_threshold_milliseconds": 250 + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + } + ] + }, + { + "type": "basic", + "from": { + "simultaneous": [ + { + "key_code": "f" + }, + { + "key_code": "l" + } + ], + "simultaneous_options": { + "key_down_order": "strict", + "key_up_when": "all" + }, + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "set_variable": { + "name": "f_held", + "value": true, + "key_up_value": false + } + }, + { + "key_code": "right_arrow" + } + ], + "parameters": { + "basic.simultaneous_threshold_milliseconds": 250 + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + } + ] + }, + { + "type": "basic", + "from": { + "simultaneous": [ + { + "key_code": "f" + }, + { + "key_code": "e" + } + ], + "simultaneous_options": { + "key_down_order": "strict", + "key_up_when": "all" + }, + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "set_variable": { + "name": "f_held", + "value": true, + "key_up_value": false + } + }, + { + "key_code": "delete_or_backspace" + } + ], + "parameters": { + "basic.simultaneous_threshold_milliseconds": 250 + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + } + ] + }, + { + "type": "basic", + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_if", + "name": "f_held", + "value": true + } + ], + "from": { + "key_code": "h", + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "key_code": "left_arrow" + } + ] + }, + { + "type": "basic", + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_if", + "name": "f_held", + "value": true + } + ], + "from": { + "key_code": "j", + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "key_code": "down_arrow" + } + ] + }, + { + "type": "basic", + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_if", + "name": "f_held", + "value": true + } + ], + "from": { + "key_code": "k", + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "key_code": "up_arrow" + } + ] + }, + { + "type": "basic", + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_if", + "name": "f_held", + "value": true + } + ], + "from": { + "key_code": "l", + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "key_code": "right_arrow" + } + ] + }, + { + "type": "basic", + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_if", + "name": "f_held", + "value": true + } + ], + "from": { + "key_code": "e", + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "key_code": "delete_or_backspace" + } + ] + }, + { + "type": "basic", + "from": { + "simultaneous": [ + { + "key_code": "f" + }, + { + "key_code": "a" + } + ], + "simultaneous_options": { + "key_down_order": "strict", + "key_up_when": "all" + }, + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "set_variable": { + "name": "f_held", + "value": true, + "key_up_value": false + } + }, + { + "key_code": "tab" + } + ], + "parameters": { + "basic.simultaneous_threshold_milliseconds": 250 + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + } + ] + }, + { + "type": "basic", + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_if", + "name": "f_held", + "value": true + } + ], + "from": { + "key_code": "a", + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "key_code": "tab" + } + ] + }, + { + "type": "basic", + "from": { + "simultaneous": [ + { + "key_code": "f" + }, + { + "key_code": "q" + } + ], + "simultaneous_options": { + "key_down_order": "strict", + "key_up_when": "all" + }, + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "set_variable": { + "name": "f_held", + "value": true, + "key_up_value": false + } + }, + { + "key_code": "escape" + } + ], + "parameters": { + "basic.simultaneous_threshold_milliseconds": 250 + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + } + ] + }, + { + "type": "basic", + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_if", + "name": "f_held", + "value": true + } + ], + "from": { + "key_code": "q", + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "key_code": "escape" + } + ] + }, + { + "type": "basic", + "from": { + "simultaneous": [ + { + "key_code": "f" + }, + { + "key_code": "u" + } + ], + "simultaneous_options": { + "key_down_order": "strict", + "key_up_when": "all" + }, + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "set_variable": { + "name": "f_held", + "value": true, + "key_up_value": false + } + }, + { + "key_code": "delete_or_backspace" + } + ], + "parameters": { + "basic.simultaneous_threshold_milliseconds": 250 + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + } + ] + }, + { + "type": "basic", + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_if", + "name": "f_held", + "value": true + } + ], + "from": { + "key_code": "u", + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "key_code": "delete_or_backspace" + } + ] + }, + { + "type": "basic", + "from": { + "simultaneous": [ + { + "key_code": "f" + }, + { + "key_code": "s" + } + ], + "simultaneous_options": { + "key_down_order": "strict", + "key_up_when": "all" + }, + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "set_variable": { + "name": "f_held", + "value": true, + "key_up_value": false + } + }, + { + "key_code": "tab" + } + ], + "parameters": { + "basic.simultaneous_threshold_milliseconds": 250 + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + } + ] + }, + { + "type": "basic", + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_if", + "name": "f_held", + "value": true + } + ], + "from": { + "key_code": "s", + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "key_code": "tab" + } + ] + }, + { + "type": "basic", + "from": { + "simultaneous": [ + { + "key_code": "f" + }, + { + "key_code": "d" + } + ], + "simultaneous_options": { + "key_down_order": "strict", + "key_up_when": "all" + }, + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "set_variable": { + "name": "f_held", + "value": true, + "key_up_value": false + } + }, + { + "key_code": "left_command" + } + ], + "parameters": { + "basic.simultaneous_threshold_milliseconds": 250 + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + } + ] + }, + { + "type": "basic", + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_if", + "name": "f_held", + "value": true + } + ], + "from": { + "key_code": "d", + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "key_code": "left_command" + } + ] + }, + { + "type": "basic", + "from": { + "simultaneous": [ + { + "key_code": "f" + }, + { + "key_code": "p" + } + ], + "simultaneous_options": { + "key_down_order": "strict", + "key_up_when": "all" + }, + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "set_variable": { + "name": "f_held", + "value": true, + "key_up_value": false + } + }, + { + "key_code": "delete_forward" + } + ], + "parameters": { + "basic.simultaneous_threshold_milliseconds": 250 + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + } + ] + }, + { + "type": "basic", + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_if", + "name": "f_held", + "value": true + } + ], + "from": { + "key_code": "p", + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "key_code": "delete_forward" + } + ] + }, + { + "type": "basic", + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_if", + "name": "f_cmd_layer", + "value": true + } + ], + "from": { + "key_code": "spacebar", + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "set_variable": { + "name": "space_shift", + "value": true, + "key_up_value": false + } + }, + { + "key_code": "left_shift" + } + ] + }, + { + "type": "basic", + "from": { + "key_code": "spacebar", + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "set_variable": { + "name": "space_shift", + "value": true, + "key_up_value": false + } + }, + { + "key_code": "left_shift", + "lazy": true + } + ], + "to_if_alone": [ + { + "key_code": "spacebar" + } + ], + "parameters": { + "basic.to_if_alone_timeout_milliseconds": 200 + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + } + ] + }, + { + "type": "basic", + "from": { + "simultaneous": [ + { + "key_code": "f" + }, + { + "key_code": "n" + } + ], + "simultaneous_options": { + "key_down_order": "strict", + "key_up_when": "all" + }, + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "set_variable": { + "name": "f_held", + "value": true, + "key_up_value": false + } + }, + { + "key_code": "japanese_eisuu" + } + ], + "parameters": { + "basic.simultaneous_threshold_milliseconds": 250 + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + } + ] + }, + { + "type": "basic", + "from": { + "simultaneous": [ + { + "key_code": "f" + }, + { + "key_code": "m" + } + ], + "simultaneous_options": { + "key_down_order": "strict", + "key_up_when": "all" + }, + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "set_variable": { + "name": "f_held", + "value": true, + "key_up_value": false + } + }, + { + "key_code": "japanese_kana" + } + ], + "parameters": { + "basic.simultaneous_threshold_milliseconds": 250 + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + } + ] + }, + { + "type": "basic", + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_if", + "name": "f_held", + "value": true + } + ], + "from": { + "key_code": "n", + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "key_code": "japanese_eisuu" + } + ] + }, + { + "type": "basic", + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_if", + "name": "f_held", + "value": true + } + ], + "from": { + "key_code": "m", + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "key_code": "japanese_kana" + } + ] + }, + { + "type": "basic", + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_if", + "name": "f_held", + "value": true + } + ], + "from": { + "key_code": "japanese_eisuu", + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "set_variable": { + "name": "eisuu_cmd", + "value": true, + "key_up_value": false + } + }, + { + "set_variable": { + "name": "f_cmd_layer", + "value": true, + "key_up_value": false + } + }, + { + "key_code": "left_command" + } + ] + }, + { + "type": "basic", + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + } + ], + "from": { + "key_code": "japanese_eisuu", + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "set_variable": { + "name": "eisuu_cmd", + "value": true, + "key_up_value": false + } + }, + { + "key_code": "left_command" + } + ], + "to_if_alone": [ + { + "key_code": "return_or_enter" + } + ], + "parameters": { + "basic.to_if_alone_timeout_milliseconds": 200 + } + }, + { + "type": "basic", + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + } + ], + "from": { + "key_code": "japanese_kana", + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "key_code": "right_command" + } + ], + "to_if_alone": [ + { + "key_code": "return_or_enter" + } + ], + "parameters": { + "basic.to_if_alone_timeout_milliseconds": 200 + } + }, + { + "type": "basic", + "from": { + "simultaneous": [ + { + "key_code": "f" + }, + { + "key_code": "b" + } + ], + "simultaneous_options": { + "key_down_order": "strict", + "key_up_when": "any", + "to_after_key_up": [ + { + "shell_command": "/bin/bash -lc '$HOME/.bin/karabiner-keymap-hud hide'" + } + ] + }, + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "set_variable": { + "name": "f_held", + "value": true, + "key_up_value": false + } + }, + { + "shell_command": "/bin/bash -lc '$HOME/.bin/karabiner-keymap-hud show'" + } + ], + "parameters": { + "basic.simultaneous_threshold_milliseconds": 350 + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + } + ] + }, + { + "type": "basic", + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_if", + "name": "f_held", + "value": true + } + ], + "from": { + "key_code": "b", + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "shell_command": "/bin/bash -lc '$HOME/.bin/karabiner-keymap-hud show'" + } + ], + "to_after_key_up": [ + { + "shell_command": "/bin/bash -lc '$HOME/.bin/karabiner-keymap-hud hide'" + } + ] + } + ] + }, + { + "description": "d layer: n m , j k l u i o p → 1-0 number pad", + "manipulators": [ + { + "type": "basic", + "from": { + "key_code": "d", + "modifiers": { + "optional": [ + "caps_lock", + "shift" + ] + } + }, + "to": [ + { + "set_variable": { + "name": "d_held", + "value": true, + "key_up_value": false + } + } + ], + "to_if_alone": [ + { + "key_code": "d" + } + ], + "parameters": { + "basic.to_if_alone_timeout_milliseconds": 200 + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_unless", + "name": "f_held", + "value": true + } + ] + }, + { + "type": "basic", + "from": { + "simultaneous": [ + { + "key_code": "d" + }, + { + "key_code": "n" + } + ], + "simultaneous_options": { + "key_down_order": "strict", + "key_up_when": "all" + }, + "modifiers": { + "optional": [ + "caps_lock", + "shift" + ] + } + }, + "to": [ + { + "set_variable": { + "name": "d_held", + "value": true, + "key_up_value": false + } + }, + { + "key_code": "1" + } + ], + "parameters": { + "basic.simultaneous_threshold_milliseconds": 250 + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_unless", + "name": "f_held", + "value": true + } + ] + }, + { + "type": "basic", + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_if", + "name": "d_held", + "value": true + } + ], + "from": { + "key_code": "n", + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "key_code": "1" + } + ] + }, + { + "type": "basic", + "from": { + "simultaneous": [ + { + "key_code": "d" + }, + { + "key_code": "m" + } + ], + "simultaneous_options": { + "key_down_order": "strict", + "key_up_when": "all" + }, + "modifiers": { + "optional": [ + "caps_lock", + "shift" + ] + } + }, + "to": [ + { + "set_variable": { + "name": "d_held", + "value": true, + "key_up_value": false + } + }, + { + "key_code": "2" + } + ], + "parameters": { + "basic.simultaneous_threshold_milliseconds": 250 + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_unless", + "name": "f_held", + "value": true + } + ] + }, + { + "type": "basic", + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_if", + "name": "d_held", + "value": true + } + ], + "from": { + "key_code": "m", + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "key_code": "2" + } + ] + }, + { + "type": "basic", + "from": { + "simultaneous": [ + { + "key_code": "d" + }, + { + "key_code": "comma" + } + ], + "simultaneous_options": { + "key_down_order": "strict", + "key_up_when": "all" + }, + "modifiers": { + "optional": [ + "caps_lock", + "shift" + ] + } + }, + "to": [ + { + "set_variable": { + "name": "d_held", + "value": true, + "key_up_value": false + } + }, + { + "key_code": "3" + } + ], + "parameters": { + "basic.simultaneous_threshold_milliseconds": 250 + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_unless", + "name": "f_held", + "value": true + } + ] + }, + { + "type": "basic", + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_if", + "name": "d_held", + "value": true + } + ], + "from": { + "key_code": "comma", + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "key_code": "3" + } + ] + }, + { + "type": "basic", + "from": { + "simultaneous": [ + { + "key_code": "d" + }, + { + "key_code": "j" + } + ], + "simultaneous_options": { + "key_down_order": "strict", + "key_up_when": "all" + }, + "modifiers": { + "optional": [ + "caps_lock", + "shift" + ] + } + }, + "to": [ + { + "set_variable": { + "name": "d_held", + "value": true, + "key_up_value": false + } + }, + { + "key_code": "4" + } + ], + "parameters": { + "basic.simultaneous_threshold_milliseconds": 250 + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_unless", + "name": "f_held", + "value": true + } + ] + }, + { + "type": "basic", + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_if", + "name": "d_held", + "value": true + } + ], + "from": { + "key_code": "j", + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "key_code": "4" + } + ] + }, + { + "type": "basic", + "from": { + "simultaneous": [ + { + "key_code": "d" + }, + { + "key_code": "k" + } + ], + "simultaneous_options": { + "key_down_order": "strict", + "key_up_when": "all" + }, + "modifiers": { + "optional": [ + "caps_lock", + "shift" + ] + } + }, + "to": [ + { + "set_variable": { + "name": "d_held", + "value": true, + "key_up_value": false + } + }, + { + "key_code": "5" + } + ], + "parameters": { + "basic.simultaneous_threshold_milliseconds": 250 + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_unless", + "name": "f_held", + "value": true + } + ] + }, + { + "type": "basic", + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_if", + "name": "d_held", + "value": true + } + ], + "from": { + "key_code": "k", + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "key_code": "5" + } + ] + }, + { + "type": "basic", + "from": { + "simultaneous": [ + { + "key_code": "d" + }, + { + "key_code": "l" + } + ], + "simultaneous_options": { + "key_down_order": "strict", + "key_up_when": "all" + }, + "modifiers": { + "optional": [ + "caps_lock", + "shift" + ] + } + }, + "to": [ + { + "set_variable": { + "name": "d_held", + "value": true, + "key_up_value": false + } + }, + { + "key_code": "6" + } + ], + "parameters": { + "basic.simultaneous_threshold_milliseconds": 250 + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_unless", + "name": "f_held", + "value": true + } + ] + }, + { + "type": "basic", + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_if", + "name": "d_held", + "value": true + } + ], + "from": { + "key_code": "l", + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "key_code": "6" + } + ] + }, + { + "type": "basic", + "from": { + "simultaneous": [ + { + "key_code": "d" + }, + { + "key_code": "u" + } + ], + "simultaneous_options": { + "key_down_order": "strict", + "key_up_when": "all" + }, + "modifiers": { + "optional": [ + "caps_lock", + "shift" + ] + } + }, + "to": [ + { + "set_variable": { + "name": "d_held", + "value": true, + "key_up_value": false + } + }, + { + "key_code": "7" + } + ], + "parameters": { + "basic.simultaneous_threshold_milliseconds": 250 + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_unless", + "name": "f_held", + "value": true + } + ] + }, + { + "type": "basic", + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_if", + "name": "d_held", + "value": true + } + ], + "from": { + "key_code": "u", + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "key_code": "7" + } + ] + }, + { + "type": "basic", + "from": { + "simultaneous": [ + { + "key_code": "d" + }, + { + "key_code": "i" + } + ], + "simultaneous_options": { + "key_down_order": "strict", + "key_up_when": "all" + }, + "modifiers": { + "optional": [ + "caps_lock", + "shift" + ] + } + }, + "to": [ + { + "set_variable": { + "name": "d_held", + "value": true, + "key_up_value": false + } + }, + { + "key_code": "8" + } + ], + "parameters": { + "basic.simultaneous_threshold_milliseconds": 250 + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_unless", + "name": "f_held", + "value": true + } + ] + }, + { + "type": "basic", + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_if", + "name": "d_held", + "value": true + } + ], + "from": { + "key_code": "i", + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "key_code": "8" + } + ] + }, + { + "type": "basic", + "from": { + "simultaneous": [ + { + "key_code": "d" + }, + { + "key_code": "o" + } + ], + "simultaneous_options": { + "key_down_order": "strict", + "key_up_when": "all" + }, + "modifiers": { + "optional": [ + "caps_lock", + "shift" + ] + } + }, + "to": [ + { + "set_variable": { + "name": "d_held", + "value": true, + "key_up_value": false + } + }, + { + "key_code": "9" + } + ], + "parameters": { + "basic.simultaneous_threshold_milliseconds": 250 + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_unless", + "name": "f_held", + "value": true + } + ] + }, + { + "type": "basic", + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_if", + "name": "d_held", + "value": true + } + ], + "from": { + "key_code": "o", + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "key_code": "9" + } + ] + }, + { + "type": "basic", + "from": { + "simultaneous": [ + { + "key_code": "d" + }, + { + "key_code": "p" + } + ], + "simultaneous_options": { + "key_down_order": "strict", + "key_up_when": "all" + }, + "modifiers": { + "optional": [ + "caps_lock", + "shift" + ] + } + }, + "to": [ + { + "set_variable": { + "name": "d_held", + "value": true, + "key_up_value": false + } + }, + { + "key_code": "0" + } + ], + "parameters": { + "basic.simultaneous_threshold_milliseconds": 250 + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_unless", + "name": "f_held", + "value": true + } + ] + }, + { + "type": "basic", + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_if", + "name": "d_held", + "value": true + } + ], + "from": { + "key_code": "p", + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "key_code": "0" + } + ] + } + ] + }, + { + "description": "v layer: punctuation + h→~ + y→¥", + "manipulators": [ + { + "type": "basic", + "from": { + "key_code": "v", + "modifiers": { + "optional": [ + "caps_lock", + "shift" + ] + } + }, + "to": [ + { + "set_variable": { + "name": "v_held", + "value": true, + "key_up_value": false + } + } + ], + "to_if_alone": [ + { + "key_code": "v" + } + ], + "parameters": { + "basic.to_if_alone_timeout_milliseconds": 200 + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_unless", + "name": "f_held", + "value": true + } + ] + }, + { + "type": "basic", + "from": { + "simultaneous": [ + { + "key_code": "v" + }, { - "key_code": "h" + "key_code": "n" + } + ], + "simultaneous_options": { + "key_down_order": "strict", + "key_up_when": "all" + }, + "modifiers": { + "optional": [ + "caps_lock", + "shift" + ] + } + }, + "to": [ + { + "set_variable": { + "name": "v_held", + "value": true, + "key_up_value": false + } + }, + { + "key_code": "comma" + } + ], + "parameters": { + "basic.simultaneous_threshold_milliseconds": 250 + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_unless", + "name": "f_held", + "value": true + } + ] + }, + { + "type": "basic", + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_if", + "name": "v_held", + "value": true + } + ], + "from": { + "key_code": "n", + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "key_code": "comma" + } + ] + }, + { + "type": "basic", + "from": { + "simultaneous": [ + { + "key_code": "v" + }, + { + "key_code": "m" + } + ], + "simultaneous_options": { + "key_down_order": "strict", + "key_up_when": "all" + }, + "modifiers": { + "optional": [ + "caps_lock", + "shift" + ] + } + }, + "to": [ + { + "set_variable": { + "name": "v_held", + "value": true, + "key_up_value": false + } + }, + { + "key_code": "period" + } + ], + "parameters": { + "basic.simultaneous_threshold_milliseconds": 250 + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_unless", + "name": "f_held", + "value": true + } + ] + }, + { + "type": "basic", + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_if", + "name": "v_held", + "value": true + } + ], + "from": { + "key_code": "m", + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "key_code": "period" + } + ] + }, + { + "type": "basic", + "from": { + "simultaneous": [ + { + "key_code": "v" + }, + { + "key_code": "comma" + } + ], + "simultaneous_options": { + "key_down_order": "strict", + "key_up_when": "all" + }, + "modifiers": { + "optional": [ + "caps_lock", + "shift" + ] + } + }, + "to": [ + { + "set_variable": { + "name": "v_held", + "value": true, + "key_up_value": false + } + }, + { + "key_code": "slash" + } + ], + "parameters": { + "basic.simultaneous_threshold_milliseconds": 250 + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_unless", + "name": "f_held", + "value": true + } + ] + }, + { + "type": "basic", + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_if", + "name": "v_held", + "value": true + } + ], + "from": { + "key_code": "comma", + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "key_code": "slash" + } + ] + }, + { + "type": "basic", + "from": { + "simultaneous": [ + { + "key_code": "v" + }, + { + "key_code": "j" } ], "simultaneous_options": { @@ -327,42 +3917,67 @@ "key_up_when": "all" }, "modifiers": { - "mandatory": [ - "command" - ], "optional": [ - "any" + "caps_lock", + "shift" ] } }, "to": [ { - "key_code": "left_arrow" + "set_variable": { + "name": "v_held", + "value": true, + "key_up_value": false + } + }, + { + "key_code": "semicolon" } ], "parameters": { - "basic.simultaneous_threshold_milliseconds": 500 - } + "basic.simultaneous_threshold_milliseconds": 250 + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_unless", + "name": "f_held", + "value": true + } + ] }, { "type": "basic", - "from": { - "simultaneous": [ - { - "key_code": "f" - }, - { - "key_code": "j" - } - ], - "simultaneous_options": { - "key_down_order": "strict", - "key_up_when": "all" + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] }, + { + "type": "variable_if", + "name": "v_held", + "value": true + } + ], + "from": { + "key_code": "j", "modifiers": { - "mandatory": [ - "command" - ], "optional": [ "any" ] @@ -370,19 +3985,16 @@ }, "to": [ { - "key_code": "down_arrow" + "key_code": "semicolon" } - ], - "parameters": { - "basic.simultaneous_threshold_milliseconds": 500 - } + ] }, { "type": "basic", "from": { "simultaneous": [ { - "key_code": "f" + "key_code": "v" }, { "key_code": "k" @@ -393,29 +4005,84 @@ "key_up_when": "all" }, "modifiers": { - "mandatory": [ - "command" - ], "optional": [ - "any" + "caps_lock", + "shift" ] } }, "to": [ { - "key_code": "up_arrow" + "set_variable": { + "name": "v_held", + "value": true, + "key_up_value": false + } + }, + { + "key_code": "quote" } ], "parameters": { - "basic.simultaneous_threshold_milliseconds": 500 - } + "basic.simultaneous_threshold_milliseconds": 250 + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_unless", + "name": "f_held", + "value": true + } + ] + }, + { + "type": "basic", + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_if", + "name": "v_held", + "value": true + } + ], + "from": { + "key_code": "k", + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "key_code": "quote" + } + ] }, { "type": "basic", "from": { "simultaneous": [ { - "key_code": "f" + "key_code": "v" }, { "key_code": "l" @@ -426,32 +4093,87 @@ "key_up_when": "all" }, "modifiers": { - "mandatory": [ - "command" - ], "optional": [ - "any" + "caps_lock", + "shift" ] } }, "to": [ { - "key_code": "right_arrow" + "set_variable": { + "name": "v_held", + "value": true, + "key_up_value": false + } + }, + { + "key_code": "backslash" } ], "parameters": { - "basic.simultaneous_threshold_milliseconds": 500 - } + "basic.simultaneous_threshold_milliseconds": 250 + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_unless", + "name": "f_held", + "value": true + } + ] + }, + { + "type": "basic", + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_if", + "name": "v_held", + "value": true + } + ], + "from": { + "key_code": "l", + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "key_code": "backslash" + } + ] }, { "type": "basic", "from": { "simultaneous": [ { - "key_code": "f" + "key_code": "v" }, { - "key_code": "a" + "key_code": "u" } ], "simultaneous_options": { @@ -460,66 +4182,86 @@ }, "modifiers": { "optional": [ - "any" + "caps_lock", + "shift" ] } }, "to": [ { - "key_code": "tab", - "modifiers": [ - "left_command" - ] + "set_variable": { + "name": "v_held", + "value": true, + "key_up_value": false + } + }, + { + "key_code": "hyphen" } ], "parameters": { - "basic.simultaneous_threshold_milliseconds": 500 + "basic.simultaneous_threshold_milliseconds": 250 }, "conditions": [ { - "type": "variable_if", - "name": "eisuu_cmd", + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_unless", + "name": "f_held", "value": true } ] }, { "type": "basic", + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_if", + "name": "v_held", + "value": true + } + ], "from": { - "key_code": "f", + "key_code": "u", "modifiers": { "optional": [ - "caps_lock" + "any" ] } }, "to": [ { - "set_variable": { - "name": "f_held", - "value": true, - "key_up_value": false - } - } - ], - "to_if_alone": [ - { - "key_code": "f" + "key_code": "hyphen" } - ], - "parameters": { - "basic.to_if_alone_timeout_milliseconds": 200 - } + ] }, { "type": "basic", "from": { "simultaneous": [ { - "key_code": "f" + "key_code": "v" }, { - "key_code": "h" + "key_code": "i" } ], "simultaneous_options": { @@ -528,41 +4270,65 @@ }, "modifiers": { "optional": [ - "any" + "caps_lock", + "shift" ] } }, "to": [ { "set_variable": { - "name": "f_held", + "name": "v_held", "value": true, "key_up_value": false } }, { - "key_code": "left_arrow" + "key_code": "equal_sign" } ], "parameters": { "basic.simultaneous_threshold_milliseconds": 250 - } + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_unless", + "name": "f_held", + "value": true + } + ] }, { "type": "basic", - "from": { - "simultaneous": [ - { - "key_code": "f" - }, - { - "key_code": "j" - } - ], - "simultaneous_options": { - "key_down_order": "strict", - "key_up_when": "all" + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] }, + { + "type": "variable_if", + "name": "v_held", + "value": true + } + ], + "from": { + "key_code": "i", "modifiers": { "optional": [ "any" @@ -571,29 +4337,19 @@ }, "to": [ { - "set_variable": { - "name": "f_held", - "value": true, - "key_up_value": false - } - }, - { - "key_code": "down_arrow" + "key_code": "equal_sign" } - ], - "parameters": { - "basic.simultaneous_threshold_milliseconds": 250 - } + ] }, { "type": "basic", "from": { "simultaneous": [ { - "key_code": "f" + "key_code": "v" }, { - "key_code": "k" + "key_code": "o" } ], "simultaneous_options": { @@ -602,41 +4358,65 @@ }, "modifiers": { "optional": [ - "any" + "caps_lock", + "shift" ] } }, "to": [ { "set_variable": { - "name": "f_held", + "name": "v_held", "value": true, "key_up_value": false } }, { - "key_code": "up_arrow" + "key_code": "open_bracket" } ], "parameters": { "basic.simultaneous_threshold_milliseconds": 250 - } + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_unless", + "name": "f_held", + "value": true + } + ] }, { "type": "basic", - "from": { - "simultaneous": [ - { - "key_code": "f" - }, - { - "key_code": "l" - } - ], - "simultaneous_options": { - "key_down_order": "strict", - "key_up_when": "all" + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] }, + { + "type": "variable_if", + "name": "v_held", + "value": true + } + ], + "from": { + "key_code": "o", "modifiers": { "optional": [ "any" @@ -645,29 +4425,19 @@ }, "to": [ { - "set_variable": { - "name": "f_held", - "value": true, - "key_up_value": false - } - }, - { - "key_code": "right_arrow" + "key_code": "open_bracket" } - ], - "parameters": { - "basic.simultaneous_threshold_milliseconds": 250 - } + ] }, { "type": "basic", "from": { "simultaneous": [ { - "key_code": "f" + "key_code": "v" }, { - "key_code": "e" + "key_code": "p" } ], "simultaneous_options": { @@ -676,83 +4446,65 @@ }, "modifiers": { "optional": [ - "any" + "caps_lock", + "shift" ] } }, "to": [ { "set_variable": { - "name": "f_held", + "name": "v_held", "value": true, "key_up_value": false } }, { - "key_code": "delete_or_backspace" + "key_code": "close_bracket" } ], "parameters": { "basic.simultaneous_threshold_milliseconds": 250 - } - }, - { - "type": "basic", + }, "conditions": [ { - "type": "variable_if", - "name": "f_held", - "value": true - } - ], - "from": { - "key_code": "h", - "modifiers": { - "optional": [ - "any" + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } ] - } - }, - "to": [ - { - "key_code": "left_arrow" - } - ] - }, - { - "type": "basic", - "conditions": [ + }, { - "type": "variable_if", + "type": "variable_unless", "name": "f_held", "value": true } - ], - "from": { - "key_code": "j", - "modifiers": { - "optional": [ - "any" - ] - } - }, - "to": [ - { - "key_code": "down_arrow" - } ] }, { "type": "basic", "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, { "type": "variable_if", - "name": "f_held", + "name": "v_held", "value": true } ], "from": { - "key_code": "k", + "key_code": "p", "modifiers": { "optional": [ "any" @@ -761,44 +4513,89 @@ }, "to": [ { - "key_code": "up_arrow" + "key_code": "close_bracket" } ] }, { "type": "basic", - "conditions": [ - { - "type": "variable_if", - "name": "f_held", - "value": true - } - ], "from": { - "key_code": "l", + "simultaneous": [ + { + "key_code": "v" + }, + { + "key_code": "h" + } + ], + "simultaneous_options": { + "key_down_order": "strict", + "key_up_when": "all" + }, "modifiers": { "optional": [ - "any" + "caps_lock", + "shift" ] } }, "to": [ { - "key_code": "right_arrow" + "set_variable": { + "name": "v_held", + "value": true, + "key_up_value": false + } + }, + { + "key_code": "grave_accent_and_tilde", + "modifiers": [ + "left_shift" + ] + } + ], + "parameters": { + "basic.simultaneous_threshold_milliseconds": 250 + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_unless", + "name": "f_held", + "value": true } ] }, { "type": "basic", "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, { "type": "variable_if", - "name": "f_held", + "name": "v_held", "value": true } ], "from": { - "key_code": "e", + "key_code": "h", "modifiers": { "optional": [ "any" @@ -807,7 +4604,10 @@ }, "to": [ { - "key_code": "delete_or_backspace" + "key_code": "grave_accent_and_tilde", + "modifiers": [ + "left_shift" + ] } ] }, @@ -816,10 +4616,10 @@ "from": { "simultaneous": [ { - "key_code": "f" + "key_code": "v" }, { - "key_code": "a" + "key_code": "y" } ], "simultaneous_options": { @@ -828,60 +4628,65 @@ }, "modifiers": { "optional": [ - "any" + "caps_lock", + "shift" ] } }, "to": [ { "set_variable": { - "name": "f_held", + "name": "v_held", "value": true, "key_up_value": false } }, { - "key_code": "tab" + "key_code": "international3" } ], "parameters": { "basic.simultaneous_threshold_milliseconds": 250 - } - }, - { - "type": "basic", + }, "conditions": [ { - "type": "variable_if", - "name": "f_held", - "value": true - } - ], - "from": { - "key_code": "a", - "modifiers": { - "optional": [ - "any" + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } ] - } - }, - "to": [ + }, { - "key_code": "tab" + "type": "variable_unless", + "name": "f_held", + "value": true } ] }, { "type": "basic", "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, { "type": "variable_if", - "name": "f_cmd_layer", + "name": "v_held", "value": true } ], "from": { - "key_code": "spacebar", + "key_code": "y", "modifiers": { "optional": [ "any" @@ -890,58 +4695,70 @@ }, "to": [ { - "set_variable": { - "name": "space_shift", - "value": true, - "key_up_value": false - } - }, - { - "key_code": "left_shift" + "key_code": "international3" } ] - }, + } + ] + }, + { + "description": "c layer (=Torabo L5): macOS の設定に合わせて F1–F12 を標準ファンクションキーとして送る", + "manipulators": [ { "type": "basic", "from": { - "key_code": "spacebar", + "key_code": "c", "modifiers": { "optional": [ - "any" + "caps_lock", + "shift" ] } }, "to": [ { "set_variable": { - "name": "space_shift", + "name": "c_held", "value": true, "key_up_value": false } - }, - { - "key_code": "left_shift", - "lazy": true } ], "to_if_alone": [ { - "key_code": "spacebar" + "key_code": "c" } ], "parameters": { "basic.to_if_alone_timeout_milliseconds": 200 - } + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_unless", + "name": "f_held", + "value": true + } + ] }, { "type": "basic", "from": { "simultaneous": [ { - "key_code": "f" + "key_code": "c" }, { - "key_code": "n" + "key_code": "y" } ], "simultaneous_options": { @@ -950,35 +4767,126 @@ }, "modifiers": { "optional": [ - "any" + "caps_lock", + "shift" ] } }, "to": [ { "set_variable": { - "name": "f_held", + "name": "c_held", "value": true, "key_up_value": false } }, { - "key_code": "japanese_eisuu" + "key_code": "f12", + "conditions": [ + { + "type": "variable_if", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] + }, + { + "key_code": "f12", + "modifiers": [ + "fn" + ], + "conditions": [ + { + "type": "variable_unless", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] } ], "parameters": { "basic.simultaneous_threshold_milliseconds": 250 - } + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_unless", + "name": "f_held", + "value": true + } + ] + }, + { + "type": "basic", + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_if", + "name": "c_held", + "value": true + } + ], + "from": { + "key_code": "y", + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "key_code": "f12", + "conditions": [ + { + "type": "variable_if", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] + }, + { + "key_code": "f12", + "modifiers": [ + "fn" + ], + "conditions": [ + { + "type": "variable_unless", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] + } + ] }, { "type": "basic", "from": { "simultaneous": [ { - "key_code": "f" + "key_code": "c" }, { - "key_code": "m" + "key_code": "u" } ], "simultaneous_options": { @@ -987,83 +4895,85 @@ }, "modifiers": { "optional": [ - "any" + "caps_lock", + "shift" ] } }, "to": [ { "set_variable": { - "name": "f_held", + "name": "c_held", "value": true, "key_up_value": false } }, { - "key_code": "japanese_kana" - } - ], - "parameters": { - "basic.simultaneous_threshold_milliseconds": 250 - } - }, - { - "type": "basic", - "conditions": [ + "key_code": "f7", + "conditions": [ + { + "type": "variable_if", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] + }, { - "type": "variable_if", - "name": "f_held", - "value": true - } - ], - "from": { - "key_code": "n", - "modifiers": { - "optional": [ - "any" + "key_code": "f7", + "modifiers": [ + "fn" + ], + "conditions": [ + { + "type": "variable_unless", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } ] } + ], + "parameters": { + "basic.simultaneous_threshold_milliseconds": 250 }, - "to": [ - { - "key_code": "japanese_eisuu" - } - ] - }, - { - "type": "basic", "conditions": [ { - "type": "variable_if", - "name": "f_held", - "value": true - } - ], - "from": { - "key_code": "m", - "modifiers": { - "optional": [ - "any" + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } ] - } - }, - "to": [ + }, { - "key_code": "japanese_kana" + "type": "variable_unless", + "name": "f_held", + "value": true } ] }, { "type": "basic", "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, { "type": "variable_if", - "name": "f_held", + "name": "c_held", "value": true } ], "from": { - "key_code": "japanese_eisuu", + "key_code": "u", "modifiers": { "optional": [ "any" @@ -1072,59 +4982,126 @@ }, "to": [ { - "set_variable": { - "name": "eisuu_cmd", - "value": true, - "key_up_value": false - } - }, - { - "set_variable": { - "name": "f_cmd_layer", - "value": true, - "key_up_value": false - } + "key_code": "f7", + "conditions": [ + { + "type": "variable_if", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] }, { - "key_code": "left_command" + "key_code": "f7", + "modifiers": [ + "fn" + ], + "conditions": [ + { + "type": "variable_unless", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] } ] }, { "type": "basic", "from": { - "key_code": "japanese_eisuu", + "simultaneous": [ + { + "key_code": "c" + }, + { + "key_code": "i" + } + ], + "simultaneous_options": { + "key_down_order": "strict", + "key_up_when": "all" + }, "modifiers": { "optional": [ - "any" + "caps_lock", + "shift" ] } }, "to": [ { "set_variable": { - "name": "eisuu_cmd", + "name": "c_held", "value": true, "key_up_value": false } }, { - "key_code": "left_command" - } - ], - "to_if_alone": [ + "key_code": "f8", + "conditions": [ + { + "type": "variable_if", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] + }, { - "key_code": "return_or_enter" + "key_code": "f8", + "modifiers": [ + "fn" + ], + "conditions": [ + { + "type": "variable_unless", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] } ], "parameters": { - "basic.to_if_alone_timeout_milliseconds": 200 - } + "basic.simultaneous_threshold_milliseconds": 250 + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_unless", + "name": "f_held", + "value": true + } + ] }, { "type": "basic", + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_if", + "name": "c_held", + "value": true + } + ], "from": { - "key_code": "japanese_kana", + "key_code": "i", "modifiers": { "optional": [ "any" @@ -1133,71 +5110,126 @@ }, "to": [ { - "key_code": "right_command" - } - ], - "to_if_alone": [ + "key_code": "f8", + "conditions": [ + { + "type": "variable_if", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] + }, { - "key_code": "return_or_enter" + "key_code": "f8", + "modifiers": [ + "fn" + ], + "conditions": [ + { + "type": "variable_unless", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] } - ], - "parameters": { - "basic.to_if_alone_timeout_milliseconds": 200 - } + ] }, { "type": "basic", "from": { "simultaneous": [ { - "key_code": "f" + "key_code": "c" }, { - "key_code": "b" + "key_code": "o" } ], "simultaneous_options": { "key_down_order": "strict", - "key_up_when": "any", - "to_after_key_up": [ - { - "shell_command": "/bin/bash -lc '$HOME/.bin/karabiner-keymap-hud hide'" - } - ] + "key_up_when": "all" }, "modifiers": { "optional": [ - "any" + "caps_lock", + "shift" ] } }, "to": [ { "set_variable": { - "name": "f_held", + "name": "c_held", "value": true, "key_up_value": false } }, { - "shell_command": "/bin/bash -lc '$HOME/.bin/karabiner-keymap-hud show'" + "key_code": "f9", + "conditions": [ + { + "type": "variable_if", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] + }, + { + "key_code": "f9", + "modifiers": [ + "fn" + ], + "conditions": [ + { + "type": "variable_unless", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] } ], "parameters": { - "basic.simultaneous_threshold_milliseconds": 350 - } + "basic.simultaneous_threshold_milliseconds": 250 + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_unless", + "name": "f_held", + "value": true + } + ] }, { "type": "basic", "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, { "type": "variable_if", - "name": "f_held", + "name": "c_held", "value": true } ], "from": { - "key_code": "b", + "key_code": "o", "modifiers": { "optional": [ "any" @@ -1206,58 +5238,39 @@ }, "to": [ { - "shell_command": "/bin/bash -lc '$HOME/.bin/karabiner-keymap-hud show'" - } - ], - "to_after_key_up": [ - { - "shell_command": "/bin/bash -lc '$HOME/.bin/karabiner-keymap-hud hide'" - } - ] - } - ] - }, - { - "description": "d layer: n m , j k l u i o p → 1-0 number pad", - "manipulators": [ - { - "type": "basic", - "from": { - "key_code": "d", - "modifiers": { - "optional": [ - "caps_lock", - "shift" + "key_code": "f9", + "conditions": [ + { + "type": "variable_if", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } ] - } - }, - "to": [ - { - "set_variable": { - "name": "d_held", - "value": true, - "key_up_value": false - } - } - ], - "to_if_alone": [ + }, { - "key_code": "d" + "key_code": "f9", + "modifiers": [ + "fn" + ], + "conditions": [ + { + "type": "variable_unless", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] } - ], - "parameters": { - "basic.to_if_alone_timeout_milliseconds": 200 - } + ] }, { "type": "basic", "from": { "simultaneous": [ { - "key_code": "d" + "key_code": "c" }, { - "key_code": "n" + "key_code": "h" } ], "simultaneous_options": { @@ -1274,30 +5287,77 @@ "to": [ { "set_variable": { - "name": "d_held", + "name": "c_held", "value": true, "key_up_value": false } }, { - "key_code": "1" + "key_code": "f11", + "conditions": [ + { + "type": "variable_if", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] + }, + { + "key_code": "f11", + "modifiers": [ + "fn" + ], + "conditions": [ + { + "type": "variable_unless", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] } ], "parameters": { "basic.simultaneous_threshold_milliseconds": 250 - } + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_unless", + "name": "f_held", + "value": true + } + ] }, { "type": "basic", "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, { "type": "variable_if", - "name": "d_held", + "name": "c_held", "value": true } ], "from": { - "key_code": "n", + "key_code": "h", "modifiers": { "optional": [ "any" @@ -1306,7 +5366,27 @@ }, "to": [ { - "key_code": "1" + "key_code": "f11", + "conditions": [ + { + "type": "variable_if", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] + }, + { + "key_code": "f11", + "modifiers": [ + "fn" + ], + "conditions": [ + { + "type": "variable_unless", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] } ] }, @@ -1315,10 +5395,10 @@ "from": { "simultaneous": [ { - "key_code": "d" + "key_code": "c" }, { - "key_code": "m" + "key_code": "j" } ], "simultaneous_options": { @@ -1335,30 +5415,77 @@ "to": [ { "set_variable": { - "name": "d_held", + "name": "c_held", "value": true, "key_up_value": false } }, { - "key_code": "2" + "key_code": "f4", + "conditions": [ + { + "type": "variable_if", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] + }, + { + "key_code": "f4", + "modifiers": [ + "fn" + ], + "conditions": [ + { + "type": "variable_unless", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] } ], "parameters": { "basic.simultaneous_threshold_milliseconds": 250 - } + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_unless", + "name": "f_held", + "value": true + } + ] }, { "type": "basic", "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, { "type": "variable_if", - "name": "d_held", + "name": "c_held", "value": true } ], "from": { - "key_code": "m", + "key_code": "j", "modifiers": { "optional": [ "any" @@ -1367,7 +5494,27 @@ }, "to": [ { - "key_code": "2" + "key_code": "f4", + "conditions": [ + { + "type": "variable_if", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] + }, + { + "key_code": "f4", + "modifiers": [ + "fn" + ], + "conditions": [ + { + "type": "variable_unless", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] } ] }, @@ -1376,10 +5523,10 @@ "from": { "simultaneous": [ { - "key_code": "d" + "key_code": "c" }, { - "key_code": "comma" + "key_code": "k" } ], "simultaneous_options": { @@ -1396,30 +5543,77 @@ "to": [ { "set_variable": { - "name": "d_held", + "name": "c_held", "value": true, "key_up_value": false } }, { - "key_code": "3" + "key_code": "f5", + "conditions": [ + { + "type": "variable_if", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] + }, + { + "key_code": "f5", + "modifiers": [ + "fn" + ], + "conditions": [ + { + "type": "variable_unless", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] } ], "parameters": { "basic.simultaneous_threshold_milliseconds": 250 - } + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_unless", + "name": "f_held", + "value": true + } + ] }, { "type": "basic", "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, { "type": "variable_if", - "name": "d_held", + "name": "c_held", "value": true } ], "from": { - "key_code": "comma", + "key_code": "k", "modifiers": { "optional": [ "any" @@ -1428,7 +5622,27 @@ }, "to": [ { - "key_code": "3" + "key_code": "f5", + "conditions": [ + { + "type": "variable_if", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] + }, + { + "key_code": "f5", + "modifiers": [ + "fn" + ], + "conditions": [ + { + "type": "variable_unless", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] } ] }, @@ -1437,10 +5651,10 @@ "from": { "simultaneous": [ { - "key_code": "d" + "key_code": "c" }, { - "key_code": "j" + "key_code": "l" } ], "simultaneous_options": { @@ -1457,30 +5671,77 @@ "to": [ { "set_variable": { - "name": "d_held", + "name": "c_held", "value": true, "key_up_value": false } }, { - "key_code": "4" + "key_code": "f6", + "conditions": [ + { + "type": "variable_if", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] + }, + { + "key_code": "f6", + "modifiers": [ + "fn" + ], + "conditions": [ + { + "type": "variable_unless", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] } ], "parameters": { "basic.simultaneous_threshold_milliseconds": 250 - } + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_unless", + "name": "f_held", + "value": true + } + ] }, { "type": "basic", "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, { "type": "variable_if", - "name": "d_held", + "name": "c_held", "value": true } ], "from": { - "key_code": "j", + "key_code": "l", "modifiers": { "optional": [ "any" @@ -1489,7 +5750,27 @@ }, "to": [ { - "key_code": "4" + "key_code": "f6", + "conditions": [ + { + "type": "variable_if", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] + }, + { + "key_code": "f6", + "modifiers": [ + "fn" + ], + "conditions": [ + { + "type": "variable_unless", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] } ] }, @@ -1498,10 +5779,10 @@ "from": { "simultaneous": [ { - "key_code": "d" + "key_code": "c" }, { - "key_code": "k" + "key_code": "p" } ], "simultaneous_options": { @@ -1518,30 +5799,77 @@ "to": [ { "set_variable": { - "name": "d_held", + "name": "c_held", "value": true, "key_up_value": false } }, { - "key_code": "5" + "key_code": "f10", + "conditions": [ + { + "type": "variable_if", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] + }, + { + "key_code": "f10", + "modifiers": [ + "fn" + ], + "conditions": [ + { + "type": "variable_unless", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] } ], "parameters": { "basic.simultaneous_threshold_milliseconds": 250 - } + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_unless", + "name": "f_held", + "value": true + } + ] }, { "type": "basic", "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, { "type": "variable_if", - "name": "d_held", + "name": "c_held", "value": true } ], "from": { - "key_code": "k", + "key_code": "p", "modifiers": { "optional": [ "any" @@ -1550,7 +5878,27 @@ }, "to": [ { - "key_code": "5" + "key_code": "f10", + "conditions": [ + { + "type": "variable_if", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] + }, + { + "key_code": "f10", + "modifiers": [ + "fn" + ], + "conditions": [ + { + "type": "variable_unless", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] } ] }, @@ -1559,10 +5907,10 @@ "from": { "simultaneous": [ { - "key_code": "d" + "key_code": "c" }, { - "key_code": "l" + "key_code": "n" } ], "simultaneous_options": { @@ -1579,30 +5927,77 @@ "to": [ { "set_variable": { - "name": "d_held", + "name": "c_held", "value": true, "key_up_value": false } }, { - "key_code": "6" + "key_code": "f1", + "conditions": [ + { + "type": "variable_if", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] + }, + { + "key_code": "f1", + "modifiers": [ + "fn" + ], + "conditions": [ + { + "type": "variable_unless", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] } ], "parameters": { "basic.simultaneous_threshold_milliseconds": 250 - } + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_unless", + "name": "f_held", + "value": true + } + ] }, { "type": "basic", "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, { "type": "variable_if", - "name": "d_held", + "name": "c_held", "value": true } ], "from": { - "key_code": "l", + "key_code": "n", "modifiers": { "optional": [ "any" @@ -1611,7 +6006,27 @@ }, "to": [ { - "key_code": "6" + "key_code": "f1", + "conditions": [ + { + "type": "variable_if", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] + }, + { + "key_code": "f1", + "modifiers": [ + "fn" + ], + "conditions": [ + { + "type": "variable_unless", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] } ] }, @@ -1620,10 +6035,10 @@ "from": { "simultaneous": [ { - "key_code": "d" + "key_code": "c" }, { - "key_code": "u" + "key_code": "m" } ], "simultaneous_options": { @@ -1640,30 +6055,77 @@ "to": [ { "set_variable": { - "name": "d_held", + "name": "c_held", "value": true, "key_up_value": false } }, { - "key_code": "7" + "key_code": "f2", + "conditions": [ + { + "type": "variable_if", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] + }, + { + "key_code": "f2", + "modifiers": [ + "fn" + ], + "conditions": [ + { + "type": "variable_unless", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] } ], "parameters": { "basic.simultaneous_threshold_milliseconds": 250 - } + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_unless", + "name": "f_held", + "value": true + } + ] }, { "type": "basic", "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, { "type": "variable_if", - "name": "d_held", + "name": "c_held", "value": true } ], "from": { - "key_code": "u", + "key_code": "m", "modifiers": { "optional": [ "any" @@ -1672,7 +6134,27 @@ }, "to": [ { - "key_code": "7" + "key_code": "f2", + "conditions": [ + { + "type": "variable_if", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] + }, + { + "key_code": "f2", + "modifiers": [ + "fn" + ], + "conditions": [ + { + "type": "variable_unless", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] } ] }, @@ -1681,10 +6163,10 @@ "from": { "simultaneous": [ { - "key_code": "d" + "key_code": "c" }, { - "key_code": "i" + "key_code": "comma" } ], "simultaneous_options": { @@ -1701,30 +6183,77 @@ "to": [ { "set_variable": { - "name": "d_held", + "name": "c_held", "value": true, "key_up_value": false } }, { - "key_code": "8" + "key_code": "f3", + "conditions": [ + { + "type": "variable_if", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] + }, + { + "key_code": "f3", + "modifiers": [ + "fn" + ], + "conditions": [ + { + "type": "variable_unless", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] } ], "parameters": { "basic.simultaneous_threshold_milliseconds": 250 - } + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_unless", + "name": "f_held", + "value": true + } + ] }, { "type": "basic", "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, { "type": "variable_if", - "name": "d_held", + "name": "c_held", "value": true } ], "from": { - "key_code": "i", + "key_code": "comma", "modifiers": { "optional": [ "any" @@ -1733,25 +6262,39 @@ }, "to": [ { - "key_code": "8" + "key_code": "f3", + "conditions": [ + { + "type": "variable_if", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] + }, + { + "key_code": "f3", + "modifiers": [ + "fn" + ], + "conditions": [ + { + "type": "variable_unless", + "name": "system.use_fkeys_as_standard_function_keys", + "value": true + } + ] } ] - }, + } + ] + }, + { + "description": "x layer (=Torabo L9): 音量・再生・輝度・Launchpad / Mission Control", + "manipulators": [ { "type": "basic", "from": { - "simultaneous": [ - { - "key_code": "d" - }, - { - "key_code": "o" - } - ], - "simultaneous_options": { - "key_down_order": "strict", - "key_up_when": "all" - }, + "key_code": "x", "modifiers": { "optional": [ "caps_lock", @@ -1762,39 +6305,35 @@ "to": [ { "set_variable": { - "name": "d_held", + "name": "x_held", "value": true, "key_up_value": false } - }, + } + ], + "to_if_alone": [ { - "key_code": "9" + "key_code": "x" } ], "parameters": { - "basic.simultaneous_threshold_milliseconds": 250 - } - }, - { - "type": "basic", + "basic.to_if_alone_timeout_milliseconds": 200 + }, "conditions": [ { - "type": "variable_if", - "name": "d_held", - "value": true - } - ], - "from": { - "key_code": "o", - "modifiers": { - "optional": [ - "any" + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } ] - } - }, - "to": [ + }, { - "key_code": "9" + "type": "variable_unless", + "name": "f_held", + "value": true } ] }, @@ -1803,10 +6342,10 @@ "from": { "simultaneous": [ { - "key_code": "d" + "key_code": "x" }, { - "key_code": "p" + "key_code": "y" } ], "simultaneous_options": { @@ -1823,30 +6362,57 @@ "to": [ { "set_variable": { - "name": "d_held", + "name": "x_held", "value": true, "key_up_value": false } }, { - "key_code": "0" + "consumer_key_code": "volume_increment" + } + ], + "parameters": { + "basic.simultaneous_threshold_milliseconds": 250 + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_unless", + "name": "f_held", + "value": true } - ], - "parameters": { - "basic.simultaneous_threshold_milliseconds": 250 - } + ] }, { "type": "basic", "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, { "type": "variable_if", - "name": "d_held", + "name": "x_held", "value": true } ], "from": { - "key_code": "p", + "key_code": "y", "modifiers": { "optional": [ "any" @@ -1855,53 +6421,19 @@ }, "to": [ { - "key_code": "0" + "consumer_key_code": "volume_increment" } ] - } - ] - }, - { - "description": "v layer: punctuation + h→~ + y→¥", - "manipulators": [ - { - "type": "basic", - "from": { - "key_code": "v", - "modifiers": { - "optional": [ - "caps_lock", - "shift" - ] - } - }, - "to": [ - { - "set_variable": { - "name": "v_held", - "value": true, - "key_up_value": false - } - } - ], - "to_if_alone": [ - { - "key_code": "v" - } - ], - "parameters": { - "basic.to_if_alone_timeout_milliseconds": 200 - } }, { "type": "basic", "from": { "simultaneous": [ { - "key_code": "v" + "key_code": "x" }, { - "key_code": "n" + "key_code": "u" } ], "simultaneous_options": { @@ -1918,30 +6450,57 @@ "to": [ { "set_variable": { - "name": "v_held", + "name": "x_held", "value": true, "key_up_value": false } }, { - "key_code": "comma" + "consumer_key_code": "rewind" } ], "parameters": { "basic.simultaneous_threshold_milliseconds": 250 - } + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_unless", + "name": "f_held", + "value": true + } + ] }, { "type": "basic", "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, { "type": "variable_if", - "name": "v_held", + "name": "x_held", "value": true } ], "from": { - "key_code": "n", + "key_code": "u", "modifiers": { "optional": [ "any" @@ -1950,7 +6509,7 @@ }, "to": [ { - "key_code": "comma" + "consumer_key_code": "rewind" } ] }, @@ -1959,10 +6518,10 @@ "from": { "simultaneous": [ { - "key_code": "v" + "key_code": "x" }, { - "key_code": "m" + "key_code": "i" } ], "simultaneous_options": { @@ -1979,30 +6538,57 @@ "to": [ { "set_variable": { - "name": "v_held", + "name": "x_held", "value": true, "key_up_value": false } }, { - "key_code": "period" + "consumer_key_code": "play_or_pause" } ], "parameters": { "basic.simultaneous_threshold_milliseconds": 250 - } + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_unless", + "name": "f_held", + "value": true + } + ] }, { "type": "basic", "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, { "type": "variable_if", - "name": "v_held", + "name": "x_held", "value": true } ], "from": { - "key_code": "m", + "key_code": "i", "modifiers": { "optional": [ "any" @@ -2011,7 +6597,7 @@ }, "to": [ { - "key_code": "period" + "consumer_key_code": "play_or_pause" } ] }, @@ -2020,10 +6606,10 @@ "from": { "simultaneous": [ { - "key_code": "v" + "key_code": "x" }, { - "key_code": "comma" + "key_code": "o" } ], "simultaneous_options": { @@ -2040,30 +6626,57 @@ "to": [ { "set_variable": { - "name": "v_held", + "name": "x_held", "value": true, "key_up_value": false } }, { - "key_code": "slash" + "consumer_key_code": "fast_forward" } ], "parameters": { "basic.simultaneous_threshold_milliseconds": 250 - } + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_unless", + "name": "f_held", + "value": true + } + ] }, { "type": "basic", "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, { "type": "variable_if", - "name": "v_held", + "name": "x_held", "value": true } ], "from": { - "key_code": "comma", + "key_code": "o", "modifiers": { "optional": [ "any" @@ -2072,7 +6685,7 @@ }, "to": [ { - "key_code": "slash" + "consumer_key_code": "fast_forward" } ] }, @@ -2081,10 +6694,10 @@ "from": { "simultaneous": [ { - "key_code": "v" + "key_code": "x" }, { - "key_code": "j" + "key_code": "h" } ], "simultaneous_options": { @@ -2101,30 +6714,57 @@ "to": [ { "set_variable": { - "name": "v_held", + "name": "x_held", "value": true, "key_up_value": false } }, { - "key_code": "semicolon" + "consumer_key_code": "volume_decrement" } ], "parameters": { "basic.simultaneous_threshold_milliseconds": 250 - } + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_unless", + "name": "f_held", + "value": true + } + ] }, { "type": "basic", "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, { "type": "variable_if", - "name": "v_held", + "name": "x_held", "value": true } ], "from": { - "key_code": "j", + "key_code": "h", "modifiers": { "optional": [ "any" @@ -2133,7 +6773,7 @@ }, "to": [ { - "key_code": "semicolon" + "consumer_key_code": "volume_decrement" } ] }, @@ -2142,10 +6782,10 @@ "from": { "simultaneous": [ { - "key_code": "v" + "key_code": "x" }, { - "key_code": "k" + "key_code": "j" } ], "simultaneous_options": { @@ -2162,30 +6802,57 @@ "to": [ { "set_variable": { - "name": "v_held", + "name": "x_held", "value": true, "key_up_value": false } }, { - "key_code": "quote" + "key_code": "launchpad" } ], "parameters": { "basic.simultaneous_threshold_milliseconds": 250 - } + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_unless", + "name": "f_held", + "value": true + } + ] }, { "type": "basic", "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, { "type": "variable_if", - "name": "v_held", + "name": "x_held", "value": true } ], "from": { - "key_code": "k", + "key_code": "j", "modifiers": { "optional": [ "any" @@ -2194,7 +6861,7 @@ }, "to": [ { - "key_code": "quote" + "key_code": "launchpad" } ] }, @@ -2203,10 +6870,10 @@ "from": { "simultaneous": [ { - "key_code": "v" + "key_code": "x" }, { - "key_code": "l" + "key_code": "k" } ], "simultaneous_options": { @@ -2223,30 +6890,57 @@ "to": [ { "set_variable": { - "name": "v_held", + "name": "x_held", "value": true, "key_up_value": false } }, { - "key_code": "backslash" + "key_code": "display_brightness_decrement" + } + ], + "parameters": { + "basic.simultaneous_threshold_milliseconds": 250 + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_unless", + "name": "f_held", + "value": true } - ], - "parameters": { - "basic.simultaneous_threshold_milliseconds": 250 - } + ] }, { "type": "basic", "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, { "type": "variable_if", - "name": "v_held", + "name": "x_held", "value": true } ], "from": { - "key_code": "l", + "key_code": "k", "modifiers": { "optional": [ "any" @@ -2255,7 +6949,7 @@ }, "to": [ { - "key_code": "backslash" + "key_code": "display_brightness_decrement" } ] }, @@ -2264,10 +6958,10 @@ "from": { "simultaneous": [ { - "key_code": "v" + "key_code": "x" }, { - "key_code": "u" + "key_code": "l" } ], "simultaneous_options": { @@ -2284,30 +6978,57 @@ "to": [ { "set_variable": { - "name": "v_held", + "name": "x_held", "value": true, "key_up_value": false } }, { - "key_code": "hyphen" + "key_code": "display_brightness_increment" } ], "parameters": { "basic.simultaneous_threshold_milliseconds": 250 - } + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_unless", + "name": "f_held", + "value": true + } + ] }, { "type": "basic", "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, { "type": "variable_if", - "name": "v_held", + "name": "x_held", "value": true } ], "from": { - "key_code": "u", + "key_code": "l", "modifiers": { "optional": [ "any" @@ -2316,7 +7037,7 @@ }, "to": [ { - "key_code": "hyphen" + "key_code": "display_brightness_increment" } ] }, @@ -2325,10 +7046,10 @@ "from": { "simultaneous": [ { - "key_code": "v" + "key_code": "x" }, { - "key_code": "i" + "key_code": "p" } ], "simultaneous_options": { @@ -2345,30 +7066,57 @@ "to": [ { "set_variable": { - "name": "v_held", + "name": "x_held", "value": true, "key_up_value": false } }, { - "key_code": "equal_sign" + "consumer_key_code": "mute" } ], "parameters": { "basic.simultaneous_threshold_milliseconds": 250 - } + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_unless", + "name": "f_held", + "value": true + } + ] }, { "type": "basic", "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, { "type": "variable_if", - "name": "v_held", + "name": "x_held", "value": true } ], "from": { - "key_code": "i", + "key_code": "p", "modifiers": { "optional": [ "any" @@ -2377,7 +7125,7 @@ }, "to": [ { - "key_code": "equal_sign" + "consumer_key_code": "mute" } ] }, @@ -2386,10 +7134,10 @@ "from": { "simultaneous": [ { - "key_code": "v" + "key_code": "x" }, { - "key_code": "o" + "key_code": "n" } ], "simultaneous_options": { @@ -2406,30 +7154,57 @@ "to": [ { "set_variable": { - "name": "v_held", + "name": "x_held", "value": true, "key_up_value": false } }, { - "key_code": "open_bracket" + "key_code": "display_brightness_decrement" } ], "parameters": { "basic.simultaneous_threshold_milliseconds": 250 - } + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_unless", + "name": "f_held", + "value": true + } + ] }, { "type": "basic", "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, { "type": "variable_if", - "name": "v_held", + "name": "x_held", "value": true } ], "from": { - "key_code": "o", + "key_code": "n", "modifiers": { "optional": [ "any" @@ -2438,7 +7213,7 @@ }, "to": [ { - "key_code": "open_bracket" + "key_code": "display_brightness_decrement" } ] }, @@ -2447,10 +7222,10 @@ "from": { "simultaneous": [ { - "key_code": "v" + "key_code": "x" }, { - "key_code": "p" + "key_code": "m" } ], "simultaneous_options": { @@ -2467,30 +7242,57 @@ "to": [ { "set_variable": { - "name": "v_held", + "name": "x_held", "value": true, "key_up_value": false } }, { - "key_code": "close_bracket" + "key_code": "display_brightness_increment" } ], "parameters": { "basic.simultaneous_threshold_milliseconds": 250 - } + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_unless", + "name": "f_held", + "value": true + } + ] }, { "type": "basic", "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, { "type": "variable_if", - "name": "v_held", + "name": "x_held", "value": true } ], "from": { - "key_code": "p", + "key_code": "m", "modifiers": { "optional": [ "any" @@ -2499,7 +7301,7 @@ }, "to": [ { - "key_code": "close_bracket" + "key_code": "display_brightness_increment" } ] }, @@ -2508,10 +7310,10 @@ "from": { "simultaneous": [ { - "key_code": "v" + "key_code": "x" }, { - "key_code": "h" + "key_code": "comma" } ], "simultaneous_options": { @@ -2528,33 +7330,57 @@ "to": [ { "set_variable": { - "name": "v_held", + "name": "x_held", "value": true, "key_up_value": false } }, { - "key_code": "grave_accent_and_tilde", - "modifiers": [ - "left_shift" - ] + "key_code": "mission_control" } ], "parameters": { "basic.simultaneous_threshold_milliseconds": 250 - } + }, + "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, + { + "type": "variable_unless", + "name": "f_held", + "value": true + } + ] }, { "type": "basic", "conditions": [ + { + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] + }, { "type": "variable_if", - "name": "v_held", + "name": "x_held", "value": true } ], "from": { - "key_code": "h", + "key_code": "comma", "modifiers": { "optional": [ "any" @@ -2563,71 +7389,56 @@ }, "to": [ { - "key_code": "grave_accent_and_tilde", - "modifiers": [ - "left_shift" - ] + "key_code": "mission_control" } ] - }, + } + ] + }, + { + "description": "z hold=Control(Toraboと同じ)。単押しは z", + "manipulators": [ { "type": "basic", "from": { - "simultaneous": [ - { - "key_code": "v" - }, - { - "key_code": "y" - } - ], - "simultaneous_options": { - "key_down_order": "strict", - "key_up_when": "all" - }, + "key_code": "z", "modifiers": { "optional": [ - "caps_lock", - "shift" + "caps_lock" ] } }, "to": [ { "set_variable": { - "name": "v_held", + "name": "z_ctrl", "value": true, "key_up_value": false } }, { - "key_code": "international3" + "key_code": "left_control", + "lazy": true } ], - "parameters": { - "basic.simultaneous_threshold_milliseconds": 250 - } - }, - { - "type": "basic", - "conditions": [ + "to_if_alone": [ { - "type": "variable_if", - "name": "v_held", - "value": true + "key_code": "z" } ], - "from": { - "key_code": "y", - "modifiers": { - "optional": [ - "any" - ] - } + "parameters": { + "basic.to_if_alone_timeout_milliseconds": 200 }, - "to": [ + "conditions": [ { - "key_code": "international3" + "type": "device_unless", + "identifiers": [ + { + "vendor_id": 65261, + "product_id": 48301, + "is_keyboard": true + } + ] } ] } @@ -2648,12 +7459,6 @@ ], "name": "Default profile", "selected": true, - "simple_modifications": [ - { - "from": { "key_code": "international1" }, - "to": [{ "key_code": "hyphen" }] - } - ], "virtual_hid_keyboard": { "keyboard_type_v2": "ansi" } diff --git a/.config/karabiner/keymap-layers.json b/.config/karabiner/keymap-layers.json index c407c02..c15793a 100644 --- a/.config/karabiner/keymap-layers.json +++ b/.config/karabiner/keymap-layers.json @@ -10,29 +10,35 @@ "bindings": { "eisuu": "↩/⌘", "kana": "↩/⌘", - "space": "␣/⇧" + "space": "␣/⇧", + "z": "z/⌃" } }, { "id": "f", "name": "f", - "trigger": "f 押し込み中", + "trigger": "f 押し込み中(=Torabo 移動)", "bindings": { + "q": "Esc", + "e": "⌫", + "u": "⌫", + "p": "⌦", + "a": "⇥", + "s": "⇥", + "d": "⌘", "h": "←", "j": "↓", "k": "↑", "l": "→", - "e": "delete", - "m": "あいう", - "a": "tab/⇧tab", "n": "ABC", + "m": "あいう", "b": "map" } }, { "id": "d", "name": "d", - "trigger": "d 押し込み中", + "trigger": "d 押し込み中(=Torabo 数字)", "bindings": { "n": "1", "m": "2", @@ -49,7 +55,7 @@ { "id": "v", "name": "v", - "trigger": "v 押し込み中", + "trigger": "v 押し込み中(=Torabo 記号)", "bindings": { "n": ",", "m": ".", @@ -64,6 +70,44 @@ "h": "~", "y": "¥" } + }, + { + "id": "c", + "name": "c", + "trigger": "c 押し込み中(=Torabo ファンクション)", + "bindings": { + "y": "F12", + "u": "F7", + "i": "F8", + "o": "F9", + "h": "F11", + "j": "F4", + "k": "F5", + "l": "F6", + "p": "F10", + "n": "F1", + "m": "F2", + ",": "F3" + } + }, + { + "id": "x", + "name": "x", + "trigger": "x 押し込み中(=Torabo メディア)", + "bindings": { + "y": "音量+", + "u": "前", + "i": "再生", + "o": "次", + "h": "音量−", + "j": "Launchpad", + "k": "輝度−", + "l": "輝度+", + "p": "消音", + "n": "輝度−", + "m": "輝度+", + ",": "Mission Control" + } } ], "rows": [ diff --git a/.config/karabiner/scripts/keymap-hud.html b/.config/karabiner/scripts/keymap-hud.html index 248f6f7..dfbb522 100644 --- a/.config/karabiner/scripts/keymap-hud.html +++ b/.config/karabiner/scripts/keymap-hud.html @@ -286,6 +286,23 @@ color: var(--grey1); font-size: 11px; } + /* JISの6層を3段で表示する場合も、キーと凡例を表示枠に収める。 */ + .jis-keymap-compact { + --key-h: 25px; + } + .jis-keymap-compact .key { padding: 0 2px; line-height: 1; } + .jis-keymap-compact .key .base { font-size: 8px; } + .jis-keymap-compact .key .action { font-size: 9px; } + .jis-keymap-compact .key[data-long-label] { padding-inline: 0; } + .jis-keymap-compact .key[data-long-label] .action { + font-size: 7px; + font-family: Menlo, monospace; + max-width: 100%; + overflow-wrap: anywhere; + text-align: center; + } + .jis-keymap-compact .key .shift { top: 1px; } + .jis-keymap-compact .key .kana { bottom: 1px; } .swatch { display: inline-block; width: 10px; @@ -334,7 +351,7 @@

Keymap Layers · JIS shape / US legends

-
f + b で表示 · 離すと閉じる · Gruvbox Material
+
f + b で表示 · 離すと閉じる · Gruvbox Material
@@ -431,25 +448,15 @@

Keymap Layers · JIS shape / US legends

} if (mapped) { - if (mappedShift) { - const shiftEl = document.createElement("div"); - shiftEl.className = "shift"; - shiftEl.textContent = mappedShift; - keyEl.appendChild(shiftEl); - const action = document.createElement("div"); - action.className = "action"; - action.textContent = mapped; - keyEl.appendChild(action); - } else { - const base = document.createElement("div"); - base.className = "base"; - base.textContent = displayName(key, def); - const action = document.createElement("div"); - action.className = "action"; - action.textContent = mapped; - keyEl.appendChild(base); - keyEl.appendChild(action); - } + const label = document.createElement("div"); + label.className = mappedShift ? "shift" : "base"; + label.textContent = mappedShift || displayName(key, def); + keyEl.appendChild(label); + const action = document.createElement("div"); + action.className = "action"; + action.textContent = mapped; + if (mapped.length > 8) keyEl.dataset.longLabel = ""; + keyEl.appendChild(action); } else if (key !== "space") { const name = displayName(key, def); if (!name && !glyph) { @@ -508,20 +515,29 @@

Keymap Layers · JIS shape / US legends

function showKeymap(profile) { const root = document.getElementById("layers"); const title = document.querySelector("#keymap-title"); + const sub = document.querySelector("#keymap-sub"); + const def = window.__KEYMAP_LAYERS__; const split = profile === "torabo" ? window.__TORABO_KEYMAP__ : null; const useSplit = Boolean(split && Array.isArray(split.keys) && split.keys.length && split.keys.every((key) => key && Number.isFinite(key.x) && Number.isFinite(key.y)) && Array.isArray(split.layers) && split.layers.length && split.layers.every((layer) => layer && typeof layer.name === "string")); document.body.classList.toggle("torabo-keymap", useSplit); + document.body.classList.toggle("jis-keymap-compact", !useSplit && def?.layers?.length > 4); root.replaceChildren(); if (useSplit) { title.textContent = split.name || "Torabo-tsuki (S)"; + if (sub) { + const battery = window.__TORABO_BATTERY_SUBTITLE__ || ""; + sub.textContent = battery + ? `${battery} · f + b で表示 · 離すと閉じる` + : "f + b で表示 · 離すと閉じる · 電池取得中"; + } renderToraboKeymap(root, split); return "torabo"; } - const def = window.__KEYMAP_LAYERS__; if (!def) throw new Error("JISの配列データがありません。"); title.textContent = "Keymap Layers · JIS shape / US legends"; + if (sub) sub.textContent = "f + b で表示 · 離すと閉じる · Gruvbox Material"; for (const layer of def.layers) root.appendChild(renderLayer(layer, def)); return "jis"; } diff --git a/.config/karabiner/scripts/keymap-hud.js b/.config/karabiner/scripts/keymap-hud.js index 5645e75..82f0038 100755 --- a/.config/karabiner/scripts/keymap-hud.js +++ b/.config/karabiner/scripts/keymap-hud.js @@ -43,14 +43,27 @@ function buildHtmlDocument(html, jsonText, toraboModel) { return `${injection}\n${html}`; } -function keymapDisplayScript(command, path) { +function batterySubtitle(path) { + try { + const battery = JSON.parse(readText(path)); + const parts = []; + if (Number.isFinite(battery.right)) parts.push(`右 ${battery.right}%`); + if (Number.isFinite(battery.left)) parts.push(`左 ${battery.left}%`); + if (parts.length) return parts.join(" · "); + } catch (error) {} + return ""; +} + +function keymapDisplayScript(command, path, batteryPath) { const showJis = 'window.showKeymap("jis")'; if (command !== "show torabo") return showJis; try { - // 表示のたびに編集用 JSON を読み込む。欠損や不正値があれば内蔵用の表示を使う。 + // 表示のたびにToraboの表示用JSONと、保存された電池残量を読み込む。 const definition = JSON.stringify(JSON.parse(readText(path))); + const subtitle = (batteryPath && batterySubtitle(batteryPath)) || "電池は次回の表示で更新されます"; return `try { window.__TORABO_KEYMAP__ = buildToraboKeymap(JSON.parse(${JSON.stringify(definition)})); + window.__TORABO_BATTERY_SUBTITLE__ = ${JSON.stringify(subtitle)}; window.showKeymap("torabo"); } catch (error) { ${showJis}; }`; } catch (error) { @@ -80,7 +93,7 @@ function run(argv) { const app = $.NSApplication.sharedApplication; app.setActivationPolicy($.NSApplicationActivationPolicyAccessory); - // 2×2 レイヤーグリッドが収まるサイズ(JIS キーボード×最大4枚) + // JISでは最大6枚を2列3段に並べ、Toraboではレイヤー数に応じて寸法を調整する。 const width = 1280; const height = 780; const panel = $.NSPanel.alloc.initWithContentRectStyleMaskBackingDefer( @@ -123,9 +136,10 @@ function run(argv) { } lastCmd = cmd; if (cmd === "show" || cmd === "show torabo") { - // 表示内容を切り替えてからパネルを開く。 + // 表示内容を切り替えてからパネルを開く。電池は同ディレクトリのキャッシュを読む。 + const batteryPath = cmdPath.replace(/[^/]+$/, "torabo-battery.json"); webView.evaluateJavaScriptCompletionHandler( - keymapDisplayScript(cmd, configDir + "torabo-tsuki-s.json"), + keymapDisplayScript(cmd, configDir + "torabo-tsuki-s.json", batteryPath), function () { // 読み込み中にキーが離された場合は、すでに非表示になったパネルを開き直さない。 if (lastCmd === cmd) { diff --git a/.config/karabiner/scripts/torabo-battery.swift b/.config/karabiner/scripts/torabo-battery.swift new file mode 100644 index 0000000..6f67d6f --- /dev/null +++ b/.config/karabiner/scripts/torabo-battery.swift @@ -0,0 +1,153 @@ +import CoreBluetooth +import Foundation + +enum BatterySide: String { + case right + case left +} + +func batterySide(format: Data) -> BatterySide? { + let fields = Array(format) + // 符号なし8ビット値、指数0、単位はパーセント、Bluetooth SIGの名前空間を照合する。 + guard fields.count == 7, fields.prefix(5).elementsEqual([0x04, 0, 0xad, 0x27, 1]) else { return nil } + switch UInt16(fields[5]) | UInt16(fields[6]) << 8 { + case 0x0106: return .right // Zephyrの主電池は右の親機。 + case 0x0108: return .left // ZMKの補助電池は左の子機。 + default: return nil + } +} + +struct BatteryLevels { + private var readings: [BatterySide: [Int]] = [:] + + mutating func record(_ data: Data?, side: BatterySide) { + guard let data, data.count == 1, let value = data.first, value <= 100 else { return } + // ZMKは左が未接続でも0を返す。測定値と区別できない場合は表示しない。 + guard side != .left || value > 0 else { return } + readings[side, default: []].append(Int(value)) + } + + var values: [String: Int] { + Dictionary(uniqueKeysWithValues: readings.compactMap { side, values in + // 同じ側として複数の値が届いたときは、どれも選ばない。 + guard values.count == 1, let value = values.first else { return nil } + return (side.rawValue, value) + }) + } +} + +final class Reader: NSObject, CBCentralManagerDelegate, CBPeripheralDelegate { + private let bas = CBUUID(string: "180F") + private let level = CBUUID(string: "2A19") + private let presentation = CBUUID(string: CBUUIDCharacteristicFormatString) + private var central: CBCentralManager! + private var target: CBPeripheral? + private var pendingServices = 0 + private var pendingCharacteristics: Set = [] + private var sides: [ObjectIdentifier: BatterySide] = [:] + private var levels = BatteryLevels() + + // すでに無線で接続した機器の電池サービスに問い合わせる。 + func start() { + central = CBCentralManager(delegate: self, queue: nil, + options: [CBCentralManagerOptionShowPowerAlertKey: false]) + DispatchQueue.main.asyncAfter(deadline: .now() + 3) { self.emit() } + } + + func centralManagerDidUpdateState(_ central: CBCentralManager) { + if central.state == .unknown || central.state == .resetting { return } + guard central.state == .poweredOn else { emit(); return } + guard target == nil else { return } + let candidates = central.retrieveConnectedPeripherals(withServices: [bas]) + .filter { $0.name?.caseInsensitiveCompare("Torabo-tsuki S") == .orderedSame } + guard candidates.count == 1, let peripheral = candidates.first else { emit(); return } + target = peripheral + peripheral.delegate = self + if peripheral.state == .connected { + peripheral.discoverServices([bas]) + } else { + central.connect(peripheral, options: nil) + } + } + + func centralManager(_ central: CBCentralManager, didConnect peripheral: CBPeripheral) { + peripheral.discoverServices([bas]) + } + + func centralManager(_ central: CBCentralManager, didFailToConnect peripheral: CBPeripheral, error: Error?) { + emit() + } + + func peripheral(_ peripheral: CBPeripheral, didDiscoverServices error: Error?) { + let services = peripheral.services?.filter { $0.uuid == bas } ?? [] + guard error == nil, !services.isEmpty else { emit(); return } + // 左子機の代理サービスは、右親機と同じUUIDを持つ独立したサービス。 + pendingServices = services.count + for service in services { + peripheral.discoverCharacteristics([level], for: service) + } + } + + func peripheral(_ peripheral: CBPeripheral, didDiscoverCharacteristicsFor service: CBService, error: Error?) { + pendingServices -= 1 + if error == nil { + for characteristic in service.characteristics ?? [] where characteristic.uuid == level { + pendingCharacteristics.insert(ObjectIdentifier(characteristic)) + peripheral.discoverDescriptors(for: characteristic) + } + } + finishIfReady() + } + + func peripheral(_ peripheral: CBPeripheral, didDiscoverDescriptorsFor characteristic: CBCharacteristic, error: Error?) { + let descriptors = characteristic.descriptors?.filter { $0.uuid == presentation } ?? [] + guard error == nil, descriptors.count == 1, let descriptor = descriptors.first else { + finish(characteristic) + return + } + peripheral.readValue(for: descriptor) + } + + func peripheral(_ peripheral: CBPeripheral, didUpdateValueFor descriptor: CBDescriptor, error: Error?) { + guard let characteristic = descriptor.characteristic else { return } + guard error == nil, let format = descriptor.value as? Data, let side = batterySide(format: format) else { + finish(characteristic) + return + } + sides[ObjectIdentifier(characteristic)] = side + peripheral.readValue(for: characteristic) + } + + func peripheral(_ peripheral: CBPeripheral, didUpdateValueFor characteristic: CBCharacteristic, error: Error?) { + if error == nil, let side = sides.removeValue(forKey: ObjectIdentifier(characteristic)) { + levels.record(characteristic.value, side: side) + } + finish(characteristic) + } + + private func finish(_ characteristic: CBCharacteristic) { + pendingCharacteristics.remove(ObjectIdentifier(characteristic)) + finishIfReady() + } + + private func finishIfReady() { + if pendingServices == 0 && pendingCharacteristics.isEmpty { emit() } + } + + // 確認できた残量だけをJSONで出力し、値がなければキャッシュに使わせない。 + private func emit() { + var payload = levels.values as [String: Any] + guard !payload.isEmpty else { exit(EXIT_FAILURE) } + payload["updated_at"] = ISO8601DateFormatter().string(from: Date()) + guard let data = try? JSONSerialization.data(withJSONObject: payload, options: [.sortedKeys]) else { + exit(EXIT_FAILURE) + } + FileHandle.standardOutput.write(data) + FileHandle.standardOutput.write(Data("\n".utf8)) + exit(EXIT_SUCCESS) + } +} + +let reader = Reader() +reader.start() +RunLoop.main.run() diff --git a/.config/karabiner/scripts/torabo-keymap-device.swift b/.config/karabiner/scripts/torabo-keymap-device.swift index b3494ad..92c0e9e 100644 --- a/.config/karabiner/scripts/torabo-keymap-device.swift +++ b/.config/karabiner/scripts/torabo-keymap-device.swift @@ -4,7 +4,12 @@ import IOKit.hid struct Failure: Error { let message: String } struct PhysicalKey: Decodable { let id: String } struct Layer: Codable { let name: String; let matrix: [[String]] } -struct Settings: Decodable { let keys: [PhysicalKey]; let layers: [Layer] } +struct Settings: Decodable { + struct Source: Decodable { let firmware: String? } + let source: Source? + let keys: [PhysicalKey] + let layers: [Layer] +} enum Operation { case read; case apply(Int, Int, Int, UInt16, UInt16) } final class Response { var bytes: [UInt8]? } final class Device { @@ -107,7 +112,7 @@ func applyKey(expected: UInt16, value: UInt16, get: () throws -> UInt16, set: (U func parseArguments(_ arguments: [String]) throws -> Operation { if arguments == ["read"] { return .read } guard arguments.count == 6, arguments[0] == "apply-key" else { - throw Failure(message: "使い方: read または apply-key 設定JSON レイヤー 行 列 変更前の0xNNNN") + throw Failure(message: "使い方: read または apply-key Vial設定JSON レイヤー 行 列 変更前の0xNNNN") } guard let layer = Int(arguments[2]), (0..<8).contains(layer), let row = Int(arguments[3]), (0..<10).contains(row), @@ -126,11 +131,17 @@ func parseArguments(_ arguments: [String]) throws -> Operation { } func validate(_ settings: Settings) throws { + // ZMKの表示用コードはVialの実機へ送信できない。レイヤー数に関わらず接続前に拒否する。 + guard settings.source?.firmware?.lowercased() != "zmk" else { + throw Failure(message: "ZMKの表示用JSONは書き込みに使えません。torabo-vial-keymap.jsonを指定してください。") + } let ids = settings.keys.map(\.id) guard Set(ids) == physicalKeys, ids.count == physicalKeys.count else { throw Failure(message: "物理キー一覧がS配列の42キーと一致しません。") } - guard settings.layers.count == 8 else { throw Failure(message: "設定には8レイヤーが必要です。") } + guard settings.layers.count == 8 else { + throw Failure(message: "Vial設定には8レイヤーが必要です。") + } for layer in settings.layers { guard layer.matrix.count == 10 else { throw Failure(message: "各レイヤーには10行が必要です。") } for row in layer.matrix { diff --git a/.config/karabiner/torabo-tsuki-s.json b/.config/karabiner/torabo-tsuki-s.json index eb0d945..a6e2065 100644 --- a/.config/karabiner/torabo-tsuki-s.json +++ b/.config/karabiner/torabo-tsuki-s.json @@ -1,120 +1,1175 @@ { "model": "Torabo-tsuki (S)", - "note": "各レイヤーのmatrixは実機に保存されている10行×7列の割り当てです。キー番号は0から始まる行と列を示します。座標はVial定義のS配列です。読み取り時の実機オプションはsourceに記録しています。", - "source": {"vial_protocol": 6, "layout_options": 1, "physical_layout": "S"}, + "note": "ZMKのキー一覧だけに使う表示用データです。S配列の座標とVialプロトコル6形式の行列で表し、ZMK固有の操作は表示専用のコードを使います。", + "source": { + "firmware": "zmk", + "keymap": "../torabo-zmk/config/torabo_tsuki.keymap", + "vial_protocol": 6, + "physical_layout": "S" + }, "keys": [ - {"id": "0,3", "x": 2.0, "y": 0.0}, {"id": "5,3", "x": 11.5, "y": 0.0}, {"id": "0,4", "x": 3.0, "y": 0.13}, - {"id": "5,4", "x": 10.5, "y": 0.13}, {"id": "0,2", "x": 1.0, "y": 0.25}, {"id": "0,5", "x": 4.0, "y": 0.25}, - {"id": "5,5", "x": 9.5, "y": 0.25}, {"id": "5,2", "x": 12.5, "y": 0.25}, {"id": "0,1", "x": 0.0, "y": 0.6}, - {"id": "5,1", "x": 13.5, "y": 0.6}, {"id": "1,3", "x": 2.0, "y": 1.0}, {"id": "6,3", "x": 11.5, "y": 1.0}, - {"id": "1,4", "x": 3.0, "y": 1.13}, {"id": "6,4", "x": 10.5, "y": 1.13}, {"id": "1,2", "x": 1.0, "y": 1.25}, - {"id": "1,5", "x": 4.0, "y": 1.25}, {"id": "6,5", "x": 9.5, "y": 1.25}, {"id": "6,2", "x": 12.5, "y": 1.25}, - {"id": "1,1", "x": 0.0, "y": 1.6}, {"id": "6,1", "x": 13.5, "y": 1.6}, {"id": "2,3", "x": 2.0, "y": 2.0}, - {"id": "7,3", "x": 11.5, "y": 2.0}, {"id": "2,4", "x": 3.0, "y": 2.13}, {"id": "7,4", "x": 10.5, "y": 2.13}, - {"id": "2,2", "x": 1.0, "y": 2.25}, {"id": "2,5", "x": 4.0, "y": 2.25}, {"id": "7,5", "x": 9.5, "y": 2.25}, - {"id": "7,2", "x": 12.5, "y": 2.25}, {"id": "2,1", "x": 0.0, "y": 2.6}, {"id": "7,1", "x": 13.5, "y": 2.6}, - {"id": "4,3", "x": 2.0, "y": 3.0}, {"id": "9,3", "x": 11.5, "y": 3.0}, {"id": "4,2", "x": 1.0, "y": 3.25}, - {"id": "9,2", "x": 12.5, "y": 3.25}, {"id": "4,4", "x": 3.15, "y": 3.5}, {"id": "9,4", "x": 10.35, "y": 3.5}, - {"id": "4,1", "x": 0.0, "y": 3.6}, {"id": "9,1", "x": 13.5, "y": 3.6}, {"id": "4,5", "x": 4.279, "y": 3.594}, - {"id": "4,6", "x": 5.359, "y": 3.9}, {"id": "9,6", "x": 8.14, "y": 3.908}, {"id": "9,5", "x": 9.224, "y": 3.614} + { + "id": "0,3", + "x": 2.0, + "y": 0.0 + }, + { + "id": "5,3", + "x": 11.5, + "y": 0.0 + }, + { + "id": "0,4", + "x": 3.0, + "y": 0.13 + }, + { + "id": "5,4", + "x": 10.5, + "y": 0.13 + }, + { + "id": "0,2", + "x": 1.0, + "y": 0.25 + }, + { + "id": "0,5", + "x": 4.0, + "y": 0.25 + }, + { + "id": "5,5", + "x": 9.5, + "y": 0.25 + }, + { + "id": "5,2", + "x": 12.5, + "y": 0.25 + }, + { + "id": "0,1", + "x": 0.0, + "y": 0.6 + }, + { + "id": "5,1", + "x": 13.5, + "y": 0.6 + }, + { + "id": "1,3", + "x": 2.0, + "y": 1.0 + }, + { + "id": "6,3", + "x": 11.5, + "y": 1.0 + }, + { + "id": "1,4", + "x": 3.0, + "y": 1.13 + }, + { + "id": "6,4", + "x": 10.5, + "y": 1.13 + }, + { + "id": "1,2", + "x": 1.0, + "y": 1.25 + }, + { + "id": "1,5", + "x": 4.0, + "y": 1.25 + }, + { + "id": "6,5", + "x": 9.5, + "y": 1.25 + }, + { + "id": "6,2", + "x": 12.5, + "y": 1.25 + }, + { + "id": "1,1", + "x": 0.0, + "y": 1.6 + }, + { + "id": "6,1", + "x": 13.5, + "y": 1.6 + }, + { + "id": "2,3", + "x": 2.0, + "y": 2.0 + }, + { + "id": "7,3", + "x": 11.5, + "y": 2.0 + }, + { + "id": "2,4", + "x": 3.0, + "y": 2.13 + }, + { + "id": "7,4", + "x": 10.5, + "y": 2.13 + }, + { + "id": "2,2", + "x": 1.0, + "y": 2.25 + }, + { + "id": "2,5", + "x": 4.0, + "y": 2.25 + }, + { + "id": "7,5", + "x": 9.5, + "y": 2.25 + }, + { + "id": "7,2", + "x": 12.5, + "y": 2.25 + }, + { + "id": "2,1", + "x": 0.0, + "y": 2.6 + }, + { + "id": "7,1", + "x": 13.5, + "y": 2.6 + }, + { + "id": "4,3", + "x": 2.0, + "y": 3.0 + }, + { + "id": "9,3", + "x": 11.5, + "y": 3.0 + }, + { + "id": "4,2", + "x": 1.0, + "y": 3.25 + }, + { + "id": "9,2", + "x": 12.5, + "y": 3.25 + }, + { + "id": "4,4", + "x": 3.15, + "y": 3.5 + }, + { + "id": "9,4", + "x": 10.35, + "y": 3.5 + }, + { + "id": "4,1", + "x": 0.0, + "y": 3.6 + }, + { + "id": "9,1", + "x": 13.5, + "y": 3.6 + }, + { + "id": "4,5", + "x": 4.279, + "y": 3.594 + }, + { + "id": "4,6", + "x": 5.359, + "y": 3.9 + }, + { + "id": "9,6", + "x": 8.14, + "y": 3.908 + }, + { + "id": "9,5", + "x": 9.224, + "y": 3.614 + } ], "layers": [ - {"name": "L0 基本", "matrix": [ - ["0x0000", "0x0014", "0x001a", "0x0008", "0x0015", "0x0017", "0x0000"], - ["0x0000", "0x0004", "0x0016", "0x4307", "0x4209", "0x000a", "0x0000"], - ["0x0000", "0x001d", "0x001b", "0x4506", "0x4419", "0x4605", "0x0000"], - ["0x0000", "0x0000", "0x0000", "0x0000", "0x0000", "0x0000", "0x0000"], - ["0x0000", "0x0001", "0x00e3", "0x00e2", "0x00e0", "0x2828", "0x222c"], - ["0x0000", "0x0000", "0x0012", "0x410c", "0x0018", "0x001c", "0x0000"], - ["0x0000", "0x0013", "0x410f", "0x410e", "0x000d", "0x000b", "0x0000"], - ["0x0000", "0x5201", "0x0000", "0x0010", "0x0011", "0x0000", "0x0000"], - ["0x0000", "0x0000", "0x0000", "0x0000", "0x0000", "0x0000", "0x0000"], - ["0x0000", "0x410c", "0x0000", "0x0000", "0x0000", "0x3858", "0x322c"] - ]}, - {"name": "L1 マウス", "matrix": [ - ["0x0000", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0000"], - ["0x0000", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0000"], - ["0x0000", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0000"], - ["0x0000", "0x0000", "0x0000", "0x0000", "0x0000", "0x0000", "0x0000"], - ["0x0000", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001"], - ["0x0000", "0x0001", "0x00d5", "0x0001", "0x0001", "0x0001", "0x0000"], - ["0x0000", "0x00d2", "0x00d2", "0x7e19", "0x00d1", "0x00d4", "0x0000"], - ["0x0000", "0x5200", "0x0001", "0x00d1", "0x7e19", "0x0001", "0x0000"], - ["0x0000", "0x0000", "0x0000", "0x0000", "0x0000", "0x0000", "0x0000"], - ["0x0000", "0x7e19", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001"] - ]}, - {"name": "L2 移動", "matrix": [ - ["0x0000", "0x0029", "0x0001", "0x002a", "0x0001", "0x0001", "0x0000"], - ["0x0000", "0x002b", "0x002b", "0x00e3", "0x0001", "0x0001", "0x0000"], - ["0x0000", "0x0001", "0x0001", "0x0001", "0x0001", "0x0073", "0x0000"], - ["0x0000", "0x0000", "0x0000", "0x0000", "0x0000", "0x0000", "0x0000"], - ["0x0000", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001"], - ["0x0000", "0x004c", "0x0001", "0x0001", "0x002a", "0x0001", "0x0000"], - ["0x0000", "0x0001", "0x004f", "0x0052", "0x0051", "0x0050", "0x0000"], - ["0x0000", "0x0001", "0x0001", "0x7700", "0x7700", "0x0001", "0x0000"], - ["0x0000", "0x0000", "0x0000", "0x0000", "0x0000", "0x0000", "0x0000"], - ["0x0000", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001"] - ]}, - {"name": "L3 数字", "matrix": [ - ["0x0000", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0000"], - ["0x0000", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0000"], - ["0x0000", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0000"], - ["0x0000", "0x0000", "0x0000", "0x0000", "0x0000", "0x0000", "0x0000"], - ["0x0000", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001"], - ["0x0000", "0x0000", "0x0026", "0x0025", "0x0024", "0x0001", "0x0000"], - ["0x0000", "0x0027", "0x0023", "0x0022", "0x0021", "0x0001", "0x0000"], - ["0x0000", "0x0001", "0x0020", "0x001f", "0x001e", "0x0001", "0x0000"], - ["0x0000", "0x0000", "0x0000", "0x0000", "0x0000", "0x0000", "0x0000"], - ["0x0000", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001"] - ]}, - {"name": "L4 記号", "matrix": [ - ["0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001"], - ["0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001"], - ["0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001"], - ["0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001"], - ["0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001"], - ["0x0001", "0x0001", "0x0030", "0x002f", "0x002e", "0x002d", "0x0001"], - ["0x0001", "0x0001", "0x0032", "0x0034", "0x0033", "0x0089", "0x0001"], - ["0x0001", "0x0087", "0x0038", "0x0037", "0x0036", "0x0001", "0x0001"], - ["0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001"], - ["0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001"] - ]}, - {"name": "L5 ファンクション", "matrix": [ - ["0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001"], - ["0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001"], - ["0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001"], - ["0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001"], - ["0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001"], - ["0x0001", "0x0043", "0x0042", "0x0041", "0x0040", "0x0001", "0x0001"], - ["0x0001", "0x0044", "0x003f", "0x003e", "0x003d", "0x0045", "0x0001"], - ["0x0001", "0x0001", "0x003c", "0x003b", "0x003a", "0x0001", "0x0001"], - ["0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001"], - ["0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001"] - ]}, - {"name": "L6 記号・システム", "matrix": [ - ["0x0001", "0x00a5", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001"], - ["0x0001", "0x001e", "0x0001", "0x00a6", "0x00a6", "0x0001", "0x0001"], - ["0x0001", "0x0001", "0x00b0", "0x00e3", "0x00e2", "0x0001", "0x0001"], - ["0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001"], - ["0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001"], - ["0x0001", "0x00a6", "0x0035", "0x002d", "0x002a", "0x002e", "0x0001"], - ["0x0001", "0x0038", "0x0032", "0x0030", "0x0030", "0x0231", "0x0001"], - ["0x0001", "0x0087", "0x0064", "0x002f", "0x0034", "0x0031", "0x0001"], - ["0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001"], - ["0x0001", "0x0001", "0x0087", "0x0034", "0x0001", "0x0001", "0x0001"] - ]}, - {"name": "L7 マウス", "matrix": [ - ["0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001"], - ["0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001"], - ["0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001"], - ["0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001"], - ["0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001"], - ["0x0001", "0x0001", "0x00d5", "0x0001", "0x00d4", "0x0001", "0x0001"], - ["0x0001", "0x0001", "0x00d2", "0x7e19", "0x00d1", "0x0001", "0x0001"], - ["0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001"], - ["0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001"], - ["0x0001", "0x7e19", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001"] - ]} + { + "name": "L0 基本", + "matrix": [ + [ + "0x0000", + "0x0014", + "0x001a", + "0x0008", + "0x0015", + "0x0017", + "0x0000" + ], + [ + "0x0000", + "0x0004", + "0x0016", + "0x4307", + "0x4209", + "0x000a", + "0x0000" + ], + [ + "0x0000", + "0x211d", + "0x491b", + "0x4506", + "0x4419", + "0x4605", + "0x0000" + ], + [ + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000" + ], + [ + "0x0000", + "0x0039", + "0x00e3", + "0x00e2", + "0x00e2", + "0x2828", + "0x222c" + ], + [ + "0x0000", + "0x5228", + "0x0012", + "0x000c", + "0x0018", + "0x001c", + "0x0000" + ], + [ + "0x0000", + "0x0013", + "0x000f", + "0x000e", + "0x000d", + "0x000b", + "0x0000" + ], + [ + "0x0000", + "0x5201", + "0x0000", + "0x0010", + "0x0011", + "0x0000", + "0x0000" + ], + [ + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000" + ], + [ + "0x0000", + "0x5200", + "0x0000", + "0x0000", + "0x0000", + "0x3828", + "0x322c" + ] + ] + }, + { + "name": "L1 マウス", + "matrix": [ + [ + "0x0000", + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0000" + ], + [ + "0x0000", + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0000" + ], + [ + "0x0000", + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0000" + ], + [ + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000" + ], + [ + "0x0000", + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001" + ], + [ + "0x0000", + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0000" + ], + [ + "0x0000", + "0x0001", + "0x00d5", + "0x00d2", + "0x00d1", + "0x00d4", + "0x0000" + ], + [ + "0x0000", + "0x5200", + "0x0001", + "0x00d1", + "0x5228", + "0x0001", + "0x0000" + ], + [ + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000" + ], + [ + "0x0000", + "0x5200", + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001" + ] + ] + }, + { + "name": "L2 移動", + "matrix": [ + [ + "0x0000", + "0x0029", + "0x0001", + "0x002a", + "0x0001", + "0x0001", + "0x0000" + ], + [ + "0x0000", + "0x002b", + "0x002b", + "0x00e3", + "0x0001", + "0x0001", + "0x0000" + ], + [ + "0x0000", + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0073", + "0x0000" + ], + [ + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000" + ], + [ + "0x0000", + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001" + ], + [ + "0x0000", + "0x004c", + "0x0001", + "0x0001", + "0x002a", + "0x0001", + "0x0000" + ], + [ + "0x0000", + "0x0001", + "0x004f", + "0x0052", + "0x0051", + "0x0050", + "0x0000" + ], + [ + "0x0000", + "0x0001", + "0x0001", + "0x0090", + "0x0091", + "0x0001", + "0x0000" + ], + [ + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000" + ], + [ + "0x0000", + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001" + ] + ] + }, + { + "name": "L3 数字", + "matrix": [ + [ + "0x0000", + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0000" + ], + [ + "0x0000", + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0000" + ], + [ + "0x0000", + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0000" + ], + [ + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000" + ], + [ + "0x0000", + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001" + ], + [ + "0x0000", + "0x0000", + "0x0026", + "0x0025", + "0x0024", + "0x0001", + "0x0000" + ], + [ + "0x0000", + "0x0027", + "0x0023", + "0x0022", + "0x0021", + "0x0001", + "0x0000" + ], + [ + "0x0000", + "0x0001", + "0x0020", + "0x001f", + "0x001e", + "0x0001", + "0x0000" + ], + [ + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000", + "0x0000" + ], + [ + "0x0000", + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001" + ] + ] + }, + { + "name": "L4 記号", + "matrix": [ + [ + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001" + ], + [ + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001" + ], + [ + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001" + ], + [ + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001" + ], + [ + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001" + ], + [ + "0x0001", + "0x0001", + "0x002f", + "0x002e", + "0x002d", + "0x0089", + "0x0001" + ], + [ + "0x0001", + "0x0030", + "0x0031", + "0x0034", + "0x0033", + "0x0235", + "0x0001" + ], + [ + "0x0001", + "0x0001", + "0x0038", + "0x0037", + "0x0036", + "0x0001", + "0x0001" + ], + [ + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001" + ], + [ + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001" + ] + ] + }, + { + "name": "L5 ファンクション", + "matrix": [ + [ + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001" + ], + [ + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001" + ], + [ + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001" + ], + [ + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001" + ], + [ + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001" + ], + [ + "0x0001", + "0x0001", + "0x0042", + "0x0041", + "0x0040", + "0x0045", + "0x0001" + ], + [ + "0x0001", + "0x0043", + "0x003f", + "0x003e", + "0x003d", + "0x0044", + "0x0001" + ], + [ + "0x0001", + "0x0001", + "0x003c", + "0x003b", + "0x003a", + "0x0001", + "0x0001" + ], + [ + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001" + ], + [ + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001" + ] + ] + }, + { + "name": "L6 記号・電源", + "matrix": [ + [ + "0x0001", + "0x00a5", + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001" + ], + [ + "0x0001", + "0x001e", + "0x0001", + "0x7e20", + "0x7e21", + "0x0001", + "0x0001" + ], + [ + "0x0001", + "0x0001", + "0x00b0", + "0x00e3", + "0x00e2", + "0x0001", + "0x0001" + ], + [ + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001" + ], + [ + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001" + ], + [ + "0x0001", + "0x00a6", + "0x0035", + "0x002d", + "0x002a", + "0x002e", + "0x0001" + ], + [ + "0x0001", + "0x7e22", + "0x0032", + "0x0030", + "0x0030", + "0x0231", + "0x0001" + ], + [ + "0x0001", + "0x0087", + "0x0064", + "0x002f", + "0x0034", + "0x0031", + "0x0001" + ], + [ + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001" + ], + [ + "0x0001", + "0x0001", + "0x0087", + "0x0034", + "0x0001", + "0x0001", + "0x0001" + ] + ] + }, + { + "name": "L7 マウス固定", + "matrix": [ + [ + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001" + ], + [ + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001" + ], + [ + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001" + ], + [ + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001" + ], + [ + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001" + ], + [ + "0x0001", + "0x0001", + "0x00d5", + "0x0001", + "0x00d4", + "0x0001", + "0x0001" + ], + [ + "0x0001", + "0x0001", + "0x00d2", + "0x5228", + "0x00d1", + "0x0001", + "0x0001" + ], + [ + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001" + ], + [ + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001" + ], + [ + "0x0001", + "0x5200", + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001" + ] + ] + }, + { + "name": "L8 スクロール", + "matrix": [ + [ + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001" + ], + [ + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001" + ], + [ + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001" + ], + [ + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001" + ], + [ + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001" + ], + [ + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001" + ], + [ + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001" + ], + [ + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001" + ], + [ + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001" + ], + [ + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001" + ] + ] + }, + { + "name": "L9 メディア", + "matrix": [ + [ + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001" + ], + [ + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001" + ], + [ + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001" + ], + [ + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001" + ], + [ + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001" + ], + [ + "0x0001", + "0x0001", + "0x00ab", + "0x00ae", + "0x00ac", + "0x00a9", + "0x0001" + ], + [ + "0x0001", + "0x00a8", + "0x7e1e", + "0x7e1d", + "0x7e1c", + "0x00aa", + "0x0001" + ], + [ + "0x0001", + "0x0001", + "0x7e1f", + "0x7e1e", + "0x7e1d", + "0x0001", + "0x0001" + ], + [ + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001" + ], + [ + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001", + "0x0001" + ] + ] + } ], "custom_keycodes": { "0x7e00": "SEL\nBLE", @@ -144,6 +1199,15 @@ "0x7e18": "JU\nOVR", "0x7e19": "ドラッグ\nスクロール", "0x7e1a": "TB AS\nENCODER1", - "0x7e1b": "TB AS\nENCODER2" + "0x7e1b": "TB AS\nENCODER2", + "0x7e1c": "Launchpad", + "0x7e1d": "輝度−", + "0x7e1e": "輝度+", + "0x7e1f": "Mission\nControl", + "0x00ab": "次の曲", + "0x00ac": "前の曲", + "0x7e20": "Bluetooth\n登録消去", + "0x7e21": "Bluetooth\n接続先0", + "0x7e22": "書き込み\nモード" } } diff --git a/.config/karabiner/torabo-tsuki-s.md b/.config/karabiner/torabo-tsuki-s.md index 0175255..5d5453c 100644 --- a/.config/karabiner/torabo-tsuki-s.md +++ b/.config/karabiner/torabo-tsuki-s.md @@ -1,6 +1,12 @@ # Torabo-tsuki (S) のキーマップ -[torabo-tsuki-s.json](torabo-tsuki-s.json) は、このキーボードからUSBで取得した8レイヤーのキー割り当てです。接続中のキー一覧もこのファイルを読み込みます。変更を依頼するときは「Toraboの数字レイヤーで、右手小指側のキーを0に」など、レイヤーと物理キーと希望する動作を伝えてください。 +ZMK版のキー割り当ては [torabo_tsuki.keymap](../torabo-zmk/config/torabo_tsuki.keymap) で管理します。MacでToraboのキー一覧を開くたびに、表示用の [torabo-tsuki-s.json](torabo-tsuki-s.json) を読み込みます。キーを変更するときは [ZMKの手順](../torabo-zmk/README.md) に沿って、ファームウェアのキーマップとMacの表示用データの両方を更新します。変更を依頼するときは「Toraboの数字レイヤーで、右手小指側のキーを0に」など、レイヤーと物理キーと希望する動作を伝えてください。 + +Toraboでは `f` を長押ししてから `b` を押すと、移動レイヤーのB位置が表示用の `F24` を送り、Karabinerがキー一覧を開きます。同じ `f` 保持中の `n` が英数(ABC)、`m` がかな(あいう)です。ZMKでは `LANG2` と `LANG1` を使います。内蔵キーボードの `f + b`、`f + n`、`f + m` でも同じ操作ができます。 + +## BMP/Vial版の設定を編集する + +[torabo-vial-keymap.json](torabo-vial-keymap.json) は、ZMKへの移行前にBMP/Vial版からUSBで取得した8レイヤーのキー割り当てです。この節の書き込み手順はBMP/Vial版のみに適用します。ZMKの表示用JSONは編集ツールが接続前に拒否します。 `keys` にある `id` は、0から始まる「行,列」です。対象レイヤーの `matrix[行][列]` にQMKのキーコードを16進で記載します。 `0x0000` は無効、`0x0001` は下のレイヤーの割り当てを使います。Vialが保持していたレイアウト選択値は `source.layout_options` に記録しています。キー一覧の物理配置はSサイズです。 @@ -12,11 +18,9 @@ swiftc -module-cache-path /private/tmp/torabo-swift-cache \ -o /private/tmp/torabo-keymap-device /private/tmp/torabo-keymap-device read # F を保持したときの B の位置を、ファイルに設定した値で更新する場合。 -/private/tmp/torabo-keymap-device apply-key ~/.config/karabiner/torabo-tsuki-s.json 2 2 5 0x0001 +/private/tmp/torabo-keymap-device apply-key ~/.config/karabiner/torabo-vial-keymap.json 2 2 5 0x0001 ``` -Toraboでは `f` を長押ししてから `b` を押すと、移動レイヤーのB位置が表示用の `F24` を送り、Karabinerがキー一覧を開きます。通常の `f` と `b` の短押しは元の設定を使います。内蔵キーボードの `f + b` でも接続に応じて表示を選びます。編集用JSONはキー一覧を開くたびに読み直されます。 - 物理配置は[製作者のVial定義](https://github.com/sekigon-gonnoc/vial-qmk/blob/dev/ble-micro-pro/keyboards/sekigon/torabo_tsuki/keymaps/vial/vial.json)を基にしました。読み取り・編集には[Vialの公式プロトコル](https://github.com/vial-kb/vial-gui/blob/main/src/main/python/protocol/keyboard_comm.py)を使います。 2026年11月24日の初回反映では、本体のL2・行2・列5だけを `0x0001` から `0x0073` へ変更しました。実機の全560セルを読み直し、編集元と一致し、ほかのセルに変更がないことを確認しました。接続判定・レイヤー表示・編集入力のテストと、Mac上でのキー一覧ウィンドウの開閉確認も行いました。物理キーを押しての確認は未実施です。 @@ -45,8 +49,8 @@ BlueNap 0.1.2と同じ方法でToraboだけに切断を要求しました。要 ### ZMKのディープスリープを検討した結果 -実機から読み取ったファームウェアはBMP/Vialの `bmp-vial-1.3.3-0-g45aa1bf436` です。ZMKの `CONFIG_ZMK_SLEEP` と `CONFIG_ZMK_IDLE_SLEEP_TIMEOUT` を使うには、製作者のZMK版へ左右両方を移行し、8レイヤーのキー割り当てやオートマウスレイヤーをZMK用に移す必要があります。製作者のZMK版は実験用です。[製作者のZMK版](https://github.com/sekigon-gonnoc/zmk-keyboard-torabo-tsuki) +移行前に実機から読み取ったファームウェアはBMP/Vialの `bmp-vial-1.3.3-0-g45aa1bf436` です。ZMKの `CONFIG_ZMK_SLEEP` と `CONFIG_ZMK_IDLE_SLEEP_TIMEOUT` を使うため、左右両方のファームウェアを切り替え、オートマウスレイヤーやキー割り当てを移植しました。[製作者のZMK版](https://github.com/sekigon-gonnoc/zmk-keyboard-torabo-tsuki) ZMKのタイマーはキーボードの無操作時間で、Macのスリープ開始とは連動しません。無操作から5分または15分でディープスリープする設定では、Macを寝かせた時点でToraboがまだ接続されている場合、今回のような約3秒後の画面点灯を防げるとは限りません。[ZMKの電源設定](https://zmk.dev/docs/config/power)・[macOSでの報告](https://github.com/zmkfirmware/zmk/issues/1273) -右側にトラックボールがある実機向けに、8レイヤーと15分のディープスリープを移植しました。編集とビルドは [ZMK設定](../torabo-zmk/README.md) を参照してください。ファームウェアを切り替える前のVial設定は左右別に退避しています。 +右側にトラックボールがある実機向けの設定で、ZMKのディープスリープは無操作15分です。編集とビルドは [ZMK設定](../torabo-zmk/README.md) を参照してください。ファームウェアを切り替える前のVial設定は左右別に退避しています。 diff --git a/.config/karabiner/torabo-vial-keymap.json b/.config/karabiner/torabo-vial-keymap.json new file mode 100644 index 0000000..eb0d945 --- /dev/null +++ b/.config/karabiner/torabo-vial-keymap.json @@ -0,0 +1,149 @@ +{ + "model": "Torabo-tsuki (S)", + "note": "各レイヤーのmatrixは実機に保存されている10行×7列の割り当てです。キー番号は0から始まる行と列を示します。座標はVial定義のS配列です。読み取り時の実機オプションはsourceに記録しています。", + "source": {"vial_protocol": 6, "layout_options": 1, "physical_layout": "S"}, + "keys": [ + {"id": "0,3", "x": 2.0, "y": 0.0}, {"id": "5,3", "x": 11.5, "y": 0.0}, {"id": "0,4", "x": 3.0, "y": 0.13}, + {"id": "5,4", "x": 10.5, "y": 0.13}, {"id": "0,2", "x": 1.0, "y": 0.25}, {"id": "0,5", "x": 4.0, "y": 0.25}, + {"id": "5,5", "x": 9.5, "y": 0.25}, {"id": "5,2", "x": 12.5, "y": 0.25}, {"id": "0,1", "x": 0.0, "y": 0.6}, + {"id": "5,1", "x": 13.5, "y": 0.6}, {"id": "1,3", "x": 2.0, "y": 1.0}, {"id": "6,3", "x": 11.5, "y": 1.0}, + {"id": "1,4", "x": 3.0, "y": 1.13}, {"id": "6,4", "x": 10.5, "y": 1.13}, {"id": "1,2", "x": 1.0, "y": 1.25}, + {"id": "1,5", "x": 4.0, "y": 1.25}, {"id": "6,5", "x": 9.5, "y": 1.25}, {"id": "6,2", "x": 12.5, "y": 1.25}, + {"id": "1,1", "x": 0.0, "y": 1.6}, {"id": "6,1", "x": 13.5, "y": 1.6}, {"id": "2,3", "x": 2.0, "y": 2.0}, + {"id": "7,3", "x": 11.5, "y": 2.0}, {"id": "2,4", "x": 3.0, "y": 2.13}, {"id": "7,4", "x": 10.5, "y": 2.13}, + {"id": "2,2", "x": 1.0, "y": 2.25}, {"id": "2,5", "x": 4.0, "y": 2.25}, {"id": "7,5", "x": 9.5, "y": 2.25}, + {"id": "7,2", "x": 12.5, "y": 2.25}, {"id": "2,1", "x": 0.0, "y": 2.6}, {"id": "7,1", "x": 13.5, "y": 2.6}, + {"id": "4,3", "x": 2.0, "y": 3.0}, {"id": "9,3", "x": 11.5, "y": 3.0}, {"id": "4,2", "x": 1.0, "y": 3.25}, + {"id": "9,2", "x": 12.5, "y": 3.25}, {"id": "4,4", "x": 3.15, "y": 3.5}, {"id": "9,4", "x": 10.35, "y": 3.5}, + {"id": "4,1", "x": 0.0, "y": 3.6}, {"id": "9,1", "x": 13.5, "y": 3.6}, {"id": "4,5", "x": 4.279, "y": 3.594}, + {"id": "4,6", "x": 5.359, "y": 3.9}, {"id": "9,6", "x": 8.14, "y": 3.908}, {"id": "9,5", "x": 9.224, "y": 3.614} + ], + "layers": [ + {"name": "L0 基本", "matrix": [ + ["0x0000", "0x0014", "0x001a", "0x0008", "0x0015", "0x0017", "0x0000"], + ["0x0000", "0x0004", "0x0016", "0x4307", "0x4209", "0x000a", "0x0000"], + ["0x0000", "0x001d", "0x001b", "0x4506", "0x4419", "0x4605", "0x0000"], + ["0x0000", "0x0000", "0x0000", "0x0000", "0x0000", "0x0000", "0x0000"], + ["0x0000", "0x0001", "0x00e3", "0x00e2", "0x00e0", "0x2828", "0x222c"], + ["0x0000", "0x0000", "0x0012", "0x410c", "0x0018", "0x001c", "0x0000"], + ["0x0000", "0x0013", "0x410f", "0x410e", "0x000d", "0x000b", "0x0000"], + ["0x0000", "0x5201", "0x0000", "0x0010", "0x0011", "0x0000", "0x0000"], + ["0x0000", "0x0000", "0x0000", "0x0000", "0x0000", "0x0000", "0x0000"], + ["0x0000", "0x410c", "0x0000", "0x0000", "0x0000", "0x3858", "0x322c"] + ]}, + {"name": "L1 マウス", "matrix": [ + ["0x0000", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0000"], + ["0x0000", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0000"], + ["0x0000", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0000"], + ["0x0000", "0x0000", "0x0000", "0x0000", "0x0000", "0x0000", "0x0000"], + ["0x0000", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001"], + ["0x0000", "0x0001", "0x00d5", "0x0001", "0x0001", "0x0001", "0x0000"], + ["0x0000", "0x00d2", "0x00d2", "0x7e19", "0x00d1", "0x00d4", "0x0000"], + ["0x0000", "0x5200", "0x0001", "0x00d1", "0x7e19", "0x0001", "0x0000"], + ["0x0000", "0x0000", "0x0000", "0x0000", "0x0000", "0x0000", "0x0000"], + ["0x0000", "0x7e19", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001"] + ]}, + {"name": "L2 移動", "matrix": [ + ["0x0000", "0x0029", "0x0001", "0x002a", "0x0001", "0x0001", "0x0000"], + ["0x0000", "0x002b", "0x002b", "0x00e3", "0x0001", "0x0001", "0x0000"], + ["0x0000", "0x0001", "0x0001", "0x0001", "0x0001", "0x0073", "0x0000"], + ["0x0000", "0x0000", "0x0000", "0x0000", "0x0000", "0x0000", "0x0000"], + ["0x0000", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001"], + ["0x0000", "0x004c", "0x0001", "0x0001", "0x002a", "0x0001", "0x0000"], + ["0x0000", "0x0001", "0x004f", "0x0052", "0x0051", "0x0050", "0x0000"], + ["0x0000", "0x0001", "0x0001", "0x7700", "0x7700", "0x0001", "0x0000"], + ["0x0000", "0x0000", "0x0000", "0x0000", "0x0000", "0x0000", "0x0000"], + ["0x0000", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001"] + ]}, + {"name": "L3 数字", "matrix": [ + ["0x0000", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0000"], + ["0x0000", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0000"], + ["0x0000", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0000"], + ["0x0000", "0x0000", "0x0000", "0x0000", "0x0000", "0x0000", "0x0000"], + ["0x0000", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001"], + ["0x0000", "0x0000", "0x0026", "0x0025", "0x0024", "0x0001", "0x0000"], + ["0x0000", "0x0027", "0x0023", "0x0022", "0x0021", "0x0001", "0x0000"], + ["0x0000", "0x0001", "0x0020", "0x001f", "0x001e", "0x0001", "0x0000"], + ["0x0000", "0x0000", "0x0000", "0x0000", "0x0000", "0x0000", "0x0000"], + ["0x0000", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001"] + ]}, + {"name": "L4 記号", "matrix": [ + ["0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001"], + ["0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001"], + ["0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001"], + ["0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001"], + ["0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001"], + ["0x0001", "0x0001", "0x0030", "0x002f", "0x002e", "0x002d", "0x0001"], + ["0x0001", "0x0001", "0x0032", "0x0034", "0x0033", "0x0089", "0x0001"], + ["0x0001", "0x0087", "0x0038", "0x0037", "0x0036", "0x0001", "0x0001"], + ["0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001"], + ["0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001"] + ]}, + {"name": "L5 ファンクション", "matrix": [ + ["0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001"], + ["0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001"], + ["0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001"], + ["0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001"], + ["0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001"], + ["0x0001", "0x0043", "0x0042", "0x0041", "0x0040", "0x0001", "0x0001"], + ["0x0001", "0x0044", "0x003f", "0x003e", "0x003d", "0x0045", "0x0001"], + ["0x0001", "0x0001", "0x003c", "0x003b", "0x003a", "0x0001", "0x0001"], + ["0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001"], + ["0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001"] + ]}, + {"name": "L6 記号・システム", "matrix": [ + ["0x0001", "0x00a5", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001"], + ["0x0001", "0x001e", "0x0001", "0x00a6", "0x00a6", "0x0001", "0x0001"], + ["0x0001", "0x0001", "0x00b0", "0x00e3", "0x00e2", "0x0001", "0x0001"], + ["0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001"], + ["0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001"], + ["0x0001", "0x00a6", "0x0035", "0x002d", "0x002a", "0x002e", "0x0001"], + ["0x0001", "0x0038", "0x0032", "0x0030", "0x0030", "0x0231", "0x0001"], + ["0x0001", "0x0087", "0x0064", "0x002f", "0x0034", "0x0031", "0x0001"], + ["0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001"], + ["0x0001", "0x0001", "0x0087", "0x0034", "0x0001", "0x0001", "0x0001"] + ]}, + {"name": "L7 マウス", "matrix": [ + ["0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001"], + ["0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001"], + ["0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001"], + ["0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001"], + ["0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001"], + ["0x0001", "0x0001", "0x00d5", "0x0001", "0x00d4", "0x0001", "0x0001"], + ["0x0001", "0x0001", "0x00d2", "0x7e19", "0x00d1", "0x0001", "0x0001"], + ["0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001"], + ["0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001"], + ["0x0001", "0x7e19", "0x0001", "0x0001", "0x0001", "0x0001", "0x0001"] + ]} + ], + "custom_keycodes": { + "0x7e00": "SEL\nBLE", + "0x7e01": "SEL\nUSB", + "0x7e02": "ADV\nID0", + "0x7e03": "ADV\nID1", + "0x7e04": "ADV\nID2", + "0x7e05": "ADV\nID3", + "0x7e06": "ADV\nID4", + "0x7e07": "ADV\nID5", + "0x7e08": "ADV\nID6", + "0x7e09": "ADV\nID7", + "0x7e0a": "ADV\nW/O L", + "0x7e0b": "DEL\nID0", + "0x7e0c": "DEL\nID1", + "0x7e0d": "DEL\nID2", + "0x7e0e": "DEL\nID3", + "0x7e0f": "DEL\nID4", + "0x7e10": "DEL\nID5", + "0x7e11": "DEL\nID6", + "0x7e12": "DEL\nID7", + "0x7e13": "DEL\nALL", + "0x7e14": "BATT\nLV", + "0x7e15": "ENT\nSLP", + "0x7e16": "D\nOVR", + "0x7e17": "UJ\nOVR", + "0x7e18": "JU\nOVR", + "0x7e19": "ドラッグ\nスクロール", + "0x7e1a": "TB AS\nENCODER1", + "0x7e1b": "TB AS\nENCODER2" + } +} diff --git a/.config/torabo-zmk/README.md b/.config/torabo-zmk/README.md index 17430a6..c6c87fd 100644 --- a/.config/torabo-zmk/README.md +++ b/.config/torabo-zmk/README.md @@ -2,7 +2,7 @@ 右手側にトラックボールがある通常版Torabo-tsuki (S) 用です。[製作者のZMK版](https://github.com/sekigon-gonnoc/zmk-keyboard-torabo-tsuki)を使い、右を親機、左を子機としてビルドします。 -- [キー割り当て](config/torabo_tsuki.keymap) に8レイヤーと、ドラッグスクロール中だけ使うレイヤーを定義します。Fを保持してBを押すとF24が送られ、Macでキー一覧が開きます。 +- [キー割り当て](config/torabo_tsuki.keymap) に、ドラッグスクロールとメディア操作を含む10レイヤーを定義します。Fを保持してBを押すとF24が送られ、Macでキー一覧が開きます。 - [トラックボールの設定](config/torabo-pointing.dtsi) ではボールを動かしたときにレイヤー1へ入ります。[本体の設定](config/torabo_tsuki.conf) でカーソル分解能600、マウスレイヤーが有効な時間664ミリ秒、無操作から15分でのディープスリープを指定します。 - [記憶領域の設定](config/ble_micro_pro.overlay) はZMKの保存先を専用領域に移し、BMP/Vialの保存先と重なるのを防ぎます。Vialに戻すためのファームウェアと左右のバックアップは、ユーザー限定の `~/.local/share/torabo-firmware-backup/` に保管しました。 - Macのキー一覧は [Toraboの表示用データ](../karabiner/torabo-tsuki-s.json) を読みます。キーを変えるときはZMKのキー割り当てと表示データの両方に反映してください。ZMK StudioはUSB接続時に使えます。Studioで本体上だけを編集した変更はdotfilesに手動で反映してください。 @@ -11,9 +11,9 @@ 1. GitHubで `config/torabo_tsuki.keymap` を開き、変更するレイヤーのキーを書き換えます。カーソル速度や休止時間は `config/torabo_tsuki.conf` で変更できます。Macの一覧にも反映する場合は、同じ位置を [表示用のJSON](../karabiner/torabo-tsuki-s.json) に記録します。 2. mainに変更が入るとビルドが始まります。手動でビルドするときは [GitHub ActionsのToraboビルド](https://github.com/ishiooon/dotfiles/actions/workflows/torabo-zmk.yml) で「Run workflow」を選びます。 -3. 成功した実行結果の「Artifacts」から `torabo-tsuki-s-firmware` をダウンロードします。ZIPには右親機と左子機の `.uf2` と、使った依存関係の一覧が入っています。 +3. 成功した実行結果の「Artifacts」から `torabo-tsuki-s-firmware` をダウンロードします。ZIPには右親機・左子機・設定消去用の `.uf2` と、使った依存関係の一覧が入っています。 -ブラウザからの編集・ビルドはMac、Windows、Linuxで同じ手順です。MacのF長押し+Bによるキー一覧にはKarabiner-Elementsが必要です。 +ブラウザからの編集・ビルドはMac、Windows、Linuxで同じ手順です。MacのF長押し+Bによるキー一覧にはKarabiner-Elementsが必要です。Torabo本体では `F` 押し込み中の `N` が英数(ABC)、`M` がかな(あいう)です。内蔵キーボードでは Karabiner の `f+n` / `f+m` が同じ役割です。 ### 手元でビルドする @@ -23,9 +23,9 @@ MacはDocker Desktop、LinuxはDocker Engine、WindowsはDocker DesktopのWSL 2 bash .config/torabo-zmk/build-local.sh ``` -作業フォルダは実行時に表示されます。左右の `.uf2` はその中の `firmware/` に生成され、使ったソースの版は `resolved-west.yml` に残ります。以前の作業フォルダを引数にすると、取り込んだソースを再利用できます。 +作業フォルダは実行時に表示されます。右親機・左子機・設定消去用の `.uf2` はその中の `firmware/` に生成され、使ったソースの版は `resolved-west.yml` に残ります。以前の作業フォルダを引数にすると、取り込んだソースを再利用できます。 -ZMK Studioで入力を保存したことがある場合は、再書き込み後も保存済みの割り当てが使われます。リポジトリの割り当てに戻すにはStudioで「Restore Stock Settings」を選びます。[ZMK Studioの公式手順](https://zmk.dev/docs/features/studio) +ZMK Studioで保存した割り当ては再書き込み後も残ります。リポジトリのキー割り当てを使うときは、Studioで「Restore Stock Settings」を選びます。[ZMK Studioの公式手順](https://zmk.dev/docs/features/studio) ## ファームウェアの切り替え @@ -33,7 +33,26 @@ ZMK Studioで入力を保存したことがある場合は、再書き込み後 左右の電源を入れ、最初は右をUSBで給電したままMacのBluetooth設定から `Torabo-tsuki S` に接続します。旧 `(BMP)torabo-tsuki` の登録と競合する場合は、Macでその機器の登録を解除してから再検索します。[ZMKのBluetooth接続の切り分け](https://zmk.dev/docs/troubleshooting/connection-issues) -Bluetooth接続ではZMK版がキーボードとマウスの両方として認識されます。Karabinerはマウスを既定で処理対象から外すため、[Karabinerの設定](../karabiner/karabiner.json)ではこのToraboだけを明示的に処理対象にしています。ToraboのFを長押ししながらBを押すと、Bを押している間にキー一覧が表示されます。 +接続が進まないときは、Macから機器を削除します。右をUSB接続したまま `B` を長押しして `F` でプロファイル0を選び、続けて `B` を長押しして `D` でそのプロファイルを消去してから、Macと再ペアリングします。 + +### Bluetoothが繋がらないとき(settings reset) + +プロファイルを消しても接続できない場合は、左右のZMK設定を消去してから通常ファームを書き直します。この構成で作った `settings-reset-ble-micro-pro.uf2` は、ZMK専用の保存領域にあるペアリングやStudioの保存内容を消去します。 + +1. MacのBluetoothから `Torabo-tsuki S` を削除する。 +2. 右をUSB接続し、ブートローダ(`BLEMICROPRO`)を起動して `settings-reset-ble-micro-pro.uf2` を入れる。 +3. **USBを抜き → 電源オン → もう一度USBを挿す**(書き込みだけではリセットが完了しない)。 +4. 左も同じ手順で settings reset する。 +5. 右に `torabo-tsuki-s-right-central.uf2`、左に `torabo-tsuki-s-left-peripheral.uf2` を書き込む。 +6. 左右の電源を入れ、右をUSB給電したままBluetoothで再ペアする。 + +ブートローダの出し方: + +- **右親機:** `B` を長押ししながら `P` を押すと、右親機がブートローダ(`BLEMICROPRO`)に入ります。通常の `P` 単体は文字入力のままです。 +- **予備:** USB接続中にシリアルを1200bpsで開いて閉じる。`ls /dev/tty.usb*` でポートを確認し、`screen /dev/tty.usbmodem… 1200` のあと `Ctrl+a` → `k` → `y`。 +- **settings reset 直後など、通常起動しないとき:** マイコンの BOOT と GND をショートしたままUSB接続します。 + +Bluetooth接続ではZMK版がキーボードとマウスの両方として認識されます。[Karabinerの設定](../karabiner/karabiner.json)ではToraboを明示的に処理対象にし、F24での一覧表示と、F1〜F12を標準ファンクションキーとして送る処理を行います。ToraboのFを長押ししながらBを押すと、Bを押している間にキー一覧が表示されます。Bluetooth接続で取得できた左右の電池残量は、次回の一覧表示で確認できます。初回はBluetoothの許可が必要な場合があります。 ## Vialに戻すとき diff --git a/.config/torabo-zmk/build-local.sh b/.config/torabo-zmk/build-local.sh index c87c974..34b31bf 100644 --- a/.config/torabo-zmk/build-local.sh +++ b/.config/torabo-zmk/build-local.sh @@ -123,7 +123,7 @@ run_build() { west manifest --freeze --active-only > resolved-west.yml ' - # ネットワークから切り離して、右のトラックボール側と左の子機をコンパイルする。 + # ネットワークから切り離して、右・左・Bluetooth設定リセット用をコンパイルする。 "$docker_cli" run "${sandbox[@]}" --network none "$IMAGE" bash -ec ' export ZEPHYR_BASE=/workspace/zephyr CMAKE_BUILD_PARALLEL_LEVEL=4 west zephyr-export @@ -136,10 +136,32 @@ run_build() { -S studio-rpc-usb-uart -- -DZMK_CONFIG=/workspace/config \ "-DSHIELD=torabo_tsuki_$half" "${role[@]}" done + west build -p always -s zmk/app -d build-settings-reset -b ble_micro_pro -- \ + -DZMK_CONFIG=/workspace/config -DSHIELD=settings_reset + # 復旧用が通常版と同じZMK領域だけを消去し、BMP/Vial領域に届かないことを生成結果から確認する。 + python3 - <<"PY" +from pathlib import Path +import re + +def storage_region(build): + dts = Path(build, "zephyr", "zephyr.dts").read_text() + region = re.search(r"storage_partition:\s*partition@[0-9a-f]+\s*\{[^}]*?\breg\s*=\s*<\s*(0x[0-9a-f]+)\s+(0x[0-9a-f]+)\s*>", dts) + if region is None: + raise SystemExit(f"保存領域が見つかりません。{build}") + return tuple(int(value, 16) for value in region.groups()) + +expected = storage_region("build-right") +start, size = expected +if (start != 0xd0000 or size != 0x6000 + or any(storage_region(build) != expected for build in ("build-left", "build-settings-reset"))): + raise SystemExit("通常版と復旧用の保存領域が一致しないか、ZMK専用領域の範囲外です。") +print("右・左・復旧用の保存領域がZMK専用領域と一致しました。") +PY cp build-right/zephyr/zmk.uf2 firmware/torabo-tsuki-s-right-central.uf2 cp build-left/zephyr/zmk.uf2 firmware/torabo-tsuki-s-left-peripheral.uf2 + cp build-settings-reset/zephyr/zmk.uf2 firmware/settings-reset-ble-micro-pro.uf2 ' - printf '左右のファームウェア %s/firmware\n' "$workspace" + printf '左右と settings reset のファームウェア %s/firmware\n' "$workspace" } main "$@" diff --git a/.config/torabo-zmk/config/torabo_tsuki.conf b/.config/torabo-zmk/config/torabo_tsuki.conf index 34deeaf..09d66c9 100644 --- a/.config/torabo-zmk/config/torabo_tsuki.conf +++ b/.config/torabo-zmk/config/torabo_tsuki.conf @@ -13,3 +13,12 @@ CONFIG_BT_DIS_PNP_PID=0xBCAD # 現在の実機と同じカーソル分解能と、自動でマウスレイヤーから戻るまでの時間を使う。 CONFIG_PMW3610_CPI=600 CONFIG_PMW3610_AUTOMOUSE_TIMEOUT_MS=664 + +# 一部MacでBluetoothペアリングが途中で止まるのを避ける。 +CONFIG_BT_CTLR_PHY_2M=n + +# 左右それぞれで電池残量を測定する。左の残量をホストへ転送する設定は右親機で有効にする。 +CONFIG_ZMK_BATTERY_REPORTING=y + +# 日本語のレイヤー名をUTF-8の終端文字まで含めてStudioに渡せるようにする。 +CONFIG_ZMK_KEYMAP_LAYER_NAME_MAX_LEN=32 diff --git a/.config/torabo-zmk/config/torabo_tsuki.keymap b/.config/torabo-zmk/config/torabo_tsuki.keymap index d584327..b8f1d55 100644 --- a/.config/torabo-zmk/config/torabo_tsuki.keymap +++ b/.config/torabo-zmk/config/torabo_tsuki.keymap @@ -1,5 +1,6 @@ #include #include +#include #include #include "torabo-pointing.dtsi" @@ -17,6 +18,16 @@ <¯o_tap &kp SPACE>, <¯o_release &kp LCTRL>; ) + + // X長押しでメディア層。判定を短くする(ノード名 hold_tap の重複を避ける)。 + media_x: media_hold_tap { + compatible = "zmk,behavior-hold-tap"; + #binding-cells = <2>; + tapping-term-ms = <120>; + quick-tap-ms = <200>; + flavor = "hold-preferred"; + bindings = <&mo>, <&kp>; + }; }; keymap { @@ -26,30 +37,33 @@ layer_0 { display-name = "基本"; bindings = < - &kp Q &kp W &kp E &kp R &kp T &kp Y &kp U < 1 I &kp O &none - &kp A &kp S < 3 D < 2 F &kp G &kp H &kp J < 1 K < 1 L &kp P - &kp Z &kp X < 5 C < 4 V < 6 B &none &kp N &kp M &none &to 1 - &trans &kp LGUI &kp LALT &kp LCTRL &mt LGUI RET &mt LSHFT SPACE &mt RSHFT SPACE &mt RGUI KP_ENTER &none &none &none < 1 I + &kp Q &kp W &kp E &kp R &kp T &kp Y &kp U &kp I &kp O &mo 8 + &kp A &kp S < 3 D < 2 F &kp G &kp H &kp J &kp K &kp L &kp P + &mt LCTRL Z &media_x 9 X < 5 C < 4 V < 6 B &none &kp N &kp M &none &to 1 + &kp CAPSLOCK &kp LGUI &kp LALT &kp LALT &mt LGUI RET &mt LSHFT SPACE &mt RSHFT SPACE &mt RGUI RET &none &none &none &to 0 >; }; + // ボールで入るマウス層。H戻る J左クリック K右クリック L進む。N長押し相当は mo でスクロール。 layer_1 { display-name = "マウス"; bindings = < - &trans &trans &trans &trans &trans &trans &trans &trans &mkp MB5 &trans - &trans &trans &trans &trans &trans &mkp MB4 &mkp LCLK &mo 8 &mkp RCLK &mkp RCLK + &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans + &trans &trans &trans &trans &trans &mkp MB4 &mkp LCLK &mkp RCLK &mkp MB5 &trans &trans &trans &trans &trans &trans &trans &mo 8 &mkp LCLK &trans &to 0 - &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &mo 8 + &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &to 0 >; }; // 左手のFを保持してBを押すと、Macでキー一覧を開くF24を送る。 + // F+Nで英数(ABC)、F+Mでかな(あいう)。MacのLANG2/LANG1に対応する。 + // 一番右下は全レイヤーで &to 0(基本レイヤーへ強制復帰)。 layer_2 { display-name = "移動"; bindings = < &kp ESC &trans &kp BSPC &trans &trans &trans &kp BSPC &trans &trans &kp DEL &kp TAB &kp TAB &kp LGUI &trans &trans &kp LEFT &kp DOWN &kp UP &kp RIGHT &trans - &trans &trans &trans &trans &kp F24 &trans &ctrl_space &ctrl_space &trans &trans + &trans &trans &trans &trans &kp F24 &trans &kp LANG2 &kp LANG1 &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans >; }; @@ -64,32 +78,37 @@ >; }; + // Karabinerのv長押しと同じ記号配置(右手)。 + // Y¥ U- I= O[ / H~ J; K' L\ P] / N, M. (M右隣)/ layer_4 { display-name = "記号"; bindings = < - &trans &trans &trans &trans &trans &kp MINUS &kp EQUAL &kp LBKT &kp RBKT &trans - &trans &trans &trans &trans &trans &kp INTERNATIONAL_3 &kp SEMI &kp SQT &kp NON_US_HASH &trans - &trans &trans &trans &trans &trans &trans &kp COMMA &kp DOT &kp FSLH &kp INTERNATIONAL_1 + &trans &trans &trans &trans &trans &kp INTERNATIONAL_3 &kp MINUS &kp EQUAL &kp LBKT &trans + &trans &trans &trans &trans &trans &kp LS(GRAVE) &kp SEMI &kp SQT &kp BSLH &kp RBKT + &trans &trans &trans &trans &trans &trans &kp COMMA &kp DOT &kp FSLH &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans >; }; + // C長押し。標準の F1–F12(Karabinerでメディア化を防ぐ)。数字層と同じ位置。 + // Y=F12 U=F7 I=F8 O=F9 / H=F11 J=F4 K=F5 L=F6 P=F10 / N=F1 M=F2 (M右)=F3 layer_5 { - display-name = "機能"; + display-name = "ファンクション"; bindings = < - &trans &trans &trans &trans &trans &trans &kp F7 &kp F8 &kp F9 &kp F10 - &trans &trans &trans &trans &trans &kp F12 &kp F4 &kp F5 &kp F6 &kp F11 + &trans &trans &trans &trans &trans &kp F12 &kp F7 &kp F8 &kp F9 &trans + &trans &trans &trans &trans &trans &kp F11 &kp F4 &kp F5 &kp F6 &kp F10 &trans &trans &trans &trans &trans &trans &kp F1 &kp F2 &kp F3 &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans >; }; // このZMK版が送信できるConsumerページの電源とスリープを使用する。 + // B長押し+Dで現在のBTプロファイル消去、B長押し+Fでプロファイル0選択(Mac再ペア用)。 layer_6 { display-name = "記号・電源"; bindings = < &kp C_POWER &trans &trans &trans &trans &kp EQUAL &kp BSPC &kp MINUS &kp GRAVE &kp C_SLEEP - &kp N1 &trans &kp C_SLEEP &kp C_SLEEP &trans &kp LS(BSLH) &kp RBKT &kp RBKT &kp NON_US_HASH &kp FSLH + &kp N1 &trans &bt BT_CLR &bt BT_SEL 0 &trans &kp LS(BSLH) &kp RBKT &kp RBKT &kp NON_US_HASH &bootloader &trans &kp C_EJECT &kp LGUI &kp LALT &trans &kp BSLH &kp SQT &kp LBKT &kp NON_US_BSLH &kp INTERNATIONAL_1 &trans &trans &trans &trans &trans &trans &trans &trans &trans &kp SQT &kp INTERNATIONAL_1 &trans >; @@ -101,7 +120,7 @@ &trans &trans &trans &trans &trans &trans &mkp MB4 &trans &mkp MB5 &trans &trans &trans &trans &trans &trans &trans &mkp LCLK &mo 8 &mkp RCLK &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans - &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &mo 8 + &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &to 0 >; }; @@ -115,6 +134,18 @@ &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans >; }; + + // X長押し。MacのFキー帯に相当するメディア/輝度/Mission Control。 + // Y音量+ U前 I再生 O次 / H音量- J Launchpad K輝度- L輝度+ Pミュート / N輝度- M輝度+ (M右)Mission Control + media { + display-name = "メディア"; + bindings = < + &trans &trans &trans &trans &trans &kp C_VOL_UP &kp C_PREV &kp C_PP &kp C_NEXT &trans + &trans &trans &trans &trans &trans &kp C_VOL_DN &kp C_AC_DESKTOP_SHOW_ALL_APPLICATIONS &kp C_BRI_DEC &kp C_BRI_INC &kp C_MUTE + &trans &trans &trans &trans &trans &trans &kp C_BRI_DEC &kp C_BRI_INC &kp C_AC_DESKTOP_SHOW_ALL_WINDOWS &trans + &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans + >; + }; }; }; diff --git a/.config/torabo-zmk/config/torabo_tsuki_right.conf b/.config/torabo-zmk/config/torabo_tsuki_right.conf new file mode 100644 index 0000000..f2eaa7b --- /dev/null +++ b/.config/torabo-zmk/config/torabo_tsuki_right.conf @@ -0,0 +1,3 @@ +# 右親機は左子機の電池残量を取得し、Bluetoothでホストへ転送する。 +CONFIG_ZMK_SPLIT_BLE_CENTRAL_BATTERY_LEVEL_FETCHING=y +CONFIG_ZMK_SPLIT_BLE_CENTRAL_BATTERY_LEVEL_PROXY=y diff --git a/.github/workflows/torabo-zmk.yml b/.github/workflows/torabo-zmk.yml index c861ecd..acb3770 100644 --- a/.github/workflows/torabo-zmk.yml +++ b/.github/workflows/torabo-zmk.yml @@ -43,5 +43,6 @@ jobs: path: | ${{ runner.temp }}/torabo-zmk/firmware/torabo-tsuki-s-right-central.uf2 ${{ runner.temp }}/torabo-zmk/firmware/torabo-tsuki-s-left-peripheral.uf2 + ${{ runner.temp }}/torabo-zmk/firmware/settings-reset-ble-micro-pro.uf2 ${{ runner.temp }}/torabo-zmk/resolved-west.yml if-no-files-found: error diff --git a/tests/karabiner_f_hjkl_config_test.sh b/tests/karabiner_f_hjkl_config_test.sh index e55621e..2ef2a51 100755 --- a/tests/karabiner_f_hjkl_config_test.sh +++ b/tests/karabiner_f_hjkl_config_test.sh @@ -49,8 +49,14 @@ fi python3 -m json.tool "$LAYERS_FILE" >/dev/null -if ! grep -Fq '"id": "base"' "$LAYERS_FILE" || ! grep -Fq '"id": "f"' "$LAYERS_FILE"; then - echo "レイヤー定義に base / f が含まれていません。" >&2 +for layer_id in base f d v c x; do + if ! grep -Fq "\"id\": \"$layer_id\"" "$LAYERS_FILE"; then + echo "レイヤー定義に $layer_id が含まれていません。" >&2 + exit 1 + fi +done +if ! grep -Fq '"z": "z/⌃"' "$LAYERS_FILE"; then + echo "ベースレイヤーに z hold=Control の表示がありません。" >&2 exit 1 fi @@ -113,7 +119,19 @@ for expected in \ '"key_code": "0"' \ 'd layer' \ '"name": "v_held"' \ - 'v layer'; do + 'v layer' \ + '"name": "c_held"' \ + 'c layer' \ + '"name": "x_held"' \ + 'x layer' \ + '"key_code": "z"' \ + 'left_control' \ + 'z hold=Control' \ + '"key_code": "escape"' \ + '"key_code": "delete_forward"' \ + 'launchpad' \ + 'mission_control' \ + 'volume_increment'; do if ! grep -Fq "$expected" "$CONFIG_FILE"; then echo "Karabiner 設定に期待した定義が含まれていません: $expected" >&2 exit 1 diff --git a/tests/karabiner_torabo_battery_test.sh b/tests/karabiner_torabo_battery_test.sh new file mode 100644 index 0000000..9d34d02 --- /dev/null +++ b/tests/karabiner_torabo_battery_test.sh @@ -0,0 +1,113 @@ +#!/usr/bin/env bash +set -euo pipefail + +if [[ "${1:-}" != "--env=localdev" ]]; then + printf '%s\n' '--env=localdev を指定してください。' >&2 + exit 2 +fi + +root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd -P)" +fixture="$(mktemp -d)" +trap 'touch "$fixture/release"; rm -rf "$fixture"' EXIT +export XDG_CACHE_HOME="$fixture/cache" +export HUD_TEST_FIXTURE="$fixture" +export BASH_ENV="$fixture/mock-shell" +export KARABINER_HUD_HIDUTIL="$fixture/hidutil" +state="$XDG_CACHE_HOME/karabiner-keymap-hud" +mkdir -p "$state" +printf '12345\n' >"$state/daemon.pid" +printf 'idle\n' >"$state/command" +export HUD_TEST_PROCESS="/usr/bin/osascript -l JavaScript $root/.config/karabiner/scripts/keymap-hud.js daemon $root/.config/karabiner/scripts/keymap-hud.html $root/.config/karabiner/keymap-layers.json $state/daemon.pid $state/command" + +# 起動済みのHUDと遅いコンパイラーを模擬し、macOSの画面や実機には触れない。 +cat >"$BASH_ENV" <<'SH' +kill() { [[ "$*" == '-0 12345' ]]; } +ps() { printf '%s\n' "$HUD_TEST_PROCESS"; } +function /usr/bin/swiftc() { + local last="" + for last; do :; done + printf 'compile\n' >>"$HUD_TEST_FIXTURE/compilations" + for attempt in {1..100}; do + [[ ! -d "$HUD_TEST_FIXTURE" ]] && return 1 + [[ -f "$HUD_TEST_FIXTURE/release" ]] && break + sleep 0.05 + done + [[ -f "$HUD_TEST_FIXTURE/release" ]] || return 1 + cat >"$last" <<'READER' +#!/usr/bin/env bash +printf 'read\n' >>"$HUD_TEST_FIXTURE/reads" +printf '%s\n' '{"right":80,"left":30}' +READER + chmod +x "$last" +} +SH +cat >"$KARABINER_HUD_HIDUTIL" <<'SH' +#!/usr/bin/env bash +printf '%s\n' '0xfeed 0xbcad 0x2 1 6 0x2 Bluetooth Low Energy IOHIDUserDevice Torabo-tsuki S (null) 0' +SH +chmod +x "$KARABINER_HUD_HIDUTIL" + +python3 - "$root/.bin/karabiner-keymap-hud" "$fixture" "$state" <<'PY' +import json +import subprocess +import sys +import time +from pathlib import Path + +launcher, fixture, state = map(Path, sys.argv[1:]) + +def call(command): + subprocess.run(["bash", launcher, command], check=True, timeout=2) + +def wait_for(path): + end = time.monotonic() + 5 + while not path.exists(): + assert time.monotonic() < end, path + time.sleep(0.05) + +# コンパイル待ちの状態でも表示が戻り、同じ残量取得が並走しないことを確認する。 +call("show") +assert (state / "command").read_text() == "show torabo\n" +wait_for(fixture / "compilations") +call("show") +call("hide") +assert (state / "command").read_text() == "hide\n" +(fixture / "release").touch() +result = state / "torabo-battery.json" +wait_for(result) +assert json.loads(result.read_text()) == {"right": 80, "left": 30} +assert (fixture / "compilations").read_text() == "compile\n" +assert (fixture / "reads").read_text() == "read\n" +assert (state / "command").read_text() == "hide\n" +PY + +# 実機を使わず、GATTの特性表示形式に基づいて左右を判別する。 +if [[ "$(uname -s)" == Darwin ]]; then + sed '/^let reader = Reader()/,$d' "$root/.config/karabiner/scripts/torabo-battery.swift" >"$fixture/Battery.swift" + cat >"$fixture/main.swift" <<'SWIFT' +import Foundation + +let main = Data([0x04, 0, 0xad, 0x27, 1, 6, 1]) +let auxiliary = Data([0x04, 0, 0xad, 0x27, 1, 8, 1]) +precondition(batterySide(format: main) == .right) +precondition(batterySide(format: auxiliary) == .left) +precondition(batterySide(format: main.dropLast()) == nil) +precondition(batterySide(format: Data([0x04, 0, 0xad, 0x27, 2, 8, 1])) == nil) + +var levels = BatteryLevels() +levels.record(Data([30]), side: .left) +levels.record(Data([80]), side: .right) +precondition(levels.values == ["right": 80, "left": 30]) +levels.record(Data([101]), side: .right) +precondition(levels.values["right"] == 80) +levels.record(Data([75]), side: .right) +precondition(levels.values == ["left": 30]) +var disconnected = BatteryLevels() +disconnected.record(Data([0]), side: .left) +precondition(disconnected.values.isEmpty) +SWIFT + /usr/bin/swiftc -module-cache-path "$fixture/swift-cache" "$fixture/Battery.swift" "$fixture/main.swift" -o "$fixture/test-battery" + "$fixture/test-battery" +fi + +printf '%s\n' '成功: 残量取得はHUDの表示を待たせず、電池残量は応答の順序に関係なく左右を判別します。' diff --git a/tests/karabiner_torabo_editor_test.sh b/tests/karabiner_torabo_editor_test.sh index 2103685..01c3b85 100755 --- a/tests/karabiner_torabo_editor_test.sh +++ b/tests/karabiner_torabo_editor_test.sh @@ -23,7 +23,10 @@ source = root / '.config/karabiner/scripts/torabo-keymap-device.swift' binary = temporary / 'torabo-keymap-device' subprocess.run(['swiftc', '-module-cache-path', str(temporary / 'modules'), str(source), '-o', str(binary)], check=True, timeout=180) -fixture = json.loads((root / '.config/karabiner/torabo-tsuki-s.json').read_text()) +fixture = json.loads((root / '.config/karabiner/torabo-vial-keymap.json').read_text()) +display = json.loads((root / '.config/karabiner/torabo-tsuki-s.json').read_text()) +assert len(fixture['layers']) == 8, '旧BMP/Vial向けの取得済み設定を8層のまま保存する' +assert fixture['layers'][2]['matrix'][2][5] == '0x0073', '実機から取得したキー割り当てを保持する' config = temporary / 'settings.json' @@ -52,9 +55,17 @@ for value in ['0x10000', '0xGGGG', '1', '0x1']: reject([*base[:-1], value], 'キーコード') reject(['apply-key', str(config), '2', '3', '0', '0x0001'], '物理キー') +# 表示用のZMKデータはレイヤーを減らしてもVial設定として使えない。 +write_fixture(display) +reject(base, 'ZMK') +display['layers'] = display['layers'][:8] +write_fixture(display) +reject(base, 'ZMK') + # 他のセルに不正な値があっても、設定全体を検証してから一件の反映を開始する。 for mutation, expected in [ - (lambda value: value['layers'].pop(), '8'), + (lambda value: value.__setitem__('layers', value['layers'][:7]), '8'), + (lambda value: value['layers'].append(copy.deepcopy(value['layers'][0])), '8'), (lambda value: value['layers'][0]['matrix'].pop(), '10'), (lambda value: value['layers'][0]['matrix'][0].pop(), '7'), (lambda value: value['layers'][0]['matrix'][0].__setitem__(0, '0x10000'), 'キーコード'), @@ -72,6 +83,14 @@ reject(base, 'JSON') harness = temporary / 'main.swift' harness.write_text(source.read_text() + '\n' + r''' import Foundation +let configuration = CommandLine.arguments[1] +let operation = try parseArguments(["apply-key", configuration, "2", "2", "5", "0x0001"]) +if case let .apply(layer, row, column, expected, desired) = operation { + precondition(layer == 2 && row == 2 && column == 5 && expected == 1 && desired == 0x73) +} else { + preconditionFailure("旧BMP/Vial設定から指定した1件を読み込めませんでした。") +} + func scenario(_ initial: UInt16, _ expected: UInt16, _ value: UInt16, _ stored: UInt16?, _ succeeds: Bool, _ writes: Int) { var current = initial, saves: [UInt16] = [] do { @@ -93,6 +112,6 @@ print("成功: 変更前の不一致は保存ゼロ、同値は保存ゼロ、 simulation = temporary / 'offline-scenarios' subprocess.run(['swiftc', '-D', 'TORABO_OFFLINE_TEST', '-module-cache-path', str(temporary / 'modules'), str(harness), '-o', str(simulation)], check=True, timeout=180) -subprocess.run([str(simulation)], check=True, timeout=5) +subprocess.run([str(simulation), str(root / '.config/karabiner/torabo-vial-keymap.json')], check=True, timeout=5) print('成功: Toraboの無効な操作、範囲外、物理キー以外、不正な設定を実機接続前に拒否しました。') PY diff --git a/tests/karabiner_torabo_hud_test.sh b/tests/karabiner_torabo_hud_test.sh index 924dba0..e45db7b 100644 --- a/tests/karabiner_torabo_hud_test.sh +++ b/tests/karabiner_torabo_hud_test.sh @@ -38,18 +38,19 @@ function openKeymap(definition) { const script = html.match(/