PowerToys icon indicating copy to clipboard operation
PowerToys copied to clipboard

[KBM] App-specific remapping for keys

Open kraoli opened this issue 5 years ago • 88 comments

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.

kraoli avatar Sep 21 '20 21:09 kraoli

@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?

arjunbalgovind avatar Sep 21 '20 22:09 arjunbalgovind

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

Nix644 avatar Sep 22 '20 01:09 Nix644

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

crutkas avatar Sep 22 '20 16:09 crutkas

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.

Nix644 avatar Sep 22 '20 16:09 Nix644

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

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

saahmedm avatar Sep 24 '20 16:09 saahmedm

@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!

Nix644 avatar Sep 24 '20 16:09 Nix644

@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?

saahmedm avatar Sep 24 '20 16:09 saahmedm

key remap for app only could be interesting.

crutkas avatar Sep 24 '20 20:09 crutkas

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).

kraoli avatar Sep 25 '20 18:09 kraoli

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.

phizch avatar Sep 29 '20 06:09 phizch

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

tkwa avatar Oct 06 '20 05:10 tkwa

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.

imlit avatar Nov 01 '20 00:11 imlit

what is the current roadmap for this?

winkelnp avatar Jan 01 '21 15:01 winkelnp

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

rbreaves avatar Jan 10 '21 00:01 rbreaves

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.

nmatt avatar Feb 02 '21 12:02 nmatt

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!!!

123tsoris123 avatar May 30 '21 20:05 123tsoris123

So what is the reason not to implement this feature?

WSebo avatar Aug 15 '21 13:08 WSebo

@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.

rbreaves avatar Aug 15 '21 17:08 rbreaves

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

rp1231 avatar Oct 25 '21 12:10 rp1231

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.

FilmForge3D avatar Nov 04 '21 23:11 FilmForge3D

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.

konero avatar Nov 09 '21 02:11 konero

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.

jaanli avatar Dec 20 '21 13:12 jaanli

@crutkas Why does this need a spec?

noraa-junker avatar Dec 24 '21 14:12 noraa-junker

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....

rzfzr avatar Dec 25 '21 16:12 rzfzr

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 `

Nix644 avatar Mar 15 '22 21:03 Nix644

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.

giwul70 avatar Mar 23 '22 04:03 giwul70

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.

Yamboy1 avatar Mar 31 '22 06:03 Yamboy1

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

giwul70 avatar Mar 31 '22 14:03 giwul70

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.

rbreaves avatar Mar 31 '22 16:03 rbreaves

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!

urbanrevo avatar Apr 09 '22 10:04 urbanrevo