Add windows key support for key bindings #21428

Closed
opened 2026-01-31 07:44:27 +00:00 by claunia · 6 comments
Owner

Originally created by @cktgh on GitHub (Mar 21, 2024).

(While there are similar issues I suppose this is not exactly a duplicate)

Please consider adding support for the Windows modifier key in key binding settings.
Right now only the other 3 modifier keys (Ctrl, Alt and Shift) is functional.

Originally created by @cktgh on GitHub (Mar 21, 2024). (While there are similar issues I suppose this is not exactly a duplicate) Please consider adding support for the Windows modifier key in key binding settings. Right now only the other 3 modifier keys (Ctrl, Alt and Shift) is functional.
Author
Owner

@zadjii-msft commented on GitHub (Mar 22, 2024):

I'm pretty sure we already do support win as a modifier?

Looks like we've supported that for like, 3 years now. What exactly are you trying/?

@zadjii-msft commented on GitHub (Mar 22, 2024): I'm pretty sure we already do support `win` as a modifier? * https://github.com/microsoft/terminal/blob/main/src/cascadia/TerminalControl/KeyChord.cpp#L19 * https://github.com/microsoft/terminal/pull/9783 Looks like we've supported that for like, 3 years now. What exactly are you trying/?
Author
Owner

@cktgh commented on GitHub (Mar 22, 2024):

Sorry for being unclear, I presumed that the windows key was not supported to begin with, because key presses on the windows key are not detected when modifying key bindings on the UI:
WindowsTerminal_vnB5PBO7sY

@cktgh commented on GitHub (Mar 22, 2024): Sorry for being unclear, I presumed that the windows key was not supported to begin with, because key presses on the windows key are not detected when modifying key bindings on the UI: ![WindowsTerminal_vnB5PBO7sY](https://github.com/microsoft/terminal/assets/136404740/fb2b1d39-b118-4d87-91e7-c202ce181b1d)
Author
Owner

@cktgh commented on GitHub (Mar 22, 2024):

Now that I looked into it, changing a key binding (that involves the window key) manually through editing the JSON occasionally works.

Code_7mFQeOxyd8
WindowsTerminal_DS0I6gkOuG

Here I noticed that changes to the key bindings is registered, yet it is non-functional if there is an existing binding using the same key combinations.
e.g. win+t is non-functional; win+n is functional.

EDIT:
I read the pull request you linked

So the list of valid combos is vanishingly small. It's all about that win+~

😢

@cktgh commented on GitHub (Mar 22, 2024): Now that I looked into it, changing a key binding (that involves the window key) manually through editing the JSON occasionally works. ![Code_7mFQeOxyd8](https://github.com/microsoft/terminal/assets/136404740/7800de30-c4c9-45a9-87ae-7e3bc7c1ae54) ![WindowsTerminal_DS0I6gkOuG](https://github.com/microsoft/terminal/assets/136404740/5b312323-5b47-49a8-a870-10e6b1b1c604) Here I noticed that changes to the key bindings is registered, yet it is non-functional **if there is an existing binding using the same key combinations**. e.g. `win+t` is non-functional; `win+n` is functional. EDIT: I read the pull request you linked > So the list of valid combos is vanishingly small. It's all about that win+~ 😢
Author
Owner

@cktgh commented on GitHub (Mar 22, 2024):

Terminal's distant cousin iTerm2 actually supports the equivalent of what I was trying to do pretty well 😅

To mitigate the issue I have written a script in AHKv2. Unfortunately this script doesn't work with the option "Hide Terminal in the notification area when it is minimized":

#Requires AutoHotkey v2.0

#T::toggleTerminal
!^T::launchTerminal

toggleTerminal(){
	if(ProcessExist("WindowsTerminal.exe")){
		hwnd := WinGetID("ahk_exe WindowsTerminal.exe")
		if(WinExist(hwnd)){
			WinActive(hwnd) ? WinMinimize(hwnd) : WinActivate(hwnd)
		}
	}
	else{
		launchTerminal()
	}
}

launchTerminal(){
	Run("wt -d D:\")
}

I hope this helps anyone else who have the same issue.

@cktgh commented on GitHub (Mar 22, 2024): Terminal's distant cousin [iTerm2](https://iterm2.com/) actually supports the equivalent of what I was trying to do pretty well 😅 To mitigate the issue I have written a script in AHKv2. Unfortunately this script doesn't work with the option "Hide Terminal in the notification area when it is minimized": ```ahk #Requires AutoHotkey v2.0 #T::toggleTerminal !^T::launchTerminal toggleTerminal(){ if(ProcessExist("WindowsTerminal.exe")){ hwnd := WinGetID("ahk_exe WindowsTerminal.exe") if(WinExist(hwnd)){ WinActive(hwnd) ? WinMinimize(hwnd) : WinActivate(hwnd) } } else{ launchTerminal() } } launchTerminal(){ Run("wt -d D:\") } ``` I hope this helps anyone else who have the same issue.
Author
Owner

@zadjii-msft commented on GitHub (Mar 22, 2024):

Yea, Win+T looks like it's not going to work in the Terminal directly, since that's a keyboard shortcut that's reserved by the OS for focusing the taskbar (at least, that's seemingly what it does on Windows 11).

Thanks for following up!

@zadjii-msft commented on GitHub (Mar 22, 2024): Yea, <kbd>Win+T</kbd> looks like it's not going to work in the Terminal directly, since that's a keyboard shortcut that's reserved by the OS for focusing the taskbar (at least, that's seemingly what it does on Windows 11). Thanks for following up!
Author
Owner

@cktgh commented on GitHub (Mar 22, 2024):

It would be nice if we could override the key binding reservation, it can definitely be done as demonstrated by AHK, even wiithout administrator rights

I don't think anyone takes "OS reseved windows key bindings" seriously;
WIN+CTRL+SHIFT+ALT+L opens Linklin in our default browser, so even the OS doesn't take it seriously 😂

@cktgh commented on GitHub (Mar 22, 2024): It would be nice if we could override the key binding reservation, it can definitely be done as demonstrated by AHK, even wiithout administrator rights I don't think anyone takes "OS reseved windows key bindings" seriously; WIN+CTRL+SHIFT+ALT+L opens Linklin in our default browser, so even the OS doesn't take it seriously 😂
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#21428