Both Shifts Pressed as a Keybinding

Joined
Jun 28, 2011
Messages
3
Reaction score
0
Points
1
Hello, I'm considering moving to Mac OS X from Linux. I use two separate keyboard layouts. I switch between them by pressing both my Shift keys. It is my understanding that replicating this behaviour is not easily done on a Mac. My question is, can it be done at all?

Coming from Linux, I'm not afraid of modifying config files if necessary.
 
Joined
Sep 30, 2007
Messages
9,962
Reaction score
1,235
Points
113
Location
The Republic of Neptune
Your Mac's Specs
2019 iMac 27"; 2020 M1 MacBook Air; macOS up-to-date... always.
Hello, I'm considering moving to Mac OS X from Linux. I use two separate keyboard layouts. I switch between them by pressing both my Shift keys. It is my understanding that replicating this behaviour is not easily done on a Mac. My question is, can it be done at all?

Coming from Linux, I'm not afraid of modifying config files if necessary.

If you mean like changing the language, yes it's very easy. You can do it from a drop down menu in the menubar listing the languages you pre-selected in the preferences, and you can assign a keyboard shortcut of your choosing to go to the "Next" and the "Previous" input source. Piece of cake.
 
OP
A
Joined
Jun 28, 2011
Messages
3
Reaction score
0
Points
1
That's not what I was asking.

I want the languages switch specifically when both Shift keys are pressed, both left and right Shift.
 
Joined
Sep 30, 2007
Messages
9,962
Reaction score
1,235
Points
113
Location
The Republic of Neptune
Your Mac's Specs
2019 iMac 27"; 2020 M1 MacBook Air; macOS up-to-date... always.
That's not what I was asking.

I want the languages switch specifically when both Shift keys are pressed, both left and right Shift.

No. It works exactly as I described. If you only have 2 languages, then the key combo that you pre-set will go from one to the other. The pop-up menu is merely a convenience if you have more than two and need to keep selecting down the list. It's only there briefly while pressing the keys and goes away on its own. And no, pressing both shift keys isn't an option. System-wide shortcuts like these typically require a combo of the CONTROL, OPTION, and/or COMMAND key with a letter or pretty much any other character really. The only difference as far as you would be concerned is adjusting to a different keyboard shortcut.

EDIT: Actually if you do it fast enough, you won't even see the on-screen display. And in addition to characters with the modifier keys, you can use the spacebar. For ex: OPTION-SPACEBAR works.

Additional edit: Just to be clear… you can stick to using just one keyboard shortcut, either PREVIOUS or NEXT, since with just two languages you'd effectively have a toggle. Using NEXT for example… if you had several languages and were at the bottom of the list already, hitting NEXT would simply go back to the top.
 
Joined
Dec 9, 2010
Messages
844
Reaction score
49
Points
28
Location
Virginia
Your Mac's Specs
Currently 13" Late 2010 MBA, 4GB/128GB; Early 2011 13" MBP, dual core i7 2.7ghz, 4gb ram, 500gb hd
I think the question is less about changing language layouts and more along the lines of "Does the Mac recognize the difference between the left and right shift, or are they treated the same?" As I understand it, pressing either left or right shift would just register a "shift" command, and I don't think the system differentiates between them.
 
Joined
Sep 30, 2007
Messages
9,962
Reaction score
1,235
Points
113
Location
The Republic of Neptune
Your Mac's Specs
2019 iMac 27"; 2020 M1 MacBook Air; macOS up-to-date... always.
I think the question is less about changing language layouts and more along the lines of "Does the Mac recognize the difference between the left and right shift, or are they treated the same?"

You may be right about that. I took it as "can you do this with a simple shortcut". If he's going to be so rigid as to want to do it that way and only that way, then he may as well stick with Linux. Changing from any OS to any other OS requires adjustments to one's habits and expectations, and if something like this is going to be a hangup, then he'll find fault with every little difference.
 
Joined
Sep 30, 2007
Messages
9,962
Reaction score
1,235
Points
113
Location
The Republic of Neptune
Your Mac's Specs
2019 iMac 27"; 2020 M1 MacBook Air; macOS up-to-date... always.
Heh. I'm playing with this some more… any arrow key on its own can be set to do this, or with a modifier like SHIFT-ARROW.
 
OP
A
Joined
Jun 28, 2011
Messages
3
Reaction score
0
Points
1
Being unable to use a Shift-Shift shortcut would hardly be a reason for me to change my attitude towards Macs. It's just that I find it one of the most pleasant shortcuts to use while touch typing and if I could retain it, that would be, well, nice.

I saw on a different forum that the two Shift keys generate unique keypress signals. I might investigate whether defining the shortcut is possible when I have my MacBook.
 
Joined
Sep 30, 2007
Messages
9,962
Reaction score
1,235
Points
113
Location
The Republic of Neptune
Your Mac's Specs
2019 iMac 27"; 2020 M1 MacBook Air; macOS up-to-date... always.
Being unable to use a Shift-Shift shortcut would hardly be a reason for me to change my attitude towards Macs. It's just that I find it one of the most pleasant shortcuts to use while touch typing and if I could retain it, that would be, well, nice.

Agreed… it would be nice. We do periodically get people through here who are highly rigid with their routines and moan when OS X doesn't work exactly the same way they are used to. OS X is far more flexible than most people realize, but there are limits.

I saw on a different forum that the two Shift keys generate unique keypress signals. I might investigate whether defining the shortcut is possible when I have my MacBook.

I'm continuing to dig into this, and I'll just go ahead and list the 2 files that should have the relevant strings. All are found in ~/Library/Preferences:

  • com.apple.universalaccess.plist
  • com.apple.symbolichotkeys.plist

Those two files are preference files, and both get modified when I use System Preferences to modify the keyboard shortcut for switching inputs. The string needed should be in one or the other, though I am having difficulty find the exact one.

EDIT: Bleah… i got sloppy. Nevermind the .conf file mentioned beforehand. That belonged to a DOS emulator.

EDIT 2: Ok, the exact string is in com.apple.symbolichotkeys.plist and the Property Key is 60. With "Select the previous input source" set to SHIFT-COMMAND-L, the parameters for fields 0, 1, and 2, are 108, 37, and 1179648. Fields 0 and 1 appear to both belong to the L because they both change if I use a different letter (107 and 40 for K). The 3rd parameter changes with each combination of the modifier keys I try. Anywho, that is as far as I can take it. If you can take it further when you get your MacBook, please do report back.
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top