Git Product home page Git Product logo

karabiner-windows-mode's Introduction

karabiner-windows-mode

Karabiner-Elements complex ruleset to make using macOS friendlier by enabling common keyboard functionality used in Linux and Windows. Powered by Jsonnet, allowing the main files that need to be interacted with (*.jsonnet and *.libsonnet) to be much shorter and far more readable.

If you'd like to contribute to this project, please check the Contributing section.

Table of Contents

Installation

Copy and paste the following URL into your browser window and Karabiner-Elements should ask to install the file:

karabiner://karabiner/assets/complex_modifications/import?url=https://raw.githubusercontent.com/rux616/karabiner-windows-mode/main/json/windows_shortcuts.json

(TOC)

List of Shortcuts

First, a note about how these shortcuts are named in Karabiner-Elements. They follow the convention

Key (Modifiers, if any) [Special notes, if any]

so they should be easy(ish) to understand. Contact me if you have improvement suggestions.

There are some applications, such as hypervisors, IDEs, remote desktops, and terminal emulators, that should receive raw inputs and handle them themselves. To that end, almost all shortcuts no longer apply to these applications. As such, the notes will no longer specify that the specific shortcut does not apply to the excepted applications as that is now the default state. Instead, they will note when a shortcut still applies.

Generally Excepted Applications:

  • Hypervisors
    • Oracle VirtualBox VMs (not the VirtualBox manager application)
    • Parallels
    • VMware Fusion
  • IDEs
    • GNU Emacs (GUI)
    • JetBrains (All)
    • Microsoft VSCode
    • VSCodium
    • Sublime Text
  • Remote Desktops
    • Chrome Remote Desktop (app version, not in-browser version)
    • Citrix XenAppViewer
    • Microsoft Remote Desktop Connection
  • Terminal Emulators
    • Alacritty
    • Hyper
    • iTerm2
    • Kitty
    • Terminal
    • WezTerm

List of Web Browsers:

  • Apple Safari
  • Brave Browser
  • Google Chrome
  • Mozilla Firefox
  • Mozilla Firefox Nightly

(TOC)

Navigation Keys

Input Key Input Modifier(s) Output Key Output Modifier(s) Notes
Insert Ctrl C Command Use only 1 Ctrl+Insert shortcut. Works in Terminal Emulators.
Insert Ctrl C Command Use only 1 Ctrl+Insert shortcut.
Insert Shift V Command Use only 1 Shift+Insert shortcut. Works in Terminal Emulators.
Insert Shift V Command Use only 1 Shift+Insert shortcut.
Home Left Arrow Command
Home Ctrl Up Arrow Command
Home Shift Left Arrow Command+Shift
Home Ctrl+Shift Up Arrow Command+Shift
End Right Arrow Command
End Ctrl Down Arrow Command
End Shift Right Arrow Command+Shift
End Ctrl+Shift Down Arrow Command+Shift
Left Arrow Ctrl Left Arrow Option
Left Arrow Ctrl+Shift Left Arrow Option+Shift
Right Arrow Ctrl Right Arrow Option
Right Arrow Ctrl+Shift Right Arrow Option+Shift

(TOC)

Command Keys

Input Key Input Modifier(s) Output Key Output Modifier(s) Notes
Backspace Ctrl Backspace Option
Delete Ctrl Delete Option
Enter Ctrl Enter Command
Enter Ctrl+Shift Enter Command+Shift

(TOC)

Modifier Keys

Input Key Input Modifier(s) Output Key Output Modifier(s) Notes
Win Spotlight Works in Excepted Applications.

(TOC)

Alphanumeric Keys

Input Key Input Modifier(s) Output Key Output Modifier(s) Notes
A Ctrl A Command
B Ctrl B Command
C Left Ctrl C Command
C Ctrl+Shift C Command Only applies to Terminal Emulators.
F Ctrl F Command
H Ctrl H Command Only applies to web browsers.
I Ctrl I Command
L Alt+Ctrl Q Control+Command Use only 1 Alt+Ctrl+L shortcut. Invokes Lock Screen. Works in Excepted Applications.
L Alt+Ctrl Power Control+Shift Use only 1 Alt+Ctrl+L shortcut. Invokes Lock Screen. Note that the screen doesn't always fully lock right away. Works in Excepted Applications.
L Ctrl L Command Only Applies to Web Browsers.
L Win Q Control+Command Use only 1 Win+L shortcut. Invokes Lock Screen. Works in Excepted Applications.
L Win Power Control+Shift Use only 1 Win+L shortcut. Invokes Sleep. Note that the screen doesn't always fully lock right away. Works in Excepted Applications.
N Ctrl N Command
O Ctrl O Command
P Ctrl P Command
R Ctrl R Command
S Ctrl S Command
T Ctrl T Command
U Ctrl U Command
V Ctrl V Command
V Ctrl+Shift V Command Only applies to Terminal Emulators.
W Ctrl W Command
X Ctrl X Command
Y Ctrl Y Command
Z Ctrl Z Command
1 Command (Shell Command) Launches or switches to the app pinned to the first position in the dock (always Finder). Works in IDEs and Terminal Emulators.
2 Command (Shell Command) Launches or switches to the app pinned to the second position in the dock. Works in Terminal IDEs and Emulators.
3 Command (Shell Command) Launches or switches to the app pinned to the third position in the dock. Works in Terminal IDEs and Emulators.
4 Command (Shell Command) Launches or switches to the app pinned to the fourth position in the dock. Works in Terminal IDEs and Emulators.
5 Command (Shell Command) Launches or switches to the app pinned to the fifth position in the dock. Works in Terminal IDEs and Emulators.
6 Command (Shell Command) Launches or switches to the app pinned to the sixth position in the dock. Works in Terminal IDEs and Emulators.
7 Command (Shell Command) Launches or switches to the app pinned to the seventh position in the dock. Works in Terminal IDEs and Emulators.
8 Command (Shell Command) Launches or switches to the app pinned to the eighth position in the dock. Works in Terminal IDEs and Emulators.
9 Command (Shell Command) Launches or switches to the app pinned to the ninth position in the dock. Works in Terminal IDEs and Emulators.

(TOC)

Punctuation Keys

Input Key Input Modifier(s) Output Key Output Modifier(s) Notes
/ Ctrl / Command Works in Terminal Emulators.
Space Ctrl Space Command
Tab Alt Tab Command Works in IDEs and Terminal Emulators.

(TOC)

Function Keys

Input Key Input Modifier(s) Output Key Output Modifier(s) Notes
F1 / Command+Shift
F3 G Command
F4 Alt Q Command Works in Terminal Emulators.
F4 Ctrl W Command Only applies to Google Chrome.
F5 R Command Only applies to Google Chrome.

(TOC)

Credits

  • @TechnicallyDifficult for coming up with the initial json file
  • @alvaro1728 for creating the current json file and for asking the question that got this whole thing started
  • @tezeko for Karabiner-Elements
  • @lsissoko for Ctrl+R and Ctrl+W additions
  • @aperlstein for adding Ctrl+Enter, Ctrl+Shift+Enter, Ctrl+Space, and for adding Citrix XenAppViewer to list of exceptions
  • @Ivanca for adding IDEs to list of exceptions
  • @from-nibly for adding VMware Fusion to list of exceptions
  • @andormarkus for adding JetBrains PyCharm to list of exceptions
  • @amateescu for adding JetBrains PhpStorm to list of exceptions
  • @vidurb for adding GNU Emacs to list of exceptions, and the Cmd+ shortcuts
  • @jkluch for adding Microsoft RDC to list of exceptions
  • @csmager for adding Parallels and JetBrains Rider to list of exceptions
  • @kingamajick for adding WezTerm and Chrome Remote Desktop (enabling support for file_paths to identify applications) to the list of exceptions
  • @raxigan for simplifying JetBrains IDE listing and adding the Win [Spotlight] shortcut
  • @necojackarc for fixing Win+L in newer versions of macOS
  • @edance for adding an additional Emacs bundle, adding "L (Ctrl) [Web Browsers Only]", and expanding the list of web browsers
  • @fab1o for the JSON for Alt+Tab (#14)
  • @simonLeary42 for adding VSCodium bundle, adding "H (Ctrl) [Web Browsers Only]", and adding "F5 [Only Chrome]"

(TOC)

Links

(TOC)

Contributing

Pull requests (PRs) and issues are welcome! But first, some notes:

  • Make sure to note your changes in the relevant places in the readme
  • Remember to give yourself credit in Credits section
  • Don't change any *.json files! They are automatically rendered and your changes will be overridden.

Again, please refrain from making changes directly to any *.json files (all JSON files will be rendered automatically as necessary on a push to the main branch) and instead make your additions in the *.jsonnet and *.libsonnet files and submit a PR. A comment will automatically be added to the PR showing any JSON changes that will result.

(TOC)

Adding Exceptions

When adding exceptions, you will need the applications "bundle identifier". To get this, you can use the following AppleScript (SuperUser thread):

osascript -e 'id of app "<application>"'

In the above example, <application> is the name of the application, such as Finder or Microsoft Excel.

Once you have the bundle identifier, which will be, for example, com.microsoft.VSCode for Microsoft VSCode, you will need to add it to the bundle.libsonnet file in the appropriate section. Since VSCode is an IDE, we would add it to the ides: [ ... ], section. Make sure to add ^ at the beginning, and $ at the end of the identifier, and to add \\ before any periods. (Look in the file and follow the pattern.)

(TOC)

Testing

For testing, get Jsonnet (I use the C++ version personally, but a Go version is also available), render the json file locally (jsonnet -- ./jsonnet/windows_shortcuts.jsonnet >./json/windows_shortcuts.json) and test it in Karabiner Elements to ensure your changes work how you think they should work.

Once your testing is done, you can simply run make to ensure your changes are syntactically valid jsonnet and that they are formatted. If you don't get any errors, then you should be ready to commit your changes and submit a PR.

(TOC)

karabiner-windows-mode's People

Contributors

amateescu avatar andormarkus avatar brianredbeard avatar csmager avatar edance avatar jkluch avatar kingamajick avatar lsissoko avatar necojackarc avatar raxigan avatar rux616 avatar simonleary42 avatar vidurb avatar xmrflipflop avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

karabiner-windows-mode's Issues

Shift-Insert?

It would be great if you could paste the same way you can on LInux.

Add Alt+Tab

See title.

This issue is to track adding "Alt+Tab" functionality.

Additional command Home,End for terminal and F5 to refresh

{
  "title": "My Custom",
  "rules": [
    {
      "description": "Home (Terminal)",
      "manipulators": [
        {
          "from": {
            "key_code": "home",
            "modifiers": {"optional": ["any"]}
          },
          "to": [{
              "key_code": "a",
              "modifiers": ["control"]
          }],
          "conditions": [
            {
              "type": "frontmost_application_if",
              "bundle_identifiers": [
                "^com\\.apple\\.Terminal$",
                "^com\\.googlecode\\.iterm2$"
              ]
            }
          ],
          "type": "basic"
        }
      ]
    },
    {
      "description": "End (Terminal)",
      "manipulators": [
        {
          "from": {
            "key_code": "end",
            "modifiers": {"optional": ["any"]}
          },
          "to": [{
              "key_code": "e",
              "modifiers": ["control"]
          }],
          "conditions": [
            {
              "type": "frontmost_application_if",
              "bundle_identifiers": [
                "^com\\.apple\\.Terminal$",
                "^com\\.googlecode\\.iterm2$"
              ]
            }
          ],
          "type": "basic"
        }
      ]
    },
    {
      "description": "F5",
      "manipulators": [
        {
          "from": {
            "key_code": "f5",
            "modifiers": {"optional": ["any"]}
          },
          "to": [{
              "key_code": "r",
              "modifiers": ["command"]
          }],
          "conditions": [
            {
              "type": "frontmost_application_unless",
              "bundle_identifiers": [
              ]
            }
          ],
          "type": "basic"
        }
      ]
    }
  ]
}

Just want to add something maybe good for you guys (or even implemented in here too)

Home and End for Terminal (go to beginning of line and last of line)
F5 for refresh (command+r)

Ctrl + A/C/V/... doesn't work in Vscode

It's weird,

I activated all the rules, and still. On chrome it works just perfectly perfect, but for some reason, on VsCode it doesn't.

Could you guys point me out to the right direction ?

Thanks.

Break up shortcut rule

Break up monolithic shortcut rule into individual rules to allow greater customization.

Ctrl+Home doesn't work

Actually, now I press "Ctrl+Home" is "Ctrl+Command+Left",because "Home" is "Command+Left" ?

🤔Consider reordering the order like this?:
image

Ctrl + C shortcut isn't working inside a build-in terminal in Visual Studio Code

A standard Ctrl + c shortcut which terminates the current process is not working in the build-in VSC terminal. The same shortcut works perfectly in standard and iTerm terminals. I have all 'Complex modifications' enabled.

I suppose it's a problem that we want keys to be remapped when using VSC, but disabled when focusing it's inside the terminal. There is any "way around" for this problem?

mac screen shot no longer works

CMD+Shift+3 or 4 does not work anymore

Yes I'm using Ctrl in replace of cmd, but the screen shot tool does not get activated.

It shouldn't affect code editors and IDEs (vscode, Sublime Text, IntelliJ and Xcode)

I think there should be an alternative version of this plugin that make exceptions for code editors and IDEs, those apps have their own keybindings files (e.g. keybindings.json in vscode) and changing ctrl for cmd for some combinations messes them up big time, for example it transforms ctrl+f to cmd+f but the command that the app had mapped for ctrl+f becomes completely inaccesible; plus another problem that arises is that the bindings stop making sense (because where it says ctrl now sometimes means cmd)

#32

iterm2 blocking cmd + number for opening app pinned to dock

Everything works as intended, until I enter iterm2 app. Once iterm is active cmd + number stops working until i click on some other app.
I am new to this, maybe someone can help me find solution for this. Thank you

Screen.Recording.2023-06-30.at.20.16.24.mov

Ctrl+left arrow

Hi @rux616 I'm unsure if I am doing someting wrong. After installing the repo file I would expect the follwing shortcut: Ctrl+left/right arrow to jump to end/start of word (the same as on PC) ?

"Win" rule might be broken

There is a rule called "Win" (not mentioned in README), but it seems to be broken - it's not opening Launchpad for me. Based on karabiner key codes list command cannot be used as from.key_code. The rule starts working after changing the key code to left_command.

@rux616 Could you please confirm my suspicions? I can open PR with a fix (and maybe some improvements) later on.

Most modifications not working

Hi!

I have a problem in a new clean. install trying to enable the modifications in this repo. Basic ones are not working currently, like Ctrl + C or Ctrl + V.

I imported all the shortcuts using the command in the README and Enable all.

I deleted the conditional block from the json file, and they started working:

"conditions": [
                  {
                     "bundle_identifiers": [
                        "^org\\.virtualbox\\.app\\.VirtualBoxVM$",
                        "^com\\.parallels\\.desktop\\.console$",
                        "^org\\.vmware\\.fusion$",
                        "^org\\.gnu\\.emacs$",
                        "^com\\.jetbrains",
                        "^com\\.microsoft\\.VSCode$",
                        "^com\\.sublimetext\\.3$",
                        "^net\\.kovidgoyal\\.kitty$",
                        "^com\\.citrix\\.XenAppViewer$",
                        "^com\\.microsoft\\.rdc\\.macos$",
                        "^io\\.alacritty$",
                        "^co\\.zeit\\.hyper$",
                        "^com\\.googlecode\\.iterm2$",
                        "^com\\.apple\\.Terminal$",
                        "^com\\.github\\.wez\\.wezterm$"
                     ],
                     "file_paths": [
                        [
                           "Chrome Remote Desktop\\.app"
                        ]
                     ],
                     "type": "frontmost_application_unless"
                  }
               ],

I am using Ventura 13.0.1. ¿Is there any problem with this OS version?

Thank you very much!

Home/End == Prev Page/Next Page in Firefox

In Firefox, when not focused on a text box (URL bar/in-page box/etc.), the Home and End keys will take the user Back and Forward, instead of to the top and bottom of the page, respectively.

Reporting a vulnerability

Hello!

I hope you are doing well!

We are a security research team. Our tool automatically detected a vulnerability in this repository. We want to disclose it responsibly. GitHub has a feature called Private vulnerability reporting, which enables security research to privately disclose a vulnerability. Unfortunately, it is not enabled for this repository.

Can you enable it, so that we can report it?

Thanks in advance!

PS: you can read about how to enable private vulnerability reporting here: https://docs.github.com/en/code-security/security-advisories/repository-security-advisories/configuring-private-vulnerability-reporting-for-a-repository

Why are Terminals exempted?

Would you mind explaining why Terminals are exempted from the shortcut remapping?

I saw the note in the readme, the original issue #15, as well as the addition for an alternate Ctrl+Shift+C/V for copy/paste issue #7. I don't understand why this is exempted though.

Thanks!

Sam

Dvorak layout doesn't work

My hunch is that this affects other shortcuts as well.

This bug is due to Karabiner unable to support anything but the physical layout of qwerty mappings, requiring a complete copy of the existing settings, mapping to the qwerty equivalents of what ever layout is desired.

Ctrl+F4

Ctrl+t works to open tabs in Chrome. From Windows I am used to closing them with Ctrl+F4. It would be great to add that.

Emacs doesn't receive control key event.

After enabling karabiner windows mode emacs hotkeys receive interference.

In particular, ctrl-c, receives the meta-c input. This is also true for other overlapping hotkeys. The karabiner mode works as expected, and Emacs receives the signal replacement which has been modified via karabiner windows mode.

Is it possible to add emacs to the exception list. If you can explain how I would do that in the bundle.libsonnet file. I would be happy to submit the change.

How to add programs to the list, could be potentially useful for users if documented in the readme.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.