Karabiner icon indicating copy to clipboard operation
Karabiner copied to clipboard

Swapping FN to OPTION_R

Open flashios09 opened this issue 9 years ago • 8 comments

hi, @tekezo thanks for this awesome Mac App ;) i have Logitech K750 PC Keyboard and i want to change the FN key to OPTION_R(like in the standard apple keyboard), i tried this but doesn't work

<autogen>
                __KeyOverlaidModifier__
                KeyCode::FN,
                KeyCode::OPTION_R
</autogen>

flashios09 avatar Nov 24 '16 19:11 flashios09

I'm having a similar issue remapping COMMAND_L to OPTION_L:

<autogen>
    __KeyToKey__
    KeyCode::COMMAND_L,
    KeyCode::OPTION_L
</autogen>

With that enabled, this is what I get in EventViewer:

eventType:FlagsChanged    code:0x3a       name:Option_L        flags:Opt Cmd                            misc:KeyCode::OPTION_L	 characters:    
eventType:FlagsChanged    code:0x3a       name:Option_L        flags:                                   misc:KeyCode::OPTION_L	 characters:    

And applications are receiving ⌥⌘ instead of just ⌥

jd0yle avatar Nov 28 '16 18:11 jd0yle

@flashios09 Use __KeyToKey__ instead of __KeyOverlaidModifier__ Also can you check in "Event Viewer" see what keycode ."FN" produce

@jd0yle What keyboard are you using

dunkarooftop avatar Nov 30 '16 09:11 dunkarooftop

@dunkarooftop thanks for you response this is my private.xml file

<?xml version="1.0"?>
<root>
    <item>
        <name>My Logitech K750 Keyboard</name>

        <item>
            <name>Change f1...f12 to brightness control, volume control, etc.</name>
            <appendix>(You can use standard function keys by fn-f1...fn-f12.)</appendix>
            <appendix></appendix>
            <appendix>* f1-f2: Brightness control.</appendix>
            <appendix>* f3: Mission Control.</appendix>
            <appendix>* f4: Launchpad.</appendix>
            <appendix>* f7-f9: Music control.</appendix>
            <appendix>* f10-f12: Volume control.</appendix>
            <identifier>remap.logitech_keyboard_function_standard</identifier>

            <modifier_not>ModifierFlag::FN</modifier_not>

            <!-- We use KeyCode::VK_IOHIDPOSTEVENT in order to control both internal and external display brightness. -->
            <autogen>__KeyToKey__ KeyCode::F1, KeyCode::VK_IOHIDPOSTEVENT_NX_KEYTYPE_BRIGHTNESS_DOWN</autogen>
            <autogen>__KeyToKey__ KeyCode::F2, KeyCode::VK_IOHIDPOSTEVENT_NX_KEYTYPE_BRIGHTNESS_UP</autogen>

            <autogen>__KeyToKey__ KeyCode::F3, KeyCode::MISSION_CONTROL</autogen>
            <autogen>__KeyToKey__ KeyCode::F4, KeyCode::LAUNCHPAD</autogen>

            <autogen>__KeyToKey__ KeyCode::F6, ConsumerKeyCode::MUSIC_PREV</autogen>
            <autogen>__KeyToKey__ KeyCode::F7, ConsumerKeyCode::MUSIC_PLAY</autogen>
            <autogen>__KeyToKey__ KeyCode::F8, ConsumerKeyCode::MUSIC_NEXT</autogen>

            <autogen>__KeyToKey__ KeyCode::F9, ConsumerKeyCode::VOLUME_MUTE</autogen>
            <autogen>__KeyToKey__ KeyCode::F10, ConsumerKeyCode::VOLUME_DOWN</autogen>
            <autogen>__KeyToKey__ KeyCode::F11, ConsumerKeyCode::VOLUME_UP</autogen>
        </item>
    </item>
    <item>
        <name>Swap FN to OPTION_R</name>
        <identifier>remap.fn_to_option_r</identifier>
        <autogen>
            __KeyToKey__
            KeyCode::FN,
            KeyCode::OPTION_R
        </autogen>
    </item>
</root>

i used __KeyToKey__ like you said but this doesn't work too(i selected Swap FN to OPTION_R and reload the xml), when i click on the FN key on my keyboard nothing happened, that's a screenshot from the event viewer when i do FN+)

image

flashios09 avatar Nov 30 '16 10:11 flashios09

A Razer Blackwidow 2014 with the default keybindings in Razer's config tool (Synapse) and default modifier keys in the OSX preferences.

I just now tried it with the Apple Internal Keyboard on my early 2012 Macbook Pro, and it seems to work fine there, so now I'm really confused.

jd0yle avatar Nov 30 '16 17:11 jd0yle

@flashios09

maybe your "FN" is sending some funny event, try this turn the mod off. go to Karabiner setting last page "misc and uninstall" click on "toggle debug mode" then "launch console mode"

in console mode look at the very bottom which show the latest event, press your "COMMAND_L" key, this will help us find out what key value it's actually sending.

you will see something like below

2016-11-30 6:22:31.000 PM kernel[0]: org.pqrs.Karabiner --Debug-- KeyboardEventCallback [ caught]: eventType 11, flags 0x80000000, key 0x0001, kbdType  40, repeat = 0

what we want to know is the key 0x00?? value. Remove the 2 "0" so you get the rawvalue to use in Karabiner. in this case key0x00?? become key0x??

turn off debug mode

then back to your private.xml edit your mode with RAWVALUE as in your need will be

<autogen>
  __KeyToKey__ 
    KeyCode::RawValue::0x??,
    KeyCode::RawValue::0x3a
 </autogen>

replace "??" with what you see with your "FN" send in debug mode RawValue::0x3a is for "OPTOIN_L"

doc here if you want to find out more https://pqrs.org/osx/karabiner/xml.html.en#rawvalue

all the default key value for Karabiner https://github.com/tekezo/Karabiner/blob/master/src/bridge/generator/keycode/data/KeyCode.data

hope it work out

dunkarooftop avatar Dec 01 '16 02:12 dunkarooftop

@jd0yle try the debug mode from above and see if raw value tweak works for you too

I am not sure if it will help, but worth a try

dunkarooftop avatar Dec 01 '16 02:12 dunkarooftop

Hi, I tried the stuff you wrote before ... but the FN key from my Logitech K810 seems to not send any event at all :( could this be?

01.05.17 14:10:42,000 kernel[0]: org.pqrs.Karabiner --Debug-- KeyboardEventCallback [ caught]: eventType 12, flags 0x80040001, key 0x003b, kbdType  41, repeat = 0
01.05.17 14:10:42,000 kernel[0]: org.pqrs.Karabiner --Debug-- KeyboardEventCallback [sending]: eventType 12, flags 0x00040001, key 0x003b, kbdType  41, repeat = 0
01.05.17 14:10:42,000 kernel[0]: org.pqrs.Karabiner --Debug-- KeyboardEventCallback [ caught]: eventType 12, flags 0x80000000, key 0x003b, kbdType  41, repeat = 0
01.05.17 14:10:42,000 kernel[0]: org.pqrs.Karabiner --Debug-- KeyboardEventCallback [sending]: eventType 12, flags 0x00000000, key 0x003b, kbdType  41, repeat = 0
01.05.17 14:10:51,000 kernel[0]: org.pqrs.Karabiner --Debug-- KeyboardEventCallback [ caught]: eventType 12, flags 0x80080020, key 0x003a, kbdType  41, repeat = 0
01.05.17 14:10:51,000 kernel[0]: org.pqrs.Karabiner --Debug-- KeyboardEventCallback [sending]: eventType 12, flags 0x00080020, key 0x003a, kbdType  41, repeat = 0
01.05.17 14:10:52,000 kernel[0]: org.pqrs.Karabiner --Debug-- KeyboardEventCallback [ caught]: eventType 12, flags 0x80000000, key 0x003a, kbdType  41, repeat = 0
01.05.17 14:10:52,000 kernel[0]: org.pqrs.Karabiner --Debug-- KeyboardEventCallback [sending]: eventType 12, flags 0x00000000, key 0x003a, kbdType  41, repeat = 0
01.05.17 14:10:53,000 kernel[0]: org.pqrs.Karabiner --Debug-- KeyboardEventCallback [ caught]: eventType 12, flags 0x80100008, key 0x0037, kbdType  41, repeat = 0
01.05.17 14:10:53,000 kernel[0]: org.pqrs.Karabiner --Debug-- KeyboardEventCallback [sending]: eventType 12, flags 0x00100008, key 0x0037, kbdType  41, repeat = 0
01.05.17 14:10:53,000 kernel[0]: org.pqrs.Karabiner --Debug-- KeyboardEventCallback [ caught]: eventType 12, flags 0x80000000, key 0x0037, kbdType  41, repeat = 0
01.05.17 14:10:53,000 kernel[0]: org.pqrs.Karabiner --Debug-- KeyboardEventCallback [sending]: eventType 12, flags 0x00000000, key 0x0037, kbdType  41, repeat = 0

0x003b is control_L 0x003a is alt_l 0x0037 is win_l

but hitting the FN doesn't log anything.

pkyeck avatar May 01 '17 12:05 pkyeck

I think FN on mac is a very special key, sadly you can't modify it.

dunkarooftop avatar May 01 '17 18:05 dunkarooftop