Zend certified PHP/Magento developer

How can I find the default key bindings dict on a Mac and/or Google Chrome? [closed]

Background on keyboards

I understand that inside a keyboard there is a microprocessor. The keys are switch contacts arranged in an X-Y matrix, and the processor constantly scans this matrix, maintaining a map of which keys are closed and which are open.

When it senses a new key down it sends a serial code to the PCH where it’s processed by the I/O controller. For most keys it’s a single byte, but for the function keys and some others it’s a 2 byte code. When it senses a key released that was down previously it sends the same code, but with an additional 0xF0 byte.

These codes do not correspond to letters yet but to the aforementioned X-Y key positions. They are then looked up in a table to see which characters correspond to what key positions. The I/O controller then writes the ASCII code for each new ‘down’ key into a memory buffer where it can be retrieved by an application.

Introduction

I’ve been on a quest to make my key bindings behave the same across all applications that I interact with on a daily basis. And, as a future idea, I’ve been thinking about expanding this across operating systems, where I’d use the same positional keys. So for instance if I use to cycle Chrome/terminal/IDE tabs on Mac with command-option-left arrow, on Windows I’d have alt-winkey-left arrow. The idea behind this is evidently to have a consistent behaviour across all apps and not to think about/learn different app-specific shortcuts. This increases efficiency and saves time.

Current research

I’m currently using a MacBook pro as a working laptop and I’m aware of most of the ways to override keyboard shortcuts be it at an OS level (via System Preferences) or at an application level (via their key map).

Without duplicating what was already said here, here or here, I’ll go right to the question.

Question 1


Firstly, I’m curious about where can I find the detailed list of all the key bindings that come up default at the OS level on a Mac, but this question is also valid for Windows or Linux as I don’t necessarily want this question to be OS specific (but I’m mainly curious about Mac since it’s my active working laptop at the moment).

I know one can override them via a custom mapping created via a KeyBinding.dict placed at ~/Library/KeyBindings/DefaultKeyBinding.dict, but this file doesn’t exist by default so are they exposed anywhere or is there a developer documentation published by Apple with the full list of all the key bindings at the OS level ? And by full list I mean everything (Navigation, Document processing, etc.). Unfortunately, I couldn’t find it online so any point in the right direction would be appreciated.

Regarding the KeyBinding.dict approach, I’m guessing the OS checks whether that file exists and if it does it checks any key bindings in it so it can override any defaults that are already set. This doesn’t work on all apps tho, as some apps do override these settings with their own.

Question 2


Secondly, this is somewhat similar to the 1st question but it’s specifically for Google Chrome. I know Chrome has a list of available shortcuts published here, but there are extra key bindings that are processed by Chrome which are not listed there. For instance, in their docs it says you can select the next tab via ⌘ + Option + Left arrow but ⌘ + Shift + ] also works, and it’s not listed there. Why does it work ? Where is that coming from ? Is it coming from the OS and is it bound to the same action as the previous one ? How does Chrome know how to process that/ know how to process multiple key bindings for the same action ? Is Chrome exposing a full detailed actions/key bindings anywhere (either on the web or more formally in a local dict) ? I also couldn’t find anything about this. This would help me understand better how things work under the hood so that when I want to override anything I could do it fairly easily without any extensions or anything like that. Moreover, when I want to bind a shortcut to an action for Chrome from Mac’s System Preferences. How would I know the action name for my custom shortcut ? Do I just take the names as they are from Chromes keyboard shortcuts page ?