Karabiner: Can I map FN + Left Shift to act as some combination when pressed together?

Created on 15 Mar 2016  路  13Comments  路  Source: tekezo/Karabiner

I am trying to make it work right now and this is what I have so far :

karabiner1

This is wrong though as I believe that SHIFT_L is a ModifierFlag and not a KeyCode but then I am also not sure and I think you cannot have two ModifierFlag together without some KeyCode in there too.

I don't really know what I should do from here as I really want to make that combination work + if this works, this can open up the possibility to map other Modifier keys together like Right Command and left Opt key.

I hope what I wrote is understandable and this can be done with Karabiner as it really will be quite nice, I don't get much use of the fn key right now and I want to change that.

Thank you for any help.

Most helpful comment

How about this?

    <autogen>
      __KeyOverlaidModifier__
      KeyCode::SHIFT_L, ModifierFlag::FN,
      KeyCode::SHIFT_L, ModifierFlag::FN,
      KeyCode::X, ModifierFlag::CONTROL_L, ModifierFlag::OPTION_L, ModifierFlag::COMMAND_L, ModifierFlag::SHIFT_L
    </autogen>

All 13 comments

Do you want this autogen?

    <autogen>
      __KeyToKey__
      KeyCode::SHIFT_L, ModifierFlag::FN,
      KeyCode::CONTROL_L, ModifierFlag::OPTION_L | ModifierFlag::COMMAND_L | ModifierFlag::SHIFT_L,
    </autogen>

Yes, this is exactly what I want. However it seems that the normal FN + Shift + {some other key}, don't work now. It treats that FN + Shift as that combination. I want it so that it makes that combination of keys only when FN + Shift is pressed alone and that is it, other times it will act as normal modifier keys.

This is quite close though.

How about this?

    <autogen>
      __KeyOverlaidModifier__
      KeyCode::SHIFT_L, ModifierFlag::FN,
      KeyCode::SHIFT_L, ModifierFlag::FN,
      KeyCode::X, ModifierFlag::CONTROL_L, ModifierFlag::OPTION_L, ModifierFlag::COMMAND_L, ModifierFlag::SHIFT_L
    </autogen>

Yess, thank you so much.

I see what you did there too so I am confident I can use variations of this autogen for some other cool bindings I was thinking of.

hey tekezo,

I want to use fn key as all four key modifier when pressed in combination and fn when pressed alone. This works great but is there a way I can also use the above mentioned autogen with it where it will also work and not interfere with my big four modifier keys autogen?

Is there some way I can make it work? Here is what I have made, but that does not work and I don't really know how to make an exception for it.

4

I think changing the physical left shift key to X key is simplest way.

The general way is using own modifier (MY_FN) to determine whether the physical fn key is pressed.

    <modifierdef>MY_FN</modifierdef>

    <autogen>
      __KeyOverlaidModifier__
      KeyCode::SHIFT_L, ModifierFlag::CONTROL_L, ModifierFlag::OPTION_L, ModifierFlag::COMMAND_L | ModifierFlag::MY_FN,
      KeyCode::SHIFT_L, ModifierFlag::CONTROL_L, ModifierFlag::OPTION_L, ModifierFlag::COMMAND_L | ModifierFlag::MY_FN,
      KeyCode::X, ModifierFlag::CONTROL_L, ModifierFlag::OPTION_L, ModifierFlag::COMMAND_L, ModifierFlag::SHIFT_L
    </autogen>

    <autogen>
      __KeyToKey__
      KeyCode::FN,
      KeyCode::COMMAND_L, ModifierFlag::CONTROL_L | ModifierFlag::OPTION_L, ModifierFlag::SHIFT_L | ModifierFlag::MY_FN,
    </autogen>

I am not sure I fully understand what you did there with <modifierdef>

Also is is <modifierdef> a global thing or should be declared in-between <item> and </item>.

I just copied what you wrote there but that does not work. FN key works as a modifier of 4 but Shift + FN does not.

5

Do you want to use fn+shift as fn+shift (not 4 modifers)?
If so, modify __KeyOverlaidModifier__ like this.

    <modifierdef>MY_FN</modifierdef>

    <autogen>
      __KeyOverlaidModifier__
      KeyCode::SHIFT_L, ModifierFlag::CONTROL_L, ModifierFlag::OPTION_L, ModifierFlag::COMMAND_L | ModifierFlag::MY_FN,
      KeyCode::SHIFT_L, ModifierFlag::FN | ModifierFlag::MY_FN,
      KeyCode::X, ModifierFlag::CONTROL_L, ModifierFlag::OPTION_L, ModifierFlag::COMMAND_L, ModifierFlag::SHIFT_L
    </autogen>

    <autogen>
      __KeyToKey__
      KeyCode::FN,
      KeyCode::COMMAND_L, ModifierFlag::CONTROL_L | ModifierFlag::OPTION_L, ModifierFlag::SHIFT_L | ModifierFlag::MY_FN,
    </autogen>

Wow, that worked. That's exactly what I wanted. I am still not really sure what role <modifierdef> plays there but that worked. Will try to look at it again and try and understand everything.

Thank you a lot for your help. :)

If you allow to change the physical command-control-option-shift to fn-shift, you do not need to use MY_FN.
It's used to distinglish the physical command-control-option-shift and the physical fn-shift.

  <item>
    <name>Fn Shift to combination</name>
    <identifier>private.fn_shift_to_combination</identifier>

    <autogen>
      __KeyOverlaidModifier__
      KeyCode::SHIFT_L, ModifierFlag::CONTROL_L, ModifierFlag::OPTION_L, ModifierFlag::COMMAND_L,
      KeyCode::SHIFT_L, ModifierFlag::FN,
      KeyCode::X, ModifierFlag::CONTROL_L, ModifierFlag::OPTION_L, ModifierFlag::COMMAND_L, ModifierFlag::SHIFT_L
    </autogen>

    <autogen>
      __KeyToKey__
      KeyCode::FN,
      KeyCode::COMMAND_L, ModifierFlag::CONTROL_L | ModifierFlag::OPTION_L, ModifierFlag::SHIFT_L,
    </autogen>
  </item>

I apologise for asking for your help again but I've been trying to do this for quite some time yesterday and am bit confused with how to map something to an actual physical delete key.

I have this autogen that I use very often now :

<item>
<name>Right Shift to Command and Shift and Delete when alone</name>
<identifier>private.right_shift_to_command_and_shift</identifier>
<autogen>
--KeyOverlaidModifier--
KeyCode::SHIFT_R,
KeyCode::SHIFT_L,
ModifierFlag::COMMAND_L,
KeyCode::DELETE
</autogen>
</item>

It's pretty straightforward, as it makes right shift act as shift + command and delete key when pressed alone. I also have my right option key binded to left control key with one of app's given autogens :

2016-03-20 at 15 12

I then use my right opt key to open various applications, I binded it with bettertouchtool :

2016-03-19 at 12 40

The thing is though that now that I have both shift and delete key as 'Delete' key i cannot bind two unique things to both my actual physical delete key and my binded shift key as they are literally the same key.

I was thinking a lot yesterday and now how can I make a binding of physical 'OPTION_R' and physical 'DELETE' key to open a specific application I want, in my case I want OPTION_R + 'top DELETE' to open Mindnode and 'OPTION_R' + 'Right Shift' to open Sublime Text.

I read through the documentation and this is what I came up with so far :

<item>
<name>right option key + delete to MindNode</name>
<identifier>private.right_opt_plus_delete_to_mindnode</identifier>
<autogen>
__KeyToKey__
KeyCode::OPTION_R, ModifierFlag::DELETE,
KeyCode::VK_OPEN_URL_APP_MindNode,
</autogen>
</item>

<item>
<name>right option key + right shift to Sublime Text</name>
<identifier>private.right_opt_plus_shift_to_sublime</identifier>
<autogen>
__KeyToKey__
KeyCode::OPTION_R, ModifierFlag::SHIFT_R,
KeyCode::VK_OPEN_URL_APP_Sublime Text,
</autogen>
</item>

and my KeyCode::VK is right :

<vkopenurldef>
<name>KeyCode::VK_OPEN_URL_APP_Sublime Text</name>
<url type="file">/Applications/Sublime Text.app</url>
</vkopenurldef>

<vkopenurldef>
<name>KeyCode::VK_OPEN_URL_APP_MindNode</name>
<url type="file">/Applications/MindNode.app</url>
</vkopenurldef>

But that doesn't work and if I decide to change DELETE to KEYCODE instead of MODIFERKEY it works for that specific combination but messes up every other keybinding I had with my right option key. Also before actually switching to the app, it manages to delete some characters, if I was to change from the text editor. :(

I really wish I could make this work, reading through karabiner documentation is really great and its extensive but I couldn't make it work.

Essentially all I want is for my right option key + physical delete key to open one app and physical option key + right shift key to open another app without interfering with anything else. I hope I can make this work.

To open app by the physical option + delete key,

    <autogen>
      __KeyToKey__
      KeyCode::DELETE, ModifierFlag::CONTROL_L,
      KeyCode::VK_OPEN_URL_APP_...,
    </autogen>

    <!-- right option + right shift -->
    <autogen>
      __KeyToKey__
      KeyCode::SHIFT_R, ModifierFlag::CONTROL_L,
      KeyCode::VK_OPEN_URL_APP_...,
    </autogen>

You have to put these autogen before private.right_shift_to_command_and_shif.
https://pqrs.org/osx/karabiner/xml.html.en#order

Note:
Please use fenced code blocks to describe XML in order to keep text form.
https://help.github.com/articles/creating-and-highlighting-code-blocks/

Thank you a lot. This worked.

I can see how I can bind things now with Karabiner. It's pretty powerful.

I changed the screenshots to 'code blocks' so it should be good.

I shared my XML on git if you want to take a look :)

https://github.com/nikitavoloboev/os-x-workspace/blob/master/karabiner/private.xml

Thank you a lot for your help.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

joecridge picture joecridge  路  8Comments

jeffmikels picture jeffmikels  路  32Comments

tekezo picture tekezo  路  22Comments

franciscolourenco picture franciscolourenco  路  15Comments

CedricGatay picture CedricGatay  路  241Comments