Skip to content

Commit

Permalink
Add alt shortcuts to Karabiner Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
aminfara committed Jan 15, 2022
1 parent 1b2c09e commit ea1aa5e
Show file tree
Hide file tree
Showing 2 changed files with 163 additions and 100 deletions.
5 changes: 5 additions & 0 deletions karabiner/assets/complex_modifications/utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
terminals = ["^com\\.apple\\.Terminal$", "^com\\.googlecode\\.iterm2$"]
finder = ["^com\\.apple\\.finder$"]


def co(condition):
Expand All @@ -11,6 +12,10 @@ def co(condition):
"type": "frontmost_application_unless",
"bundle_identifiers": terminals,
},
"if_finder": {
"type": "frontmost_application_if",
"bundle_identifiers": finder,
},
}.get(condition)


Expand Down
258 changes: 158 additions & 100 deletions karabiner/assets/complex_modifications/windows-mappings.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
# Ctrl + Z Undo an action.
mp(
fk("z", ["control"]),
[tk("z", ["right_command"])],
[tk("z", ["right_command"])],
[co("unless_terminals")],
),
# ------------------------------------------------------------------
Expand All @@ -57,30 +57,88 @@
mp(fk("q", ["control"]), [tk("q", ["right_command"])]),
# ------------------------------------------------------------------
# Win + L Lock your PC.
# Addressed in Next section
# ------------------------------------------------------------------
# Win + D Display and hide the desktop.
# Addressed in Next section
# ------------------------------------------------------------------
# F2 Rename the selected item.
# TODO: go to explorer part
mp(fk("f2"), [tk("return")], [co("if_finder")]),
# ------------------------------------------------------------------
# F3 Search for a file or folder in File Explorer.
mp(fk("f3"), [tk("f", ["right_command"])], [co("if_finder")]),
# ------------------------------------------------------------------
# F4 Display the address bar list in File Explorer.
mp(fk("f4"), [tk("g", ["right_command", "shift"])], [co("if_finder")]),
# ------------------------------------------------------------------
# F5 Refresh the active window.
mp(fk("f5"), [tk("r", ["right_command"])]),
# ------------------------------------------------------------------
# F6 Cycle through screen elements in a window or on the desktop.
# N/A
# ------------------------------------------------------------------
# F10 Activate the Menu bar in the active app.
mp(fk("f10"), [tk("f2", ["right_control"])]),
# ------------------------------------------------------------------
# Alt + F8 Show your password on the sign-in screen.
# N/A
# ------------------------------------------------------------------
# Alt + Esc Cycle through items in the order in which they were opened.
# N/A
# ------------------------------------------------------------------
# Alt + underlined letter Perform the command for that letter.
mp(
fk("e", ["option"]),
[tk("f2", ["right_control"]), tk("e"), tk("down_arrow")],
),
mp(
fk("f", ["option"]),
[tk("f2", ["right_control"]), tk("f"), tk("down_arrow")],
),
mp(
fk("g", ["option"]),
[tk("f2", ["right_control"]), tk("g"), tk("down_arrow")],
),
mp(
fk("h", ["option"]),
[tk("f2", ["right_control"]), tk("h"), tk("down_arrow")],
),
mp(
fk("i", ["option"]),
[tk("f2", ["right_control"]), tk("i"), tk("down_arrow")],
),
mp(
fk("r", ["option"]),
[tk("f2", ["right_control"]), tk("r"), tk("down_arrow")],
),
mp(
fk("s", ["option"]),
[tk("f2", ["right_control"]), tk("s"), tk("down_arrow")],
),
mp(
fk("t", ["option"]),
[tk("f2", ["right_control"]), tk("t"), tk("down_arrow")],
),
mp(
fk("v", ["option"]),
[tk("f2", ["right_control"]), tk("v"), tk("down_arrow")],
),
mp(
fk("w", ["option"]),
[tk("f2", ["right_control"]), tk("w"), tk("down_arrow")],
),
# ------------------------------------------------------------------
# Alt + Enter Display properties for the selected item.
# TODO: go to explorer part
mp(
fk("return_or_enter", ["option"]),
[tk("i", ["right_command"])],
[co("if_finder")],
),
# ------------------------------------------------------------------
# Alt + Spacebar Open the shortcut menu for the active window.
# TODO: find what Alt + Space does in windows
# ------------------------------------------------------------------
# Alt + Left arrow Go back.
# ------------------------------------------------------------------
Expand Down Expand Up @@ -332,109 +390,109 @@
# Ctrl + End (History navigation)If the command line is empty, move the viewport to the command line. Otherwise, delete all the characters to the right of the cursor in the command line.
],
# --------------------------------------------------------------------------------------------------------------
"Dialog box keyboard shortcuts": [
# ------------------------------------------------------------------
# F4 Display the items in the active list.
# ------------------------------------------------------------------
# Ctrl + Tab Move forward through tabs.
# ------------------------------------------------------------------
# Ctrl + Shift + Tab Move back through tabs.
# ------------------------------------------------------------------
# Ctrl + number (number 1–9) Move to nth tab.
# ------------------------------------------------------------------
# Tab Move forward through options.
# ------------------------------------------------------------------
# Shift + Tab Move back through options.
# ------------------------------------------------------------------
# Alt + underlined letter Perform the command (or select the option) that is used with that letter.
# ------------------------------------------------------------------
# Spacebar Select or clear the check box if the active option is a check box.
# ------------------------------------------------------------------
# Backspace Open a folder one level up if a folder is selected in the Save As or Open dialog box.
# ------------------------------------------------------------------
# Arrow keys Select a button if the active option is a group of option buttons.
],
# "Dialog box keyboard shortcuts": [
# ------------------------------------------------------------------
# F4 Display the items in the active list.
# ------------------------------------------------------------------
# Ctrl + Tab Move forward through tabs.
# ------------------------------------------------------------------
# Ctrl + Shift + Tab Move back through tabs.
# ------------------------------------------------------------------
# Ctrl + number (number 1–9) Move to nth tab.
# ------------------------------------------------------------------
# Tab Move forward through options.
# ------------------------------------------------------------------
# Shift + Tab Move back through options.
# ------------------------------------------------------------------
# Alt + underlined letter Perform the command (or select the option) that is used with that letter.
# ------------------------------------------------------------------
# Spacebar Select or clear the check box if the active option is a check box.
# ------------------------------------------------------------------
# Backspace Open a folder one level up if a folder is selected in the Save As or Open dialog box.
# ------------------------------------------------------------------
# Arrow keys Select a button if the active option is a group of option buttons.
# ],
# --------------------------------------------------------------------------------------------------------------
"File Explorer keyboard shortcuts": [
# ------------------------------------------------------------------
# Alt + D Select the address bar.
# ------------------------------------------------------------------
# Ctrl + E Select the search box.
# ------------------------------------------------------------------
# Ctrl + F Select the search box.
# ------------------------------------------------------------------
# Ctrl + N Open a new window.
# ------------------------------------------------------------------
# Ctrl + W Close the active window.
# ------------------------------------------------------------------
# Ctrl + mouse scroll wheel Change the size and appearance of file and folder icons.
# ------------------------------------------------------------------
# Ctrl + Shift + E Display all folders above the selected folder.
# ------------------------------------------------------------------
# Ctrl + Shift + N Create a new folder.
# ------------------------------------------------------------------
# Num Lock + asterisk (*) Display all subfolders under the selected folder.
# ------------------------------------------------------------------
# Num Lock + plus (+) Display the contents of the selected folder.
# ------------------------------------------------------------------
# Num Lock + minus (-) Collapse the selected folder.
# ------------------------------------------------------------------
# Alt + P Display the preview panel.
# ------------------------------------------------------------------
# Alt + Enter Open the Properties dialog box for the selected item.
# ------------------------------------------------------------------
# Alt + Right arrow View the next folder.
# ------------------------------------------------------------------
# Alt + Up arrow View the folder that the folder was in.
# ------------------------------------------------------------------
# Alt + Left arrow View the previous folder.
# ------------------------------------------------------------------
# Backspace View the previous folder.
# Right arrow Display the current selection (if it's collapsed), or select the first subfolder.
# ------------------------------------------------------------------
# Left arrow Collapse the current selection (if it's expanded), or select the folder that the folder was in.
# ------------------------------------------------------------------
# End Display the bottom of the active window.
# ------------------------------------------------------------------
# Home Display the top of the active window.
# ------------------------------------------------------------------
# F11 Maximize or minimize the active window.
],
# "File Explorer keyboard shortcuts": [
# ------------------------------------------------------------------
# Alt + D Select the address bar.
# ------------------------------------------------------------------
# Ctrl + E Select the search box.
# ------------------------------------------------------------------
# Ctrl + F Select the search box.
# ------------------------------------------------------------------
# Ctrl + N Open a new window.
# ------------------------------------------------------------------
# Ctrl + W Close the active window.
# ------------------------------------------------------------------
# Ctrl + mouse scroll wheel Change the size and appearance of file and folder icons.
# ------------------------------------------------------------------
# Ctrl + Shift + E Display all folders above the selected folder.
# ------------------------------------------------------------------
# Ctrl + Shift + N Create a new folder.
# ------------------------------------------------------------------
# Num Lock + asterisk (*) Display all subfolders under the selected folder.
# ------------------------------------------------------------------
# Num Lock + plus (+) Display the contents of the selected folder.
# ------------------------------------------------------------------
# Num Lock + minus (-) Collapse the selected folder.
# ------------------------------------------------------------------
# Alt + P Display the preview panel.
# ------------------------------------------------------------------
# Alt + Enter Open the Properties dialog box for the selected item.
# ------------------------------------------------------------------
# Alt + Right arrow View the next folder.
# ------------------------------------------------------------------
# Alt + Up arrow View the folder that the folder was in.
# ------------------------------------------------------------------
# Alt + Left arrow View the previous folder.
# ------------------------------------------------------------------
# Backspace View the previous folder.
# Right arrow Display the current selection (if it's collapsed), or select the first subfolder.
# ------------------------------------------------------------------
# Left arrow Collapse the current selection (if it's expanded), or select the folder that the folder was in.
# ------------------------------------------------------------------
# End Display the bottom of the active window.
# ------------------------------------------------------------------
# Home Display the top of the active window.
# ------------------------------------------------------------------
# F11 Maximize or minimize the active window.
# ],
# --------------------------------------------------------------------------------------------------------------
"Virtual desktops keyboard shortcuts": [
# ------------------------------------------------------------------
# Win + Tab Open Task view.
# ------------------------------------------------------------------
# Win + Ctrl + D Add a virtual desktop.
# ------------------------------------------------------------------
# Win + Ctrl + Right arrow Switch between virtual desktops you’ve created on the right.
# ------------------------------------------------------------------
# Win + Ctrl + Left arrow Switch between virtual desktops you’ve created on the left.
# ------------------------------------------------------------------
# Win + Ctrl + F4 Close the virtual desktop you're using.
],
# "Virtual desktops keyboard shortcuts": [
# ------------------------------------------------------------------
# Win + Tab Open Task view.
# ------------------------------------------------------------------
# Win + Ctrl + D Add a virtual desktop.
# ------------------------------------------------------------------
# Win + Ctrl + Right arrow Switch between virtual desktops you’ve created on the right.
# ------------------------------------------------------------------
# Win + Ctrl + Left arrow Switch between virtual desktops you’ve created on the left.
# ------------------------------------------------------------------
# Win + Ctrl + F4 Close the virtual desktop you're using.
# ],
# --------------------------------------------------------------------------------------------------------------
"Taskbar keyboard shortcuts": [
# ------------------------------------------------------------------
# Shift + click a taskbar button Open an app or quickly open another instance of an app.
# ------------------------------------------------------------------
# Ctrl + Shift + click a taskbar button Open an app as an administrator.
# ------------------------------------------------------------------
# Shift + right-click a taskbar button Show the window menu for the app.
# ------------------------------------------------------------------
# Shift + right-click a grouped taskbar button Show the window menu for the group.
# ------------------------------------------------------------------
# Ctrl + click a grouped taskbar button Cycle through the windows of the group.
],
# "Taskbar keyboard shortcuts": [
# ------------------------------------------------------------------
# Shift + click a taskbar button Open an app or quickly open another instance of an app.
# ------------------------------------------------------------------
# Ctrl + Shift + click a taskbar button Open an app as an administrator.
# ------------------------------------------------------------------
# Shift + right-click a taskbar button Show the window menu for the app.
# ------------------------------------------------------------------
# Shift + right-click a grouped taskbar button Show the window menu for the group.
# ------------------------------------------------------------------
# Ctrl + click a grouped taskbar button Cycle through the windows of the group.
# ],
# --------------------------------------------------------------------------------------------------------------
"Settings keyboard shortcuts": [
# ------------------------------------------------------------------
# Win + I Open settings.
# ------------------------------------------------------------------
# Backspace Go back to the settings home page.
# ------------------------------------------------------------------
# Type on any page with search box Search settings.
],
# "Settings keyboard shortcuts": [
# ------------------------------------------------------------------
# Win + I Open settings.
# ------------------------------------------------------------------
# Backspace Go back to the settings home page.
# ------------------------------------------------------------------
# Type on any page with search box Search settings.
# ],
# --------------------------------------------------------------------------------------------------------------
"Disable corresponding macOS shortcuts": [
# ------------------------------------------------------------------
Expand Down

0 comments on commit ea1aa5e

Please sign in to comment.