Closed dylanjm closed 4 years ago
Can you try put spec mode
rules before tab mode
rules see if that works?
I have tried that and same results. I've also tried putting them all under the same description (similar to how yours is set up) both with tab mode
last and spec mode
last. Same results.
Looking at Karabiner Event Viewer, it won't even recognize spec mode
.
That's really wired. Can you paste your karabiner.json file here?
Sure no problem:
karabiner.json
{
"global" : {
"check_for_updates_on_startup" : true,
"show_in_menu_bar" : true,
"show_profile_name_in_menu_bar" : false
},
"profiles" : [ {
"complex_modifications" : {
"parameters" : {
"basic.simultaneous_threshold_milliseconds" : 50,
"basic.to_delayed_action_delay_milliseconds" : 500,
"basic.to_if_alone_timeout_milliseconds" : 500,
"basic.to_if_held_down_threshold_milliseconds" : 500
},
"rules" : [ {
"description" : "Auto generated layer conditions",
"manipulators" : [ {
"type" : "basic",
"to" : [ {
"set_variable" : {
"name" : "yabai-insert-mode",
"value" : 1
}
} ],
"from" : {
"key_code" : "i"
},
"to_after_key_up" : [ {
"set_variable" : {
"name" : "yabai-insert-mode",
"value" : 0
}
} ],
"to_if_alone" : [ {
"key_code" : "i"
} ],
"conditions" : [ {
"name" : "tab-mode",
"value" : 1,
"type" : "variable_if"
} ]
}, {
"type" : "basic",
"to" : [ {
"set_variable" : {
"name" : "yabai-move-mode",
"value" : 1
}
} ],
"from" : {
"key_code" : "f"
},
"to_after_key_up" : [ {
"set_variable" : {
"name" : "yabai-move-mode",
"value" : 0
}
} ],
"to_if_alone" : [ {
"key_code" : "f"
} ],
"conditions" : [ {
"name" : "tab-mode",
"value" : 1,
"type" : "variable_if"
} ]
}, {
"type" : "basic",
"to" : [ {
"set_variable" : {
"name" : "yabai-scale-mode",
"value" : 1
}
} ],
"from" : {
"key_code" : "c"
},
"to_after_key_up" : [ {
"set_variable" : {
"name" : "yabai-scale-mode",
"value" : 0
}
} ],
"to_if_alone" : [ {
"key_code" : "c"
} ],
"conditions" : [ {
"name" : "tab-mode",
"value" : 1,
"type" : "variable_if"
} ]
}, {
"type" : "basic",
"to" : [ {
"set_variable" : {
"name" : "tab-mode",
"value" : 1
}
} ],
"from" : {
"key_code" : "tab"
},
"to_after_key_up" : [ {
"set_variable" : {
"name" : "tab-mode",
"value" : 0
}
}, {
"set_variable" : {
"name" : "yabai-move-mode",
"value" : 0
}
}, {
"set_variable" : {
"name" : "yabai-scale-mode",
"value" : 0
}
}, {
"set_variable" : {
"name" : "spec-mode",
"value" : 0
}
} ],
"to_if_alone" : [ {
"key_code" : "tab"
} ]
}, {
"type" : "basic",
"to" : [ {
"set_variable" : {
"name" : "spec-mode",
"value" : 1
}
} ],
"from" : {
"key_code" : "s"
},
"to_after_key_up" : [ {
"set_variable" : {
"name" : "spec-mode",
"value" : 0
}
} ],
"to_if_alone" : [ {
"key_code" : "s"
} ],
"conditions" : [ {
"name" : "tab-mode",
"value" : 1,
"type" : "variable_if"
} ]
} ]
}, {
"description" : "caps to ctrl modifier",
"manipulators" : [ {
"from" : {
"key_code" : "caps_lock",
"modifiers" : {
"optional" : [ "any" ]
}
},
"to" : [ {
"key_code" : "left_control"
} ],
"type" : "basic"
} ]
}, {
"description" : "left ctrl to right ctrl",
"manipulators" : [ {
"from" : {
"key_code" : "left_control",
"modifiers" : {
"optional" : [ "any" ]
}
},
"to" : [ {
"key_code" : "right_control"
} ],
"type" : "basic"
} ]
}, {
"description" : "yabai insert mode",
"manipulators" : [ {
"from" : {
"key_code" : "h"
},
"to" : [ {
"shell_command" : "/usr/local/bin/yabai -m window --insert west"
} ],
"conditions" : [ {
"name" : "yabai-insert-mode",
"value" : 1,
"type" : "variable_if"
} ],
"type" : "basic"
}, {
"from" : {
"key_code" : "j"
},
"to" : [ {
"shell_command" : "/usr/local/bin/yabai -m window --insert south"
} ],
"conditions" : [ {
"name" : "yabai-insert-mode",
"value" : 1,
"type" : "variable_if"
} ],
"type" : "basic"
}, {
"from" : {
"key_code" : "k"
},
"to" : [ {
"shell_command" : "/usr/local/bin/yabai -m window --insert north"
} ],
"conditions" : [ {
"name" : "yabai-insert-mode",
"value" : 1,
"type" : "variable_if"
} ],
"type" : "basic"
}, {
"from" : {
"key_code" : "l"
},
"to" : [ {
"shell_command" : "/usr/local/bin/yabai -m window --insert east"
} ],
"conditions" : [ {
"name" : "yabai-insert-mode",
"value" : 1,
"type" : "variable_if"
} ],
"type" : "basic"
} ]
}, {
"description" : "yabai move mode",
"manipulators" : [ {
"from" : {
"key_code" : "h"
},
"to" : [ {
"shell_command" : "/usr/local/bin/yabai -m window --warp west"
} ],
"conditions" : [ {
"name" : "yabai-move-mode",
"value" : 1,
"type" : "variable_if"
} ],
"type" : "basic"
}, {
"from" : {
"key_code" : "j"
},
"to" : [ {
"shell_command" : "/usr/local/bin/yabai -m window --warp south"
} ],
"conditions" : [ {
"name" : "yabai-move-mode",
"value" : 1,
"type" : "variable_if"
} ],
"type" : "basic"
}, {
"from" : {
"key_code" : "k"
},
"to" : [ {
"shell_command" : "/usr/local/bin/yabai -m window --warp north"
} ],
"conditions" : [ {
"name" : "yabai-move-mode",
"value" : 1,
"type" : "variable_if"
} ],
"type" : "basic"
}, {
"from" : {
"key_code" : "l"
},
"to" : [ {
"shell_command" : "/usr/local/bin/yabai -m window --warp east"
} ],
"conditions" : [ {
"name" : "yabai-move-mode",
"value" : 1,
"type" : "variable_if"
} ],
"type" : "basic"
}, {
"from" : {
"key_code" : "o"
},
"to" : [ {
"shell_command" : "/usr/local/bin/yabai -m window --warp prev"
} ],
"conditions" : [ {
"name" : "yabai-move-mode",
"value" : 1,
"type" : "variable_if"
} ],
"type" : "basic"
}, {
"from" : {
"key_code" : "n"
},
"to" : [ {
"shell_command" : "/usr/local/bin/yabai -m window --warp next"
} ],
"conditions" : [ {
"name" : "yabai-move-mode",
"value" : 1,
"type" : "variable_if"
} ],
"type" : "basic"
}, {
"from" : {
"key_code" : "period"
},
"to" : [ {
"shell_command" : "/usr/local/bin/yabai -m window --display next"
} ],
"conditions" : [ {
"name" : "yabai-move-mode",
"value" : 1,
"type" : "variable_if"
} ],
"type" : "basic"
}, {
"from" : {
"key_code" : "comma"
},
"to" : [ {
"shell_command" : "/usr/local/bin/yabai -m window --display previous"
} ],
"conditions" : [ {
"name" : "yabai-move-mode",
"value" : 1,
"type" : "variable_if"
} ],
"type" : "basic"
}, {
"from" : {
"key_code" : "open_bracket"
},
"to" : [ {
"shell_command" : "/usr/local/bin/yabai -m window --space prev"
} ],
"conditions" : [ {
"name" : "yabai-move-mode",
"value" : 1,
"type" : "variable_if"
} ],
"type" : "basic"
}, {
"from" : {
"key_code" : "close_bracket"
},
"to" : [ {
"shell_command" : "/usr/local/bin/yabai -m window --space next"
} ],
"conditions" : [ {
"name" : "yabai-move-mode",
"value" : 1,
"type" : "variable_if"
} ],
"type" : "basic"
} ]
}, {
"description" : "yabai scale mode",
"manipulators" : [ {
"from" : {
"key_code" : "h"
},
"to" : [ {
"shell_command" : "~/.local/bin/yabai-resize left"
} ],
"conditions" : [ {
"name" : "yabai-scale-mode",
"value" : 1,
"type" : "variable_if"
} ],
"type" : "basic"
}, {
"from" : {
"key_code" : "j"
},
"to" : [ {
"shell_command" : "~/.local/bin/yabai-resize down"
} ],
"conditions" : [ {
"name" : "yabai-scale-mode",
"value" : 1,
"type" : "variable_if"
} ],
"type" : "basic"
}, {
"from" : {
"key_code" : "k"
},
"to" : [ {
"shell_command" : "~/.local/bin/yabai-resize up"
} ],
"conditions" : [ {
"name" : "yabai-scale-mode",
"value" : 1,
"type" : "variable_if"
} ],
"type" : "basic"
}, {
"from" : {
"key_code" : "l"
},
"to" : [ {
"shell_command" : "~/.local/bin/yabai-resize right"
} ],
"conditions" : [ {
"name" : "yabai-scale-mode",
"value" : 1,
"type" : "variable_if"
} ],
"type" : "basic"
} ]
}, {
"description" : "tab mode",
"manipulators" : [ {
"from" : {
"key_code" : "grave_accent_and_tilde"
},
"to" : [ {
"shell_command" : "launchctl kickstart -k \"gui/${UID}/homebrew.mxcl.yabai\""
} ],
"conditions" : [ {
"name" : "tab-mode",
"value" : 1,
"type" : "variable_if"
} ],
"type" : "basic"
}, {
"from" : {
"key_code" : "o"
},
"to" : [ {
"shell_command" : "~/.local/bin/yabai-prev"
} ],
"conditions" : [ {
"name" : "tab-mode",
"value" : 1,
"type" : "variable_if"
} ],
"type" : "basic"
}, {
"from" : {
"key_code" : "n"
},
"to" : [ {
"shell_command" : "~/.local/bin/yabai-next"
} ],
"conditions" : [ {
"name" : "tab-mode",
"value" : 1,
"type" : "variable_if"
} ],
"type" : "basic"
}, {
"from" : {
"key_code" : "h"
},
"to" : [ {
"shell_command" : "/usr/local/bin/yabai -m window --focus west"
} ],
"conditions" : [ {
"name" : "tab-mode",
"value" : 1,
"type" : "variable_if"
} ],
"type" : "basic"
}, {
"from" : {
"key_code" : "j"
},
"to" : [ {
"shell_command" : "/usr/local/bin/yabai -m window --focus south"
} ],
"conditions" : [ {
"name" : "tab-mode",
"value" : 1,
"type" : "variable_if"
} ],
"type" : "basic"
}, {
"from" : {
"key_code" : "k"
},
"to" : [ {
"shell_command" : "/usr/local/bin/yabai -m window --focus north"
} ],
"conditions" : [ {
"name" : "tab-mode",
"value" : 1,
"type" : "variable_if"
} ],
"type" : "basic"
}, {
"from" : {
"key_code" : "l"
},
"to" : [ {
"shell_command" : "/usr/local/bin/yabai -m window --focus east"
} ],
"conditions" : [ {
"name" : "tab-mode",
"value" : 1,
"type" : "variable_if"
} ],
"type" : "basic"
}, {
"from" : {
"key_code" : "a"
},
"to" : [ {
"shell_command" : "/usr/local/bin/yabai -m window --toggle float"
} ],
"conditions" : [ {
"name" : "tab-mode",
"value" : 1,
"type" : "variable_if"
} ],
"type" : "basic"
}, {
"from" : {
"key_code" : "b"
},
"to" : [ {
"shell_command" : "/usr/local/bin/yabai -m window --layout bsp"
} ],
"conditions" : [ {
"name" : "tab-mode",
"value" : 1,
"type" : "variable_if"
} ],
"type" : "basic"
}, {
"from" : {
"key_code" : "m"
},
"to" : [ {
"shell_command" : "/usr/local/bin/yabai -m window --toggle zoom-parent"
} ],
"conditions" : [ {
"name" : "tab-mode",
"value" : 1,
"type" : "variable_if"
} ],
"type" : "basic"
}, {
"from" : {
"key_code" : "p"
},
"to" : [ {
"shell_command" : "/usr/local/bin/yabai -m window --toggle pip"
} ],
"conditions" : [ {
"name" : "tab-mode",
"value" : 1,
"type" : "variable_if"
} ],
"type" : "basic"
}, {
"from" : {
"key_code" : "spacebar"
},
"to" : [ {
"shell_command" : "yabai -m window --toggle zoom-fullscreen"
} ],
"conditions" : [ {
"name" : "tab-mode",
"value" : 1,
"type" : "variable_if"
} ],
"type" : "basic"
}, {
"from" : {
"key_code" : "delete_or_backspace"
},
"to" : [ {
"shell_command" : "/usr/local/bin/yabai -m window --close"
} ],
"conditions" : [ {
"name" : "tab-mode",
"value" : 1,
"type" : "variable_if"
} ],
"type" : "basic"
} ]
}, {
"description" : "spec mode",
"manipulators" : [ {
"from" : {
"key_code" : "y"
},
"to" : [ {
"key_code" : "left_arrow",
"modifiers" : [ "left_command", "left_option" ]
} ],
"conditions" : [ {
"name" : "spec-mode",
"value" : 1,
"type" : "variable_if"
} ],
"type" : "basic"
}, {
"from" : {
"key_code" : "u"
},
"to" : [ {
"key_code" : "down_arrow",
"modifiers" : [ "left_command", "left_option" ]
} ],
"conditions" : [ {
"name" : "spec-mode",
"value" : 1,
"type" : "variable_if"
} ],
"type" : "basic"
}, {
"from" : {
"key_code" : "i"
},
"to" : [ {
"key_code" : "up_arrow",
"modifiers" : [ "left_command", "left_option" ]
} ],
"conditions" : [ {
"name" : "spec-mode",
"value" : 1,
"type" : "variable_if"
} ],
"type" : "basic"
}, {
"from" : {
"key_code" : "o"
},
"to" : [ {
"key_code" : "right_arrow",
"modifiers" : [ "left_command", "left_option" ]
} ],
"conditions" : [ {
"name" : "spec-mode",
"value" : 1,
"type" : "variable_if"
} ],
"type" : "basic"
} ]
} ]
},
"devices" : [ ],
"fn_function_keys" : [ {
"from" : {
"key_code" : "f1"
},
"to" : {
"consumer_key_code" : "display_brightness_decrement"
}
}, {
"from" : {
"key_code" : "f2"
},
"to" : {
"consumer_key_code" : "display_brightness_increment"
}
}, {
"from" : {
"key_code" : "f3"
},
"to" : {
"key_code" : "mission_control"
}
}, {
"from" : {
"key_code" : "f4"
},
"to" : {
"key_code" : "launchpad"
}
}, {
"from" : {
"key_code" : "f5"
},
"to" : {
"key_code" : "illumination_decrement"
}
}, {
"from" : {
"key_code" : "f6"
},
"to" : {
"key_code" : "illumination_increment"
}
}, {
"from" : {
"key_code" : "f7"
},
"to" : {
"consumer_key_code" : "rewind"
}
}, {
"from" : {
"key_code" : "f8"
},
"to" : {
"consumer_key_code" : "play_or_pause"
}
}, {
"from" : {
"key_code" : "f9"
},
"to" : {
"consumer_key_code" : "fastforward"
}
}, {
"from" : {
"key_code" : "f10"
},
"to" : {
"consumer_key_code" : "mute"
}
}, {
"from" : {
"key_code" : "f11"
},
"to" : {
"consumer_key_code" : "volume_decrement"
}
}, {
"from" : {
"key_code" : "f12"
},
"to" : {
"consumer_key_code" : "volume_increment"
}
} ],
"name" : "Default",
"parameters" : {
"delay_milliseconds_before_open_device" : 1000
},
"selected" : true,
"simple_modifications" : [ ],
"virtual_hid_keyboard" : {
"country_code" : 0,
"mouse_key_xy_scale" : 100
}
} ]
}
@dylanjm do you have other modes that can be triggered with s
?
Nope, I posted my entire .edn
file. Not sure what would be stopping it, have you been able to replicate this behavior?
I'm pretty sure it's the order issue.
This works.
{:profiles
{:Default {:default true
:sim 50
:delay 500
:alone 500
:held 500}}
:applications {:vmware ["^com\\.vmware\\.fusion$"]
:emacs ["^org\\.gnu\\.Emacs$"]
:firefox ["^org\\.mozilla\\.firefox$"]}
:layers {:tab-mode {:key :tab
:afterup [{:set ["yabai-move-mode" 0]}
{:set ["yabai-scale-mode" 0]}
{:set ["spec-mode" 0]}]}
:spec-mode {:key :s :condi :tab-mode}
:yabai-insert-mode {:key :i :condi :tab-mode}
:yabai-move-mode {:key :f :condi :tab-mode}
:yabai-scale-mode {:key :c :condi :tab-mode}}
:main [
{:des "caps to ctrl modifier"
:rules [[:##caps_lock :left_control]]}
{:des "left ctrl to right ctrl"
:rules [[:##left_control :right_control]]}
{:des "yabai insert mode"
:rules [:yabai-insert-mode
[:h "say insert h"]]}
{:des "yabai move mode"
:rules [:yabai-move-mode
[:h "say move h"]]}
{:des "yabai scale mode"
:rules [:yabai-scale-mode
[:h "say scale h"]]}
{:des "spec mode"
:rules [:spec-mode
[:h "say spec h"]]}
{:des "tab mode"
:rules [:tab-mode
[:h "say tab h"]]}]}
and this one don't work.
{:profiles
{:Default {:default true
:sim 50
:delay 500
:alone 500
:held 500}}
:applications {:vmware ["^com\\.vmware\\.fusion$"]
:emacs ["^org\\.gnu\\.Emacs$"]
:firefox ["^org\\.mozilla\\.firefox$"]}
:layers {:tab-mode {:key :tab
:afterup [{:set ["yabai-move-mode" 0]}
{:set ["yabai-scale-mode" 0]}
{:set ["spec-mode" 0]}]}
:spec-mode {:key :s :condi :tab-mode}
:yabai-insert-mode {:key :i :condi :tab-mode}
:yabai-move-mode {:key :f :condi :tab-mode}
:yabai-scale-mode {:key :c :condi :tab-mode}}
:main [
{:des "caps to ctrl modifier"
:rules [[:##caps_lock :left_control]]}
{:des "left ctrl to right ctrl"
:rules [[:##left_control :right_control]]}
{:des "yabai insert mode"
:rules [:yabai-insert-mode
[:h "say insert h"]]}
{:des "yabai move mode"
:rules [:yabai-move-mode
[:h "say move h"]]}
{:des "yabai scale mode"
:rules [:yabai-scale-mode
[:h "say scale h"]]}
{:des "tab mode"
:rules [:tab-mode
[:h "say tab h"]]}
{:des "spec mode"
:rules [:spec-mode
[:h "say spec h"]]}]}
Any updates?
hmm interesting it's working, I must've misspoke. Thanks.
Description might sound a little weird, but I have a defined
tab-mode
,yabai-move-mode
yabai-scale-mode
that all make use of the same keybindingsh,j,k,l,o,n
but map those keys to shell-commands. These modes work fine.But then, I have a
spec-mode
which mapsh,j,k,l
to a mod-key entry, but karabiner refuses to see this as input after runninggoku
. If I change the keys to something likey,u,i,o
then it works.My guess has something to do with
tab-mode
already usingh,j,k,l
but it works fine for other modes. So I'm not sure why it would prevent me from mapping to a mod-key entry. Here is mykarabiner.edn
for reference (heavily inspired by your .edn file):