29

Is there a way to bind alt shift to switch keyboard layouts on OS X?

11 Answers 11

26

By default in OS X, spinning through keyboard layouts is defined as ctrl+space. This mapping is turned off in favor of the trigger for Spotlight.

To modify this default mapping, you need to go to System Preferences->Hardware->Keyboard & Mouse->Keyboard Shortcuts. There you will find a list item for Input Menu. Select the checkbox and it will become enabled. From there, double click on the predefined shortcut on the right side of the list. Once the existing shortcut is selected and editable, you can type your preferred shortcut sequence.

Unfortunately, alt+shift by themselves are not allowed as a shortcut. You need to have a non-control key in the mix. The closest you can come is to use alt+z (using 'z', which is next to shift on the left side of the keyboard). You also have the option of setting the shortcut for the reverse order of the spin. alt+shift+z is a natural option for this.

5
  • I enable it and hit restore default. Mac resolved the conflict. Since I'm new to mac, I probably will not be using trigger for Spotlight. I'm not sure what that means. +1 for an explanation.
    – Moshe
    Jan 6, 2010 at 5:09
  • 2
    You really should learn what spotlight is and does, and you will want a trigger for it... but you can move that to command-space if you want. Jan 6, 2010 at 7:43
  • I understand now. I don't use spotlight much yet, although if I buy a Mac I probably will . I'm on a loaner now.
    – Moshe
    Jan 7, 2010 at 8:34
  • Note that alt + shift + z is a popular keyboard shortcut in use by many applications for undoing an undo (alt + z). Therefore, it may be a better idea to find another shortcut. How about cmd + e?
    – Elad Nava
    Jan 1, 2016 at 14:54
  • In the MacOS 10 it is System Preferences->Keyboard->Shortcut->Input Sources
    – divonas
    Jan 15, 2019 at 7:41
17

Use Karabiner (originally KeyRemap4MacBook). Search for option shift pc. Ticking the first checkbox should let you remap to the PC behavior.

setting pc style switch language in Karabiner alt+shift

2
  • 1
    However, see the note: "Except in ... Emacs, Terminal, ...".
    – nickie
    Feb 15, 2015 at 1:14
  • Installed Karabiner Element 10.22.0 (via brew cask install karabiner) on my Mac High Sierra 10.13.3 and found it doesn't work.
    – onelaview
    Mar 24, 2018 at 9:49
11

The Karabiner keyboard customizer for OS X can map alt-shift (or ctrl-shift) to switch languages

1
  • What System Preferences add-on? System Preferences on my Mac don't accept alt+shift. Is there some additional "add-on" that enables it?
    – yair
    Mar 2, 2014 at 13:17
8

I found that the little utility MLSwitcher[2] will allow you to do exactly that and works great under macOS 10.13 High Sierra. Available for free on the App Store.

More info here: http://bluezbox.com/mlswitcher2.html

1
  • 1
    I found MLSwitcher to be much simpler than Karabiner, which in recent versions tend to have a non-intuitive, weird interface.
    – Farshid
    Sep 12, 2019 at 13:59
3

The Karabiner mentioned by @wayfarer did the trick for me. Here's the rule to map Ctrl-Shift to Ctrl-Space:

{
    "description": "Swithch input language by ctrl-shift",
    "manipulators": [
        {
            "from": {
                "key_code": "left_shift",
                "modifiers": {
                    "mandatory": [
                        "left_control"
                    ]
                }
            },
            "to": [
                {
                    "key_code": "spacebar",
                    "modifiers": [
                        "left_control"
                    ]
                } 
            ],
            "type": "basic"
        },
       {
            "from": {
                "key_code": "right_shift",
                "modifiers": {
                    "mandatory": [
                        "right_control"
                    ]
                }
            },
            "to": [
                {
                    "key_code": "spacebar",
                    "modifiers": [
                        "left_control"
                    ]
                } 
            ],
            "type": "basic"
        }
    ]
}
3
  • We're glad you were able to find a solution to a problem you were facing here. However, this section is reserved for answers to the question that was asked above. Simply using the Upvote button is sufficient thanks here on SuperUser. Jan 10, 2019 at 22:01
  • rook, thanks for the code! It works perfectly! Also here is the manual - how to add your own complex rule to Karabiner: pqrs.org/osx/karabiner/json.html Here is short instruction also: github.com/pqrs-org/Karabiner-Elements/issues/1225
    – Rib47
    Nov 27, 2019 at 12:57
  • Just replace "_control" to "_alt" in "from" parts of this script, and you will get Alt+Shift (for Mac its correct name is Option+Shift) hotkey to switch input language.
    – Rib47
    Nov 27, 2019 at 13:22
3

I did it with BetterTouchTool, using the "Key Sequences" option,
and mapping Alt+Shift to Cmd+Space (which is my language change key combo).

Screenshot showing BetterTouchTool mapping of Alt+Shift to Cmd+Space

2

Also if you are looking for Cmd+Shift, Punto Switcher (after disabling language autoswitching) can bind language toggle to Cmd+Shift.

2
  • 1
    Please see this link about how to recommend software in an answer: meta.superuser.com/questions/5329/…. Also, this doesn't answer the question that was asked.
    – fixer1234
    Feb 25, 2015 at 1:36
  • @fixer1234 Punto Switcher does, however, allow switching with Opt+Shift, which is what's been asked. I'm not recommending this software, as I don't like it myself, but with Karabiner not working with Sierra, it's the only alternative.
    – maksimov
    May 14, 2017 at 16:09
1

i changed mine to -\ which is almost alt-shift, just shifted one key to the right (works with my macbookpro international keyboard, the us keyboard has longer left shift and the \ key is above the key)

1

In some locales command-space and option-command-space change input sources by default. You can enable or change the keyboard shortcuts from System Preferences:

The shortcut recorders don't allow entering shortcuts like option-shift though. If you really want to use option-shift, you can map it to a key combination like option-command-space with KeyRemap4MacBook. This is triggered when you release shift:

<autogen>__KeyOverlaidModifier__ KeyCode::SHIFT_L, ModifierFlag::OPTION_L | ModifierFlag::SHIFT_L | ModifierFlag::NONE, KeyCode::SHIFT_L, ModifierFlag::OPTION_L, KeyCode::SPACE, ModifierFlag::OPTION_L | ModifierFlag::COMMAND_L</autogen>
<autogen>__KeyOverlaidModifier__ KeyCode::SHIFT_R, ModifierFlag::OPTION_R | ModifierFlag::SHIFT_R | ModifierFlag::NONE, KeyCode::SHIFT_R, ModifierFlag::OPTION_R, KeyCode::SPACE, ModifierFlag::OPTION_L | ModifierFlag::COMMAND_L</autogen>

This is triggered when you press shift, but it requires pressing shift before option for shortcuts like option-shift-[:

<autogen>__KeyToKey__ KeyCode::SHIFT_L | ModifierFlag::SHIFT_L | ModifierFlag::OPTION_L | ModifierFlag::NONE, KeyCode::SPACE, ModifierFlag::OPTION_L | ModifierFlag::COMMAND_L</autogen>
<autogen>__KeyToKey__ KeyCode::SHIFT_R | ModifierFlag::SHIFT_R | ModifierFlag::OPTION_R | ModifierFlag::NONE, KeyCode::SPACE, ModifierFlag::OPTION_L | ModifierFlag::COMMAND_L</autogen>

This requires pressing option and shift simultaneously:

<autogen>__SimultaneousKeyPresses__ KeyCode::OPTION_L, KeyCode::SHIFT_L, KeyCode::SPACE, ModifierFlag::OPTION_L | ModifierFlag::COMMAND_L</autogen>
<autogen>__SimultaneousKeyPresses__ KeyCode::OPTION_R, KeyCode::SHIFT_R, KeyCode::SPACE, ModifierFlag::OPTION_L | ModifierFlag::COMMAND_L</autogen>
1

I also faced with this issue, so created a small tray application that remap default shortcut to Ctrl + Shift or CMD + Shift:

screenshot

Here is a link to the GitHub LayoutSwitcher

0

Punto Switcher solved my problem with AltShift switching and it's a free app.
LayoutSwitcher - doesn't work with my M1 mac.
BetterTouchTool is not free.

1
  • Welcome to Super User! Before answering an old question having an accepted answer (look for green ✓) as well as other answers ensure your answer adds something new or is otherwise helpful in relation to them. Here is a guide on How to Answer. There is also a site tour and a help center. Mar 17, 2023 at 10:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .