microsoft / PowerToys

Windows system utilities to maximize productivity
MIT License
106.15k stars 6.25k forks source link

[KBM] App-specific remapping for keys #6756

Open kraoli opened 3 years ago

kraoli commented 3 years ago

This one is really simple. Therefore only two sentences.

I want to use different key mapping for different programs. It would be great to be able to set a mappings per program.

arjunbalgovind commented 3 years ago

@kraoli we already have the feature to add shortcut remappings for specific programs. Is that what you are looking for or would you also like the ability to make key remappings for specific programs?

Nix644 commented 3 years ago

The ability to make key remappings for specific programs would be great.

crutkas commented 3 years ago

@nix644 / @kraoli, what is the scenario for remapping only a key for a targeted app instead of a shortcut.

Nix644 commented 3 years ago

As an example, If I have Google Chrome open and would like to Ctrl + Tab to switch between tabs quickly I can do that. The problem is, with an application like Discord that I use for work, hitting Ctrl + Tab opens a completely different Discord server entirely. So if I'm accidently clicked into that window without realizing it because I have to switch windows quite often, that happens instead of switching tabs.

Mapping the shortcut Ctrl + Tab to Tilde for example would be very helpful in resolving this issue. And from what I understand, I cannot do that currently.

saahmedm commented 3 years ago

@Nix644 Ctrl + Tab to Tilde can be done with the following mapping:

Ctrl + Tab -> Shift + ` (since this is how you access Tilde) image

Nix644 commented 3 years ago

@saahmedm Thank you for your reply. I had mentioned Tilde as the key I wanted to map to, but was being a bit lazy in giving the real name. I meant the "Grave" key, I was aware that since Tilde is accessed by Shift --> Grave, the request I had made would already be possible in that instance. Sorry for the confusion!

saahmedm commented 3 years ago

@nix644, no worries. It looks like you're trying to remap a key (Grave) to a shortcut (ctrl tab) and can't specify a specific application. I think this is def a reasonable use case. @crutkas wdy think?

crutkas commented 3 years ago

key remap for app only could be interesting.

kraoli commented 3 years ago

Sorry I messed up my reply. Had a double post and removed both. So once again.

@arjunbalgovind @crutkas

Basically I want to remap some keys and shortcuts in 3 specific programs. I want to have each setting active only when the program has the focus. So that you can switch program and get the individual mapping automatically for that program.

I have a game for example were I want to map the arrow keys to WASD, because it's not possible in this game. But I don't want that mapping outside of the game of course.

Or I have a program were I like to remap some shortcuts, but also functions that are on 'i' & 'o' keys for zooming in and out. Since these are no shortcuts, I can't do it. Or only globally, which you don't want. :)

Another example are my media keys on the keyboard. I want to remap them for each program as additional 'function key', because I don't need a start/stop/pause media button usually. These 3 keys are great to be mapped per program. And in many programs there not only shortcuts used to do things in this program (e.g. see above).

phizch commented 3 years ago

I also would like to remap keys in specific applications. My use case is Visual Studio. I use a Norwegian keyboard and brackets are inconvenient. ( is shift+8, ) is shift+9, { is alt Gr+7, } is alt Gr+0 [ is alt Gr+8, ] is alt Gr+9 < is down by left shift and > is shift+< / is shift+7 I use English exclusively in my code, even comments, so I have 3 Norwegian specific keys that I never use. In the top row after p we have å, and in the second row after l we have ø and æ. Being able to remap the keys to something more sensible would be a lifesaver. Of course I do need those keys when I write things other than code.

This might be a bit off topic, but I'd also like to be able to "switch" keys/key-combos. If I got a dollar for every time I've accidentally pressed F1 instead of ESC I'd be rich. I tried switching F1 and shift+F1, but I only ended up getting "help" for both. The problem is that I need to use Remap shortcuts for shift+F1 to F1 and Remap keys for F1 to shift+F1, and those sections doesn't seem to communicate very well. I assume it goes like this F1->Shift-F1->F1.
I tried mapping shift+b -> a with Remap shortcut, and a -> b and f1 -> shift+b with Remap keys.
Pressing F1 results in a, so it goes F1->shift+b->a.

tkwa commented 3 years ago

This would help me swap ; and \ keys in a LaTeX editor and considerably reduce my hand strain.

imlit commented 3 years ago

Yes, this would be great. As mentioned for outlook - the Ctrl-F to find makes more sense than forward. The shortcut remap in this case works. For outlook the send / receive short cut is F9. It would make more sense to if I could change that to F5, the standard refresh key.

winkelnp commented 3 years ago

what is the current roadmap for this?

rbreaves commented 3 years ago

Just to ensure a higher level concept isn't overlooked. Althought @kraoli does bring it up as well.

Assuming this is implemented to allow for grouping apps together, and not just individual apps. The json side of it could look like this in its implementation. As I discussed in #8016.

Instead of

"originalKeys":"92;160;40","newRemapKeys":"163;164;40","targetApp":"sublime_text.exe"
"originalKeys":"92;160;40","newRemapKeys":"163;164;40","targetApp":"code.exe"
"originalKeys":"92;160;40","newRemapKeys":"163;164;40","targetApp":"notepad.exe"

Make it

"originalKeys":"92;160;40","newRemapKeys":"163;164;40","targetApp":["sublime_text.exe","code.exe","notepad.exe"]

(of course UWP apps may be more complicated to map to as they won't have a unique .exe process to match with?)

Further examples of this in practice is my own remapping project Kinto.

My Terminal apps group is defined on line 10. The remaps for that group are fully defined on line 442. https://github.com/rbreaves/kinto/blob/master/linux/kinto.py

nmatt commented 3 years ago

My use case is that in MS Teams I'd like to map a single key to Ctrl+Shift+M (mute/unmute), for easier mute/unmute via keyboard. It is unclear why app-specific key-to-shortcut mappings are not available.

The way I would prefer this to work is like a shortcut with an empty set of modifiers. That is, if I map the key X to a shortcut, that would only affect X without modifiers; i.e., <Modifier>+X would not map to the shortcut. So maybe the "Shortcut must start with modifier key" restriction could simply be lifted, perhaps with a "Are you sure you want a no-modifier mapping?" confirmation.

123tsoris123 commented 3 years ago

Please make this happen, I am amazed how this cannot be a feature yet it should be SUPER easy being that it already exists for the shortcuts. Please please please it would make my work way faster!!!

WSebo commented 2 years ago

So what is the reason not to implement this feature?

rbreaves commented 2 years ago

@WSebo it's not closed so at some point I’d think someone would pick it up but imo it is a very important feature.

I laid out how I’d handle the json side of it by using targetApp as a filter & an array of app names - although an ID for an array of app names or group would work too.

Currently they’d have to enable a mechanism or service to track the current app name that has focus. Something they’re not currently doing I don’t imagine. AHK can & I implement this feature w/o Powertoys already in my Kinto.sh project but I very much have different & specific goals w/ kinto.

rp1231 commented 2 years ago

I'd also want to vote for this feature.

Would be useful to me as Photoshop shortcuts don't recognize the Alt Gr key, So I have to remap it to the left Alt key.

But I want that remapping to occur only for adobe applications and not globally.

Thanks

FilmForge3D commented 2 years ago

I would use this for working with the CAD software I have to use for uni. It uses a dot as a decimal marker but my German keyboard has a komma in the numberblock as it is the norm over here.

konero commented 2 years ago

I would use this in OpenToonz, it has hard coded hotkeys for F1, F2 and F3 for an important and often used feature, but my Microsoft Compact Designer keyboard combines media and F keys into one row, so I must hold the FN key to use the F keys, which is really uncomfortable.

I would like to remap them to something else just for this program.

Thanks.

jaanli commented 2 years ago

This would help with the issue that the 'remap a shortcut' tool in Keyboard Manager does not let you map a key like F2. So currently there is no way to create a shortcut such as F2 mapped to Ctrl + Tab per application.

Aaron-Junker commented 2 years ago

@crutkas Why does this need a spec?

rzfzr commented 2 years ago

This would help with the issue that the 'remap a shortcut' tool in Keyboard Manager does not let you map a key like F2. So currently there is no way to create a shortcut such as F2 mapped to Ctrl + Tab per application.

Exactly my usecase, I'm trying to remap F1 inside obsidian, it does not let me....

Nix644 commented 2 years ago

It seems it's only still possible to map a key to a shortcut for a specific application. I'd like to be able to map a shortcut to a key for a specific application. For example, I'd like Ctrl + Tab to become accessible by simply pressing `

giwul70 commented 2 years ago

I hope one, one day, it will be possible to remap a key per application, like with shortcuts. In my case, as illustrated in above 17154, I would like to remap the [Enter] to [Shift]-[Enter] within Outlook, so as to avoid the famous double line spacing when communicating with Gmail-users.

Yamboy1 commented 2 years ago

Is there any movement on this? This would be nice for games where i could remap my numpad keys to be specific controls in the games.

giwul70 commented 2 years ago

Yeah, am also anxiously waiting for this. Maybe it is impossible though. In some applications, the [Enter] results in a different behaviour.

rbreaves commented 2 years ago

It’s definitely not impossible. We can already do dynamic key remapping using Autohotkey & as the author of Kinto which uses that it works very well.

I already laid out a possible json config to set this up in a related thread but don’t have the time to work on actual implementation nor the knowledge w/ their programming language. What’ll get hairy though is remapping modifier keys like Win/Super I bet - most keys can be remapped fairly superficially, but not keys that the OS hooks into on a very low level.

urbanrevo commented 2 years ago

Any progress on this feature?

I use Sketchup and I do need to use remap of . to , to be faster typing dimentions with keyboard numpad. The problem is after closing Sketchup and going into Word, I need to use . as . and not as , As it stands, I need to disable the remap every time I need to use Word.

Please provide this option in your next update!

Kadigan commented 2 years ago

Is there any movement on this?

I use remote desktop to Macs a lot, and I need the OPTION key (which works very much like Windows and Control combined - so Opt+Space to launch stuff, Opt+Q to quit stuff, Opt+C to copy, Opt+V to paste etc. etc.), so you can imagine that it's a very important key. Under Windows the code is Fn or Menu (or something...) - which is on the far right, and even not present on some keyboards.

Being able to override Windows to what is essentially Option for specific apps (here, VNC type apps like NoMachine, RealVNC etc.) would allow me to use the remote Mac like I would when sitting at its physical terminal.

HunterxGithub commented 2 years ago

please add this. I wozuld love to have it all in this nice program instead of using another program just to remap keys for different apps.

chrisjigsaw commented 1 year ago

I'd like to +1 this, for this specific reason...

In Excel, I use the F2 key all the time, but sometimes accidentally hit the F1 key, which brings up their ever-annoying help window. I found a small fix for this years ago, but the problem with that is that it periodically stops working and I have to run it again. But today I discovered the KBM tool within PowerToys that almost does exactly what I need:

I need to remap F1 to F2 - but ONLY in Excel.

If the solution to this issue/thread is still a long ways off, does anyone have any alternate ideas to acheive that? Thanks!

fwextensions commented 1 year ago

Inspired by @rbreaves's JSON example above, I built a tool to make it easier to bulk edit shortcuts and to map a set of shortcuts to multiple apps, without having to recreate each one individually. It exports the Keyboard Manager JSON settings to more human-readable YAML, which you can then edit and import back into KM.

Unfortunately, it can't make KM magically support single-key mappings per app, but I figured people who want that would also want to manage lots of per-app shortcuts.

mtivi commented 1 year ago

+1 for this feature. My personal use case would be:

Currently it is possible to do this globally: image

It is not possible to limit the mapping to a specific application.

P-terroir commented 1 year ago

In my organization, it is common for people to have to enter a large amount of numerical data in one application. This data is entered into fields in a table like structure, with the tab key being used to move between them. We would like to have the ability to map the number pad '+' key to the tab key, as it makes entry significantly easier to be able to tab using the hand doing work.

Performing this mapping at the system level, though, makes the numpad '+' key unavailable in other applications where it's useful, such as Excel. The ability to make this mapping on an application level would solve this problem nicely.

Jaap-van-Hengstum commented 1 year ago

+1 for this feature. My personal use case would be:

  • In Windows Terminal, remap the caps lock key to escape.
  • In all other applications, disable the caps lock key.

It is not possible to limit the mapping to a specific application.

+1 also. Came here to report this specific use-case (mapping caps lock to escape only for some specific apps).

JVimes commented 1 year ago

My use case is mapping F5 to Ctrl+P for Unity game development (their IDE shortcut doesn't mesh well with the Visual Studio shortcut).

imlit commented 1 year ago

I have started to use autohotkey. It does application specific remapping very easily. Below is the contents of my.ahk file. Routes F5 to F9 when in outlook.

IfWinActive, ahk_exe outlook.exe

F5::F9

nmatt commented 1 year ago

I second imlit's suggestion to use AutoHotKey instead. This issue has been open for over two years. It's an obvious feature that should be straightforward to implement, given the already existing functionality, but it's not on the roadmap (https://github.com/microsoft/PowerToys/wiki/Roadmap) and thus seems unlikely to get implemented in the forseeable future.

francescoboc commented 1 year ago

+1 Also very interested in this. Personally, I would use it to remap F11 to Alt + Enter when using the command prompt (terminal), so that I can enter/exit fullscreen mode with the usual keymapping that is used by most of other applications.

Intuos5 commented 1 year ago

I would also love to see this implemented. My use case is to set Caps-Lock to Shift+Tab in Blender, to get to the mode change pie menu. And I may want it to do other things in other applications. But, I want to retain Caps -Lock for typing as default for programs that don't have a Caps-Lock override. The same applies to AltGr, I want to map it to Alt, except for the Affinity suite, where I can use the button to resize a brush (to activate the hard-coded shortcut Ctrl+Alt).

Ykulvaarlck commented 1 year ago

i thought i could add my own personal use case: remapping tab to escape, but only on terminals/on vim

mattenz commented 1 year ago

My use case for this would be gaming. I often bump the left Windows key and if I'm playing the game in a window, this will move focus to the start menu which is not ideal. I've currently just remapped the left Windows key to Scroll Lock system wide but it would be great if I could set that only for the games I play.

7merlin commented 1 year ago

+1.

My use case is maybe unusual. I like to use Mac OS keyboards and re-map Win to Cntrl and vice versa, but I don't want this in games (in fact in games I want Win key to do nothing).

crutkas commented 1 year ago

We do not recommend using KBM for games with how we implemented our solution

TheMasterDingo commented 1 year ago

I use F13 as a push to talk button for games. I have it bound to one of my mouse extra buttons. Some games do not support F13-F24 buttons so it would be nice to map a specific key to another for a specific program/app

finjastiepermann commented 1 year ago

@kraoli we already have the feature to add shortcut remappings for specific programs. Is that what you are looking for or would you also like the ability to make key remappings for specific programs?

well for example, since my 1,q,a and y keys dont work on my laptop i'd like to remap w,a,s,d for games that don't let me change keybindings

Breit commented 1 year ago

@kraoli we already have the feature to add shortcut remappings for specific programs. Is that what you are looking for or would you also like the ability to make key remappings for specific programs?

well for example, since my 1,q,a and y keys dont work on my laptop i'd like to remap w,a,s,d for games that don't let me change keybindings

Well, that's an unusual use case. I'd suggest replacing your keyboard then. ;)

finjastiepermann commented 1 year ago

Not that easy it's a pretty integrated model. Usually i use an external keyboard but this is a simple workaround that i'd like to have available when i don't have one at hand

Gesendet von Outlook für Androidhttps://aka.ms/AAb9ysg