Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows keyboard shortcuts for the Mac, please! #249

Closed
alvaro1728 opened this issue Oct 6, 2016 · 31 comments
Closed

Windows keyboard shortcuts for the Mac, please! #249

alvaro1728 opened this issue Oct 6, 2016 · 31 comments

Comments

@alvaro1728
Copy link

alvaro1728 commented Oct 6, 2016

I have a Macbook laptop and all I want is to have my handy Windows keyboard shortcuts work on it, like they did when I was on El Capitan/Karabiner. Now that I'm on Sierra, I'm trying Karabiner-Elements and I can't determine how to map something basic like Control+C to Command+C in the karabiner.json file. Is it possible and if so how?

Another issue is how to swap the Control and Fn keys (which I physically swapped) when I'm on the laptop's keyboard but keep them the same for my external keyboard. Again, is this possible? I would be fine with updating the file manually each time I change keyboards until there's a permanent solution.

BTW, before trying Elements, I went the DefaultKeyBinding.dict route and set it up like this:

"\UF729" = "moveToBeginningOfLine:"; // Home
"^\UF729" = "moveToBeginningOfDocument:"; // Ctrl + Home
"$\UF729" = "moveToBeginningOfLineAndModifySelection:"; // Shift + Home
"^$\UF729" = "moveToBeginningOfDocumentAndModifySelection:"; // Shift + Ctrl + Home
"\UF72B" = "moveToEndOfLine:"; // End
"^\UF72B" = "moveToEndOfDocument:"; // Ctrl + End
"$\UF72B" = "moveToEndOfLineAndModifySelection:"; // Shift + End
"^$\UF72B" = "moveToEndOfDocumentAndModifySelection:"; // Shift + Ctrl + End
"\UF72C" = "pageUp:"; // PageUp
"\UF72D" = "pageDown:"; // PageDown
"^\UF702" = "moveWordBackward:"; // Ctrl + LeftArrow
"^\UF703" = "moveWordForward:"; // Ctrl + RightArrow
"^$\UF702" = "moveWordBackwardAndModifySelection:"; // Shift + Ctrl + Leftarrow
"^$\UF703" = "moveWordForwardAndModifySelection:"; // Shift + Ctrl + Rightarrow
"^\U007F" = "deleteWordBackward:"; // Ctrl + delete left
"^c" = "copy:"; // Ctrl + c
"^x" = "cut:"; // Ctrl + x
"^v" = "paste:"; // Ctrl + v
"^z" = "undo:"; // Ctrl + z
"^y" = "redo:"; // Ctrl + y
"^a" = "selectAll:"; // Ctrl + a
"^s" = "saveAllDocuments:"; // Ctrl + s

The problem is that these shortcuts only work in certain apps, like Chrome and TextEdit. But other apps completely override it with their own. (This wasn't an issue with Karabiner. I miss it so much!)

Thanks,
Alvaro

@cameroooon
Copy link

+1

@jokaorgua
Copy link

+1 to ^c ^v cause I'm working with macos and windows in virtual machine. Used to use ^c.

@jritsema
Copy link

Just curious @alvaro1728, using the DefaultKeyBinding.dict settings above were you able to get ctrl + arrows working? For me (on sierra), they do nothing. All of the other settings do work though.

"^\UF702" = "moveWordBackward:"; // Ctrl + LeftArrow
"^\UF703" = "moveWordForward:"; // Ctrl + RightArrow

Also, curious if anyone has figured out how to get the windows settings (above) to work in electron-based apps (like atom or hyperterm)? I know karabiner used to handle ALL apps, but just looking for a stopgap solution. Thanks!

@alvaro1728
Copy link
Author

@jritsema Those two shortcuts work fine for me. I just tried it by going to Chrome's address bar and using Ctrl+Left/Right to move one word at a time. BTW, I use IntelliJ IDEA for my development and it's easy to configure it with the "Visual Studio" keymap.

@jritsema
Copy link

jritsema commented Nov 28, 2016

Thanks @alvaro1728. Turns out that I had those keys already enabled for Mission Control. Once I disabled them (via prefs/keyboard/shortcuts/mission control), everything worked!


Also, in case it helps out anyone else using the Atom editor, you can get the pc style keyboard bindings by replacing your keymap.cson with these...

https://github.com/atom/atom/blob/master/keymaps/win32.cson

Also, as for Hyper, I've asked about it here...but in the meantime, iTerm2 has custom key bindings!

@derwaldgeist
Copy link

Are there any plans to revive the Windows mapping? For months, I have been waiting to update to Sierra just because Karabiner wasn't ready yet. Now I finally had to update to Sierra, and the limitations of Karabiner Elements are driving me mad. The things I would need the most:

  • Map Cmd-C and so on to Ctrl-C (I worked around this by swapping Cmd to Ctrl completely)
  • Make Ctrl-Arrow move the cursor around one word
  • Map Home and End so they work as on Windows

I tried to build "complex rules" for that, but couldn't get them work, since the JSON file is not really documented.

@TechnicallyDifficult
Copy link

TechnicallyDifficult commented Jul 10, 2017

@derwaldgeist I did some digging through some of the example files, and I think I managed to figure out somewhat how it works, since I was having the same issue as most people here. I switched around more or less everything I can think of to make my keyboard shortcuts as windows-like as possible (though I may have forgotten a thing or two).

I'll gladly share the file as soon as I clean it up a bit (and fix some things that I didn't catch at first).

@TechnicallyDifficult
Copy link

TechnicallyDifficult commented Jul 10, 2017

Whew, that took longer than I expected. Getting Home and End to work right was tricky because command or control kept getting "stuck", though I worked around it by having it also trigger those keypresses. In other words, I think Home and End work properly, but I had to jump through a hoop or two, so there may be some issues that I didn't encounter...

Regardless, here's the file! (zipped up so that I can attach it here)

windows_mode.json.zip

Just place it in ~/.config/karabiner/assets/complex_modifications/ and you should be able to add the rules to a profile just like the way adding example rules works!

Edit: Updated the file. Fixed something with Home that I had forgotten about and removed some other unnecessary stuff. Should work better now!

Edit 2: Updated again. Messed some stuff up with the arrows and backspace before.

@argonNet
Copy link

Hi !!! Very nice work, it's seems to work ! I will test it a few day. Thanks !

@alvaro1728
Copy link
Author

@TechnicallyDifficult Thanks a lot for this! It's a great step in the right direction.

I modified your "Change Home and End to behave like Windows" since Home/End were mapped to the beginning/end of the paragraph instead of the line. Also, I set RightControl+Home/End to behave like LeftControl+Home/End. Here's my updated file:

windows_mode.json.zip

On a separate note, as much as I like the Windows shortcuts on my Mac, I would prefer if they live alongside the Mac shortcuts (Command+C,V,etc) in case another colleague ever needs to type on my computer temporarily. So I'm going to spend some time creating another version of this file that preserves the Mac shortcuts.

Thanks again!
Alvaro

@alvaro1728
Copy link
Author

alvaro1728 commented Jul 21, 2017

OK, I spent a some time creating a brand new JSON file with the most popular Windows shortcuts without altering the Mac (Command) shortcuts. So something like Control+C will work alongside Command+C (and it won't override Control+C in the Terminal application). Here's the file:

windows_shortcuts.json.zip

Download and unzip it to ~/.config/karabiner/assets/complex_modifications. Then in Karabiner Elements, click on Add rule under "Complex Modifications" and then Enable "Windows shortcuts". That's it!

Thanks to @TechnicallyDifficult for the inspiration. Enjoy!
Alvaro

@dustpuppyNGTI
Copy link

windows shortcuts was missing ctrl-t. So:

        {
          "from": {
            "key_code": "t",
            "modifiers": {
              "mandatory": [ "left_control" ],
              "optional": [ "any" ]
            }
          },
          "to": [ {
              "key_code": "t",
              "modifiers": [ "left_command" ]
            }
          ],
          "type": "basic"
        },

@alvaro1728
Copy link
Author

I wasn't aware of Ctrl+T. What does it typically do?

@dustpuppyNGTI
Copy link

dustpuppyNGTI commented Dec 1, 2017

It opens new tabs. I use it mostly in my browser.

Now that I'm messing with it, CTRL-L (selecting location bar in browser) also hasn't been mapped.

@woutervanwijk
Copy link

These windows_shortcuts.json.zip should be distributed by default in Karabiner Elements imho! Thanks guys!!!

@unbiased-dev
Copy link

These don't work for me on 11.5.0,
can someone update them for latest version?

@b1102
Copy link

b1102 commented Feb 13, 2018

These windows_shortcuts.json.zip is awesome!!!! We missing alt + f4, and windows + l

@eboye
Copy link

eboye commented Feb 15, 2018

I'm wondering if we could make backspace goes up one folder in finder but without breaking backspace functionality on filename edit?

@Vadorequest
Copy link

Would be nice to have a repo for this, I tried the windows shortcuts and it's not perfect, stuff like ctrl+tab and alt+tab aren't working properly. And it's not so easy to fix sadly.

@jluterek
Copy link

jluterek commented Mar 8, 2018

What shortcut should be used to quit after install this?

@guimenez
Copy link

Please can anyone create the Alt+F4 to Quit Apps?
Thanks

@rux616
Copy link

rux616 commented Mar 20, 2018

I made a repo for this so we can keep track of these things. Please feel free to contribute if you have the know-how, and add feature requests, report bugs, etc.

I still have yet to document all the shortcuts currently added, but I plan on doing that in the near future.

@guimenez
Copy link

Is the alt+f4 working?
Thank you.

@rux616
Copy link

rux616 commented Mar 21, 2018

I haven't added Alt-F4 yet, but I've opened an issue on my repo to make sure I don't forget about it.

@rux616
Copy link

rux616 commented Mar 23, 2018

@guimenez Just to let you know, I've added Alt+F4.

@guimenez
Copy link

Working amazing.
It's it possible add the Ctrl (pressed) + mouse click to open link in a new tab like Windows?
Thank you.

@ror6ax
Copy link

ror6ax commented Jul 23, 2018

Hi guys. I am wondering if anyone succeeded in adding shift/ctrl-insert shortcut?

@PawelFaron
Copy link

@alvaro1728 thanks for your effort. I tried your config and it works great. The last problem I see is the missing of Alt+Tab for scrolling between Applications. It has to be done by Windows Key + Tab. Do you think it would be possible to configure it to use Alt+Tab?

@flacohenao
Copy link

Guys, Just a question... I'm super new to MAC.
I already imported your awesome configuration in karabiner.. but how I actually get it work?

Non of the complex functions works for me.

@Malumen
Copy link

Malumen commented Sep 25, 2024

I beg of you, is there any equivalent to thw Win+E for Karabiner?

I just want to open a new finder window and access my files quickly. That's all. Command+N when Finder.app is selected is a bit too cumbersome, I need to open regardless of any app. Preferably something like bound to F1 or another function key.

Any ideas???

@jakesarjeant
Copy link

I beg of you, is there any equivalent to thw Win+E for Karabiner?

@Malumen

{
    "description": "CMD+E opens finder",
    "manipulators": [
        {
            "from": {
                "key_code": "e",
                "modifiers": {
                    "mandatory": ["left_command"],
                    "optional": ["any"]
                }
            },
            "to": [{ "software_function": { "open_application": { "bundle_identifier": "com.apple.Finder" } } }],
            "type": "basic"
        }
    ]
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests