Skip to content

Instantly share code, notes, and snippets.

@s-show
Last active May 24, 2023 06:37
Show Gist options
  • Save s-show/92b823f8fe67e06b809f3d1c6d04bc4f to your computer and use it in GitHub Desktop.
Save s-show/92b823f8fe67e06b809f3d1c6d04bc4f to your computer and use it in GitHub Desktop.
Settings of 'Karabiner-Elements'. ( enthumble_mode )
<%# `each_key`の`to_if_alone`や`lazy`オプションを使う場合、[s-show/KE-complex_modifications](https://github.com/s-show/KE-complex_modifications)にある`scripts/erb2json.rb`を使う必要がある。 %>
{
"title": "enthumble(Windows App) Mode",
"rule_list": false,
"make_extra_description": true,
"rules": [
{
"description": "(enthumble) IJKL Mode / normal",
"extra_descriptions": [
"無変換/英数 + J, K, I, L -> カーソル移動(←, ↓, ↑, →)",
"無変換/英数 単独h -> 英数キー"
],
"extra_description_level": 1,
"manipulators":
<%=
manipulators = each_key(
source_keys_list: ["international5"],
dest_keys_list: ["fn"],
from_optional_modifiers: ["any"],
to_if_alone: ["japanese_eisuu"],
as_lazy: true
)
manipulators += each_key(
source_keys_list: ["lang2"],
dest_keys_list: ["fn"],
from_optional_modifiers: ["any"],
to_if_alone: ["japanese_eisuu"],
as_lazy: true
)
manipulators += each_key(
source_keys_list: ["j", "k", "i", "l"],
dest_keys_list: ["left_arrow", "down_arrow", "up_arrow", "right_arrow"],
from_mandatory_modifiers: ["fn"],
from_optional_modifiers: ["shift", "control", "caps_lock"],
)
JSON.generate(manipulators)
%>
},
{
"description": "(enthumble) WASD Mode / FPS like",
"extra_descriptions": [
"無変換/英数 + A, S, W, D -> カーソル移動(←, ↓, ↑, →)",
"無変換/英数 単独 -> 英数キー"
],
"extra_description_level": 1,
"manipulators":
<%=
manipulators = each_key(
source_keys_list: ["international5"],
dest_keys_list: ["fn"],
from_optional_modifiers: ["any"],
to_if_alone: ["japanese_eisuu"],
as_lazy: true
)
manipulators += each_key(
source_keys_list: ["lang2"],
dest_keys_list: ["fn"],
from_optional_modifiers: ["any"],
to_if_alone: ["japanese_eisuu"],
as_lazy: true
)
manipulators += each_key(
source_keys_list: ["a", "s", "w", "d"],
dest_keys_list: ["left_arrow", "down_arrow", "up_arrow", "right_arrow"],
from_mandatory_modifiers: ["fn"],
from_optional_modifiers: ["shift", "control", "caps_lock"],
)
JSON.generate(manipulators)
%>
},
{
"description": "(enthumble) HJKL Mode / vi like",
"extra_descriptions": [
"無変換/英数 + H, J, K, L -> カーソル移動(←, ↓, ↑, →)",
"無変換/英数 単独 -> 英数キー"
],
"extra_description_level": 1,
"manipulators":
<%=
manipulators = each_key(
source_keys_list: ["international5"],
dest_keys_list: ["fn"],
from_optional_modifiers: ["any"],
to_if_alone: ["japanese_eisuu"],
as_lazy: true
)
manipulators += each_key(
source_keys_list: ["lang2"],
dest_keys_list: ["fn"],
from_optional_modifiers: ["any"],
to_if_alone: ["japanese_eisuu"],
as_lazy: true
)
manipulators += each_key(
source_keys_list: ["h", "j", "k", "l"],
dest_keys_list: ["left_arrow", "down_arrow", "up_arrow", "right_arrow"],
from_mandatory_modifiers: ["fn"],
from_optional_modifiers: ["shift", "control", "caps_lock"],
)
JSON.generate(manipulators)
%>
},
{
"description": "(enthumble) FBNP Mode / emacs like",
"extra_descriptions": [
"無変換/英数 + B, N, P, F -> カーソル移動(←, ↓, ↑, →)",
"無変換/英数 単独 -> 英数キー"
],
"extra_description_level": 1,
"manipulators":
<%=
manipulators = each_key(
source_keys_list: ["international5"],
dest_keys_list: ["fn"],
from_optional_modifiers: ["any"],
to_if_alone: ["japanese_eisuu"],
as_lazy: true
)
manipulators += each_key(
source_keys_list: ["lang2"],
dest_keys_list: ["fn"],
from_optional_modifiers: ["any"],
to_if_alone: ["japanese_eisuu"],
as_lazy: true
)
manipulators += each_key(
source_keys_list: ["b", "n", "p", "f"],
dest_keys_list: ["left_arrow", "down_arrow", "up_arrow", "right_arrow"],
from_mandatory_modifiers: ["fn"],
from_optional_modifiers: ["shift", "control", "caps_lock"],
)
JSON.generate(manipulators)
%>
},
{
"description": "(enthumble) 無変換/英数 + 「Space/かな」で「Return/Escape」",
"extra_descriptions": [
"無変換/英数 + Space/かな -> Enter/Escape",
"'thumb IME'より下位に設定すると、'無変換/英数 + かな'はIMEオンになります。"
],
"extra_description_level": 1,
"manipulators":
<%=
manipulators = each_key(
source_keys_list: ["international5"],
dest_keys_list: ["fn"],
from_optional_modifiers: ["any"],
to_if_alone: ["japanese_eisuu"],
as_lazy: true
)
manipulators += each_key(
source_keys_list: ["lang2"],
dest_keys_list: ["fn"],
from_optional_modifiers: ["any"],
to_if_alone: ["japanese_eisuu"],
as_lazy: true
)
manipulators += each_key(
source_keys_list: ["spacebar", "international2"],
dest_keys_list: ["return_or_enter", "escape"],
from_mandatory_modifiers: ["fn"],
from_optional_modifiers: ["shift", "control", "caps_lock"],
)
JSON.generate(manipulators)
%>
},
{
"description": "(enthumble) 無変換/英数 + 「N,M/',' '.'」で「BackSpace/Delete」",
"extra_descriptions": [
"無変換/英数 + N, M -> BackSpace",
"無変換/英数 + ',' '.' -> Delete",
"'FBNP Mode'と併用すると、'無変換/英数 + N'はカーソル移動になります。"
],
"extra_description_level": 1,
"manipulators":
<%=
manipulators = each_key(
source_keys_list: ["international5"],
dest_keys_list: ["fn"],
from_optional_modifiers: ["any"],
to_if_alone: ["japanese_eisuu"],
as_lazy: true
)
manipulators += each_key(
source_keys_list: ["lang2"],
dest_keys_list: ["fn"],
from_optional_modifiers: ["any"],
to_if_alone: ["japanese_eisuu"],
as_lazy: true
)
manipulators += each_key(
source_keys_list: ["n", "m", "comma", "period"],
dest_keys_list: ["delete_or_backspace", "delete_or_backspace", "delete_forward", "delete_forward"],
from_mandatory_modifiers: ["fn"],
from_optional_modifiers: ["caps_lock"],
)
JSON.generate(manipulators)
%>
},
{
"description": "(enthumble) 無変換/英数 + 「Y,U/I,O」で「BackSpace/Delete」",
"extra_descriptions": [
"無変換/英数 + Y, U -> BackSpace",
"無変換/英数 + I, O -> Delete",
"'IJKL Mode'と併用すると、'無変換/英数 + I'はカーソル移動になります。"
],
"extra_description_level": 1,
"manipulators":
<%=
manipulators = each_key(
source_keys_list: ["international5"],
dest_keys_list: ["fn"],
from_optional_modifiers: ["any"],
to_if_alone: ["japanese_eisuu"],
as_lazy: true
)
manipulators += each_key(
source_keys_list: ["lang2"],
dest_keys_list: ["fn"],
from_optional_modifiers: ["any"],
to_if_alone: ["japanese_eisuu"],
as_lazy: true
)
manipulators += each_key(
source_keys_list: ["y", "u", "i", "o"],
dest_keys_list: ["delete_or_backspace", "delete_or_backspace", "delete_forward", "delete_forward"],
from_mandatory_modifiers: ["fn"],
from_optional_modifiers: ["caps_lock"],
)
JSON.generate(manipulators)
%>
},
{
"description": "(enthumble) 無変換/英数 + 矢印キー(←, ↓, ↑, →)で「←, ↓, ↑, →」入力",
"extra_description_level": 1,
"manipulators": [
{
"type": "basic",
"from": <%= from("international5", [], ["any"]) %>,
"to": <%= to([
["fn", nil, true]
]) %>,
"to_if_alone": <%= to(["japanese_eisuu"]) %>
},
{
"type": "basic",
"from": <%= from("left_arrow", ["fn"], ["caps_lock"]) %>,
"to": [
{ "shell_command": "osascript -e 'set the clipboard to \"←\"'" },
{ "shell_command": "osascript -e 'tell application \"System Events\" to keystroke \"v\" using command down'" }
]
},
{
"type": "basic",
"from": <%= from("down_arrow", ["fn"], ["caps_lock"]) %>,
"to": [
{ "shell_command": "osascript -e 'set the clipboard to \"↓\"'" },
{ "shell_command": "osascript -e 'tell application \"System Events\" to keystroke \"v\" using command down'" }
]
},
{
"type": "basic",
"from": <%= from("up_arrow", ["fn"], ["caps_lock"]) %>,
"to": [
{ "shell_command": "osascript -e 'set the clipboard to \"↑\"'" },
{ "shell_command": "osascript -e 'tell application \"System Events\" to keystroke \"v\" using command down'" }
]
},
{
"type": "basic",
"from": <%= from("right_arrow", ["fn"], ["caps_lock"]) %>,
"to": [
{ "shell_command": "osascript -e 'set the clipboard to \"→\"'" },
{ "shell_command": "osascript -e 'tell application \"System Events\" to keystroke \"v\" using command down'" }
]
}
]
},
{
"description": "(enthumble) thumb IME",
"extra_descriptions": [
"無変換/英数 -> IME OFF",
"変換/かな -> IME ON",
"この設定は、その他の(enthumble)設定より下位に設定すること。上位に設定すると、その他の(enthumble)設定が作動しなくなる。"
],
"extra_description_level": 1,
"manipulators":
<%=
each_key(
source_keys_list: ["international2", "international4", "international5"],
dest_keys_list: ["international2", "international4", "international5"],
from_optional_modifiers: ["caps_lock"],
to_if_alone: ["japanese_kana", "japanese_kana", "japanese_eisuu"],
as_json: true
)
%>
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment