microsoft / PowerToys

Windows system utilities to maximize productivity
MIT License
110.65k stars 6.52k forks source link

[KBM] Triple modifier shortcuts #3936

Closed kenmanheimer closed 2 years ago

kenmanheimer commented 4 years ago

Crutkas: Mac has the shortcut Control + Shift + Command + 3 that capture screenshot and copy to clipboard instead of saving the file. If someone wanted to come over, this is a clear mapping that would need a triple modifier and is a common use case scenario.

Summary of the new feature/enhancement

In some common keyboard mapping styles, some fundamental cases require triple modifiers.

For instance, in Emacs keybindings (and little-known Mac optional bindings), Shift-Ctrl-Alt-f selects while moving forward by word-sized steps. Similarly but in the reverse direction with Shift-Ctrl-Alt-b. The current maximum of two modifiers prevents these and other common bindings.

(This is only a little less important than being able to make mappings between multiple and single keys, but I see in the FAQ for that providing that is already planned.)

Proposed technical implementation details (optional)

Allow more than two modifiers. (I haven't considered whether more than three might be needed.)

Alternately, it would suffice in these particular cases to provide for modal selection, like hitting Alt-space to "set a mark". Then any motion commands would extend the selection, until the selection is used or another key toggles selection mode off. (Autohotkey implements this kind of thing, but unfortunately motion actions that happen due to Keyboard Manager do not respect that mode, interrupting the selection process.)

smsisko commented 4 years ago

Please allow more than three, the Hyper (or Office) modifier is the combination of Ctrl-Shift-Alt-Win.

arjunbalgovind commented 3 years ago

@crutkas @enricogior we already have support for this in the backend, but the UI needs to be modified a bit so that it is possible to select up to 5 drop downs for each column. I believe the reason we stuck to max of 3 initially was to keep the UI simpler, and fitting 10 drop downs in a single line will most likely be impossible.

mousebyte commented 3 years ago

@arjunbalgovind I find that the shortcuts I want to remap most are the ones with 3 modifiers, since they're a pain to input. I haven't found much use for keyboard shortcut manager yet due to the 2-modifier restriction.

crutkas commented 3 years ago

@mousebyte, can you give us examples?

i-kosh commented 3 years ago

The only key on my keyboard I want to remap is MS Office (win+ctrl+alt+shift), would be nice if I could do that

bweavemcu commented 3 years ago

An example is GoToMyPC remote access app has a keyboard shortcut Ctrl+Win+Alt+Left/Right Arrow to quickly switch between multiple monitors. I'd like to configure PowerToys to remap my keyboard media Previous/Next Track buttons to do this shortcut combination when using that app.

crutkas commented 3 years ago

@enricogior famous last words but i think this may just be an int we set to restrict trip / quad modifiers in the KBM UX. Type control and the creation strip with the combo spots would be the two spots i could see it.

Should be straight forward. (once again, famous last words)

enricogior commented 3 years ago

@crutkas we need to to do some investigation to make sure.

PMExtra commented 3 years ago

@crutkas Another example, I'm a user of both Windows and macOS, I want to keep united shortcuts practice of them and I prefer the mac shortcuts. So I will map so many mac shortcuts to Windows, such as Win+C -> Ctrl+C. Then I will map the Capture Screen shortcut Win+Ctrl+Shift+3 -> PrintScr that need more than two modifier keys.

About the UI, I think we can make only one focus key that could be drop down. Any other keys should be shown as a linked label. And I strongly suggest make every map rule just be single line, the current UI is a lot mess that split the Type button in a separate row. We can also replace the Type button with an icon to cut size.

crutkas commented 3 years ago

@pmextra, on a mac, it is shift+command+3 for a screenshot, that doesn't require Windows key, just do Shift+Alt+3 mapped to Print screen. That would be the exact same mapping.

Why does WinKey have to be involved?

PMExtra commented 3 years ago

@crutkas First, I'm using mac keyboard, the WinKey is exactly CommandKey. Then, I mapped Shift + WinKey + 3 to WinKey + PrintScr that will saved screen shot to file. And mac has the shortcut Control + Shift + Command + 3 that capture screenshot and copy to clipboard instead of saving the file. It's just like only press PrintScr key in Windows. So I will map Win+Ctrl+Shift+3 to PrintScr.

crutkas commented 3 years ago

Lets take a step back, is this a VM on a mac? On a PC, from left to right, typically the keys are Ctrl, Win, Alt. That would put the Winkey in the Option key spot for a mac, Alt and Cmd like wise.

If you did PC to mac, most remaps would either do the Alt or Ctrl key for the Command Key.

However, you did just give us the use case for enabling triple modifiers, for a Mac to PC mapping.

PMExtra commented 3 years ago

@crutkas I have a PC and a Mac, them work together with Synergy. In short, I use a suit of keyboard and mouse that shared with PC and Mac. The keyboard is a mac keyboard (the keys from left to right are Control, Option, Command). In windows default, Control is Ctrl, Option is Alt, Command is Win. This is also my preferred. So I used to use AutoHotKey to remap keyboard shortcuts to unify the use practice. Now, I got PowerToys, I really like this powerful tool especially it's provided by Microsoft official. So I want to replace AutoHotKey with PowerToys, but I encountered this issue.

However, it's only an example that need more than 2 modifier keys. I think there are so many other use cases, so we don't need pay more attention about this example.

Enduriel commented 3 years ago

The funny thing is a good example of where this is useful is provided by you guys. The 'shortcut' for switching to a specific FanzyZone is ctrl+win+alt+0-9, which I don't plan on using. So I wanted to use Keyboard Manager to switch that shortcut to something more manageable but it turns out I can't because of this limitation.

Just thought it was a little amusing that you're asking for examples when they are in this very repo 😝

crutkas commented 3 years ago

Just thought it was a little amusing that you're asking for examples when they are in this very repo 😝

This question was proposed before we enabled that. It still is a valid question for prioritization.

dumblob commented 3 years ago

It's still a valid question because e.g. LeftShift + RightShift + Alt + h doesn't seem to work :cry:.

TuralAsgar commented 3 years ago

Please add this feature to UI, because it is very important for us

OliverDudgeon commented 2 years ago

Adding the message given "shortcuts can only have up to 2 modifier keys" to help others find this issue and raise more demand because this is really needed.

crutkas commented 2 years ago

I think this may just be a KBM editor tweak

crutkas commented 2 years ago

this will amplify https://github.com/microsoft/PowerToys/issues/8793

crutkas commented 2 years ago

Team decided UI work (rightly so) is needed also with this. This work will fix #8793 then.

jim-taylor-business commented 2 years ago

Please allow more than three, the Hyper (or Office) modifier is the combination of Ctrl-Shift-Alt-Win.

Yes please. I would like to remap the new Emoji Key that is a left Shift-Ctrl-Win-Alt Space combo.

crutkas commented 2 years ago

Big issue is this breaks the UX which made a small change into larger.

stuartleeks commented 2 years ago

What if this could be specified in the config but the UI rendered a readonly text description for >2 modifiers? Would something like that be an option?

jim-taylor-business commented 2 years ago

lots of UX ways of making room for the new modifiers but not a trivial change.

very keen on this change though. got quite excited when i saw crutkas was working on it 😁.

crutkas commented 2 years ago

Code works for enabling now. Issue is the UX. If people are ok with a broken UX, we could push it now. Then just file a issue knowing it won’t render correctly

I thought it would have been a few lines (it was) but the editor UX is pretty fixed sizing and is done in code vs xaml

Zettrex commented 2 years ago

let us set our own keybinds or a really large list of avalible keybinds

Arseni-Paharelau commented 2 years ago

Let me show you another good example of where this feature is useful if any is interested in...

I personally love the numpad to quickly work with the Calculator or type large numbers or phone numbers. But my laptop doesn't have the numpad and doesn't allow switching the right side of the keyboard to numbers (like some other laptops do).

So, for now I end up with the following solution implemented with the power of AutoHotkey:

Whenever I want the right side of my keyboard to switch to numbers and operators, I turn on CAPS Lock, then hold Left Shift and start typing the N M , . J K L U I O / ; P 8 9 keys which start converting to 0 1 2 3 4 5 6 7 8 9 . + - / * accordingly (feels like using the real numpad). Once I'm done, I stop holding Left Shift and turn off CAPS Lock.

The combination of CAPS Lock (turned on) + Left shift + some_key looks strange but it's quite convenient to use and it never overrides existing shortcuts of either Windows or apps environment.

I would be happy to implement this behavior via PowerToys once the feature is released. Thank you!

P.S. Just in case, sharing my AutoHotkey script to better explain what I mean:

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

#Singleinstance force

#If GetKeyState("CapsLock", "T")
<+m::Send,1
<+,::Send,2
<+.::Send,3
<+j::Send,4
<+k::Send,5
<+l::Send,6
<+u::Send,7
<+i::Send,8
<+o::Send,9
<+n::Send,0
<+/::Send,.
<+8::Send,/
<+9::Send,*
<+p::Send,-
<+`;::Send,{+}