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

add hyper key #170

Closed
wants to merge 1 commit into from
Closed

add hyper key #170

wants to merge 1 commit into from

Conversation

@ranmocy
Copy link

@ranmocy ranmocy commented Sep 27, 2016

Create a fake hyper key that user can map to.
E.x. "left_control" : "hyper". Then when user click on left_control + b, it will be equivalent to left_control + left_option + left_command + b

@@ -369,6 +373,7 @@ class types final {

// Extra
{"fn", key_code::vk_fn_modifier},
{"hyper", key_code::vk_hyper_modifier}, // equal to ctrl + option + cmd

This comment has been minimized.

@j-martin

j-martin Sep 27, 2016

"Commonly" (quote-unquote), hyper key is ctrl + option + cmd + shift. Cool stuff though!

This comment has been minimized.

@mafredri

mafredri Sep 27, 2016

I think that is a matter of opinion, though. There is no formal definition of a hyper key on macOS. Personally I find it most useful to have hyper as ctrl + option + cmd (when mapping to caps lock) giving you hyper and hyper + shift for an even wider space of combinations.

This comment has been minimized.

@talha131

talha131 Sep 27, 2016
Contributor

@mafredri That's an interesting use case. Anyway, Karabiner has it mapped to ⇧Shift+⌃Control+⌥Option (alt)+⌘Command

https://github.com/tekezo/Karabiner/blob/master/src/core/server/Resources/include/checkbox/standards/fn.xml#L103

This comment has been minimized.

@j-martin

j-martin Sep 27, 2016

@mafredri that actually sounds awesome. Long live ctrl + option + cmd!

This comment has been minimized.

@wxmtech

wxmtech Sep 29, 2016

Interesting, but still want the modifier hyper stuff.

@bweinand
Copy link

@bweinand bweinand commented Sep 27, 2016

In my opinion 'ctrl '+ 'option' + 'cmd' is easy to achieve without help. Three keys plus Shift is a Finger-breaker. I would be really happy to see the Shift key (optionally) included. Thank you for the hard work.

@zeekay
Copy link

@zeekay zeekay commented Sep 27, 2016

Is it possible to use this to just send ctrl when used in conjunction with other keys, and escape otherwise?

@irliao
Copy link

@irliao irliao commented Sep 28, 2016

@ranmocy built and tested your changes on my machine, no issues so far, thank you so much!

@joeybaker
Copy link

@joeybaker joeybaker commented Sep 28, 2016

If anyone else wants to give @ranmocy's work a shot, here's a built version 📂

@ranmocy ranmocy force-pushed the ranmocy:master branch 2 times, most recently from 68a754e to e63c58e Sep 28, 2016
@irliao
irliao approved these changes Sep 29, 2016
@athomann
Copy link

@athomann athomann commented Sep 30, 2016

to use this, would I do something like this?
"simple_modifications": { "caps_lock": "hyper" }

@aurelberra
Copy link

@aurelberra aurelberra commented Sep 30, 2016

Exactly. As soon as the approved pull request makes it into the next version, or by using a build.

@shariffy
Copy link

@shariffy shariffy commented Oct 3, 2016

Using the build made by @joeybaker with { "caps_lock": "hyper" } for the last 3 days and no issues so far, I'm happy to report. (There's been delays and whatnot in custom combos but I'm pretty sure BetterTouchTool is the culprit there.)

The addition of shift would work better for my particular mappings though and, as I'm not the only one, I would like to contribute a PR for an extra virtual modifier if that's what's advised. Just some guidance on the name would be appreciated: "hyper_shift"? "hyper_plus_shift"?

@@ -21,6 +21,7 @@ class modifier_flag_manager final {
states_[static_cast<size_t>(krbn::modifier_flag::right_option)] = std::make_unique<state>("option", "");
states_[static_cast<size_t>(krbn::modifier_flag::right_command)] = std::make_unique<state>("command", "");
states_[static_cast<size_t>(krbn::modifier_flag::fn)] = std::make_unique<state>("fn", "fn");
states_[static_cast<size_t>(krbn::modifier_flag::hyper)] = std::make_unique<state>("hyper", "hyper");

This comment has been minimized.

@johndbritton

johndbritton Oct 4, 2016

The build provided in #170 (comment) is working well for me, but my hyper key is different than what has been implemented here.

As others have raised the same issue, maybe we could add a few options here? Assuming hyper is the four main modifier keys, here are all the combinations of three or four keys that would be possible for the hyper key:

  • hyper - shift + ctrl + opt + cmd
  • hyper_minus_shift - ctrl + opt + cmd
  • hyper_minus_ctrl - shift + opt + cmd
  • hyper_minus_opt - shift + ctrl + cmd
  • hyper_minus_cmd - shift + ctrl + opt

This comment has been minimized.

@sprig

sprig Nov 17, 2016

I would also add a slim_hyper which would be just opt + cmd (the rationale is that opt + cmd is also quite rarely used, at least e.g. in the apps I normally use, and that allows for more variations ala hyper + shift, hyper + ctrl, etc.

This comment has been minimized.

@YANOUSHek

YANOUSHek Dec 30, 2016

Wouldn't this be better to add a possibility to map a single key to an array of modifiers? So that anyone can decide what's hyper for them. Something like:

"control_l": ["shift_l", "command_l", "control_l", "option_l"]

This comment has been minimized.

@brandondrew

brandondrew Jan 24, 2017

@YANOUSHek I'm assuming you meant

"hyper": ["shift_l", "command_l", "control_l", "option_l"]

This comment has been minimized.

@YANOUSHek

YANOUSHek Jan 25, 2017

No, I meant an option that says: "When I press control_l send control_l + command_l + shift_l + option_l to the system".

@johndbritton
Copy link

@johndbritton johndbritton commented Oct 6, 2016

I've been using the build @joeybaker provided in #170 (comment) and it has worked well, but I've started to notice an issue.

Modifier keys used in combination with mouse events seem to go undetected. All clicks that function differently with a modifier key go unrecognized:

  • cmd + click - No longer opens a link in a new browser tab
  • shift + click - No longer selects text in an active text field from the position of the cursor to the location of the click.
@johndbritton
Copy link

@johndbritton johndbritton commented Oct 9, 2016

Modifier keys used in combination with mouse events seem to go undetected.

If you're having this issue, I've found that opening Activity Monitor.app and force quitting the karabiner_* processes can resolve it.

@ranmocy ranmocy force-pushed the ranmocy:master branch from e63c58e to 8f06f6a Oct 9, 2016
@ChrisPenner
Copy link

@ChrisPenner ChrisPenner commented Oct 11, 2016

Thanks for working on this! It's one of the main features I used in Karabiner and I was sad when it stopped working!

@k0nserv
Copy link

@k0nserv k0nserv commented Oct 11, 2016

I made some slight modifications to this. I

  • Rebased on latest master
  • Change hyper to be cmd + alt + shift + ctrl

It was a bit buggy before I restarted the machine, but now it works super well. Thanks @ranmocy

EDIT: I implemented the suggestion by @johndbritton in case anyone wants to try it out here's a built for that Karabiner-Elements-0.90.48.dmg.zip 📁

@ranmocy ranmocy force-pushed the ranmocy:master branch from 8f06f6a to 38745c0 Oct 12, 2016
@ranmocy
Copy link
Author

@ranmocy ranmocy commented Oct 12, 2016

Rebased to head

@AndersTao
Copy link

@AndersTao AndersTao commented Oct 13, 2016

Tanks @k0nserv, works great!

@MartinAyla
Copy link

@MartinAyla MartinAyla commented Oct 13, 2016

Anyone know why this hasn't been committed yet? Thanks

@k0nserv
Copy link

@k0nserv k0nserv commented Oct 13, 2016

It might be the cases that @tekezo does not want to implement it in this way. It's fairly specific to only hyper. I think the plan is to have a way to map any single key to multiple other keys in the future. Would be nice to have a comment from @tekezo though

@hudochenkov
Copy link

@hudochenkov hudochenkov commented Oct 21, 2016

@k0nserv Your build would is fantastic! Could you, please, update your build to the latest version? It looks like mouse problem is solved (like cmd + click).

image

@k0nserv
Copy link

@k0nserv k0nserv commented Oct 21, 2016

Sure thing I'll do that tonight GMT

@ranmocy ranmocy force-pushed the ranmocy:master branch from 38745c0 to 4f85d98 Oct 21, 2016
@sunapi386
Copy link

@sunapi386 sunapi386 commented Oct 22, 2016

I map the fn key to hyper, but doing this causes the f1-f12 keys to be disabled as well (which arguably is the correct behavior).

Those keys would still work in the old Karabiner with El Capitan; i.e. to adjust brightness.

@k0nserv
Copy link

@k0nserv k0nserv commented Oct 25, 2016

My computer has completely borked itself(busted SSD). I'm probably going to wait until after the Apple event and buy a new one. Anyone else feel free to rebase my fork and send a PR though.

cc @hudochenkov

@lowski
Copy link

@lowski lowski commented May 6, 2017

Can this get merged, please?

@CmdrDats
Copy link

@CmdrDats CmdrDats commented May 22, 2017

Please please please merge this?

@kattrali
Copy link

@kattrali kattrali commented May 22, 2017

I doubt that this PR can be merged in a meaningful way anymore. The divergence from master is quite substantial (not even including the conflicting files), and in the case of src/share/types.hpp, the file no longer exists. If something like this should be merged, it would need to be redone.

@wesbos
Copy link

@wesbos wesbos commented May 26, 2017

I'm out of the loop here - how do I get Hyper to start working again? Still a custom build or has this functionality been added to the app?

@mrooney
Copy link

@mrooney mrooney commented May 27, 2017

jondkinney's link is working for me again for 0.90.68.dmg. And I copied to S3 here. From here, add a "Simple Modification" (first tab) to hyper (in the bottom section, "Other").

@jordonbaade
Copy link

@jordonbaade jordonbaade commented May 31, 2017

Thanks @mrooney and everyone, made my upgrade to Sierra rather painless today. :)

@rafegoldberg
Copy link

@rafegoldberg rafegoldberg commented Jun 6, 2017

@mrooney followed your links/instructions, which worked like a charm! much appreciated.

@drusellers
Copy link

@drusellers drusellers commented Jun 11, 2017

Man, I cannot wait for this to hit the mainline.

@HRG1
Copy link

@HRG1 HRG1 commented Jun 13, 2017

Hurrah! Hyper Key is back with the latest Karabiner-Elements.

@jm789
Copy link

@jm789 jm789 commented Jun 13, 2017

Hey @HRG1, what version are you using? I don't see a hyper key option in v0.90.92?

@HRG1
Copy link

@HRG1 HRG1 commented Jun 13, 2017

The latest version 0.91.1. Look at the examples: https://github.com/tekezo/Karabiner-Elements/tree/master/examples

@wesbos
Copy link

@wesbos wesbos commented Jun 13, 2017

@jondkinney
Copy link

@jondkinney jondkinney commented Jun 13, 2017

@wesbos you'll probably have to compile it manually from the master branch. My older build (referenced above) is still working great for me, so I haven't found the need to re-do that cherry-picking / upstream multiple repo merge dance I did last year.

@wesbos
Copy link

@wesbos wesbos commented Jun 13, 2017

Looks like you can click the "Check for Beta updates" button and download that latest.

Now where do I put the json files? I've never used a custom config and that docs don't say anything about it.

@wesbos
Copy link

@wesbos wesbos commented Jun 13, 2017

It works!

Steps to get Hyper with the latest Karabiner 0.91.1:

  1. Open Karabiner and download the latest beta with "Check for Beta updates"
  2. Open your config file located at `~/.config/karabiner/karabiner.json
  3. Add the first object from the profiles array found here to your existing profiles array, or just replace the entire file if you don't have other config.
  4. It should detect that file has changed in your log tab, and everything will work!

Hoooray!

@kbro237
Copy link

@kbro237 kbro237 commented Jun 13, 2017

I can also confirm those steps work! I didn't want the shift key, though, so I'm using this modification to the json which also works:

"to": [
	{
		"key_code": "left_option",
		"modifiers": [
			"left_command",
			"left_control"
		]
	}
]
@edubecks
Copy link

@edubecks edubecks commented Jun 13, 2017

I can confirm it too, thanks @wesbos
Im upgrading to sierra soon :D
I was only waiting for a functional karabiner

@jahamed
Copy link

@jahamed jahamed commented Jun 15, 2017

To those who want Caps Lock to be remapped to Hyper (ctrl, cmd, opt, shift) but also want Caps Lock to map to ESC when tapped (for vim especially) use @wesbos instructions with this modification:

"to": [
    {
        "key_code": "left_shift",
        "modifiers": [
            "left_command",
            "left_control",
            "left_option"
        ]
    }
],
"to_if_alone": [
    {
        "key_code": "escape"
    }
],
"type": "basic"
@oschrenk
Copy link

@oschrenk oschrenk commented Jun 15, 2017

For people with 0.91.3 who want to map

  • left_control to hyper and
  • caps_lock to left_control with other keys, and escape when alone
    can take a look at my config
@vitalybe
Copy link

@vitalybe vitalybe commented Jun 25, 2017

I've tried copying @jahamed snippet into my config but it didn't work for some reason. Here is the full working in case anyone is interested.

  • capslock to hyper
  • capslock by itself to escape

Config file

@cmsj
Copy link

@cmsj cmsj commented Jun 28, 2017

@ranmocy I think you can close this PR now. Thanks very much for writing the patch that kept so many of us going :)

@martinklepsch
Copy link

@martinklepsch martinklepsch commented Jun 28, 2017

I've been using hyper to quick-access commonly used apps, while this was missing from Karabiner Elements I've been using a mix of Karabiner Elements, Eikana and Hammerspoon...

In case anyone has the same situation, this is how I set up the Launcher key combinations with Hammerspoon:

-- Single keybinding for app launch
singleapps = {
  {'t', 'iTerm'},
  {'x', 'Google Chrome'},
  {'e', 'Emacs'},
  -- {'e', 'Atom'},
  {'c', 'Telegram'},
  {'s', 'Slack'},
  {'r', 'Riot'},
}

for i, app in ipairs(singleapps) do
   hs.hotkey.bind(
      {"cmd","alt","shift","ctrl"},
      app[1],
      nil,
      function() hs.application.launchOrFocus(app[2]); end)
end

hs.hotkey.bind(
   {"cmd","alt","shift","ctrl"},
   "i",
   nil,
   function() hs.execute("screencapture -i ~/Dropbox/screenshots/shot_`date '+%Y-%m-%d_%H-%M-%S'`.png"); end)

The Hammerspoon modal approach using F18 as quasi-modifier has been a bit wonky sometimes (getting me into the screenshot thing without me intending to take a screenshot) so I hope the plain modifier keys solution works more reliably. :) Finally thanks @tekezo for bringing back some Hyper to our lives :)

@vbauerster
Copy link

@vbauerster vbauerster commented Jun 30, 2017

I have solved sysdiagnose problem, by removing cmd from hyper. By the way sysdiagnose facility occupies not only . but , as well. So it is impossible to map anything to hyper + . or hyper + ,. Any idea how to disable sysdiagnose shortcuts?

@aurelberra
Copy link

@aurelberra aurelberra commented Jul 12, 2017

I also was able to do all I needed with the new complex modifications. This PR is no longer necessary, though it has been essential to me in the transition phase – many thanks to @ranmocy and all contributors!

@ranmocy
Copy link
Author

@ranmocy ranmocy commented Jul 14, 2017

Long live open source. Thanks everyone.

@ranmocy ranmocy closed this Jul 14, 2017
@dimitrieh
Copy link

@dimitrieh dimitrieh commented Jul 14, 2017

awesome!!

@andybergon
Copy link

@andybergon andybergon commented Oct 10, 2017

Why wasn't this merged in the end?
(I don't see the option in 11.1.2)

@cmsj
Copy link

@cmsj cmsj commented Oct 10, 2017

@andybergon KE can now natively do a Hyper key - see the Complex Modifications tab :)

@andybergon
Copy link

@andybergon andybergon commented Oct 10, 2017

Oh I see. It is one of the examples under the Complex Modifications tab!
I thought it was under Simple Modifications.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.