-
Notifications
You must be signed in to change notification settings - Fork 6.3k
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
Use only Win key for PowerToys Run #5571
Comments
for anyone who wants this now, you can remap the Win key to something like ctrl+space in the Keyboard Manager and set the PowerToys Run hotkey to ctrl+space |
When PT Run is mature enough, this might actually not be such a bad idea. |
tracked in #4203 |
Unfortunately this will break all shortcuts that depend on the Windows key. |
I solved with new PowerToys utility "keyboard manager" and remap "WinKey (Left)" to "Alt(Left)+Space" - the default shortcut for powertoys run - For me, it's amazing !!! :) |
If you want to keep Win Key hotkeys (such as ;-----------------------------------------;
; Winkey PowerToys Run ;
;-----------------------------------------;
; Variables
replaceStartMenu := true
; Use replacement Start Menu, or activate Start Menu
LWin Up::
if (replaceStartMenu)
if (A_PriorKey = "LWin") ; A_PriorKey is the key that was last pressed
send {LWin Down}{Space Down}{LWin Up}{Space Up}
else
return
else
send {LWin}
return
return
; Toggle Start Menu Replacement, also allows Win Key Hotkeys to work
LWin & Space::
If replaceStartMenu
replaceStartMenu := false
else
replaceStartMenu := true
return
return Making |
None of the mentioned method works well. The best option is to modify the source code to hook the windows key it self. |
@modaresimr Were you able to modify the source code to hook the windows key, and if so, could you show/tell how so I can also do it? |
@atimeofday I will send it when i found some free time.
|
SummaryYou actually can map the windows key to Powertoys Run. Its a bit of a complicated process, but you can do it in the end. You need to install version 0.37.2 of powertoys, then map a key. Process
Final Product |
@npxrc, if you do that, what happens when you press WIN+E, for example, to open the Explorer? What would be great is to have PowerToys Run on WIN key up, but keep every native shortcut that's made with WIN key. |
@npxrc That isn't a working solution nor acceptable workaround. Re-mapping Win key will break every single shortcut that relies on Win key (Win + Tab, Win + E, Win + I, Win + X). It actually breaks more stuff than it fixes.
Bold statement considering it is coming from person who doesn't bother to even read like five comments below this issue. |
@DarthJahus @jantajov Not quite sure what you're talking about. They still work perfectly fine when you press the combos.
(@jantajov) btw i was killing two birds with one stone or whatever by doing two replies in one, the bottom half doesnt apply to darthjahus |
@npxrc So the important part is to use version 0.37.2 for your solution? What changes in later versions make the workaround not working anymore? FYI: I have a working solution with AutoHotkey (AHK).
#NoTrayIcon
;-----------------------------------------;
; Winkey PowerToys Run ;
;-----------------------------------------;
; Use PowerToysRun as replacement for Start Menu
LWin Up::
Process, Exist, PowerToys.PowerLauncher.exe
if (ErrorLevel == 0) ; PTRun not running
send {LWin}
else ; PTRun is running
if (A_PriorKey = "LWin") ; A_PriorKey is the key that was last pressed
send {LWin Down}{Space Down}{LWin Up}{Space Up}
return
; Important: Allows Win Key Hotkeys to work
LWin & Space::
return Remarks:
|
@modaresimr and @daniel-richter work really great, unless you have a second language/keyboard setup on windows, since LWin + Space changes that layout, I did a small change
I still have a few problems, because, after a while, some other shortcuts(that I added via Keyboard manager and use the LWin key) stop working
Still trying to figure out what causes that. |
@daniel-richter The issue is that when you try to map the windows key to anything really, it says "some of the commands you tried to map couldn't be mapped". If this was fixed in a recent update, then ignore the entire spiel that I had with my lil' tutorial, but it didn't work the last time i tried. |
Came here for an answer but unfortunately found none. I just replaced the windows+S shortcut with this, since win+s opens the start menu search anyways so this is a good drop-in replacement. I would love to be able to just hit the windows key itself in its stead, though. |
Its possible with AHK, however in a few occasions(more than I would like) the shortcuts get unresponsive, or a key is kept pressed ... either way would be great to have this build-in on powertoys itself, for sure! |
I was having the same problem, I believe it's because it's technically going: Down, Up, Down Up... in an infinite loop. I added to @daniel-richter's AHK script and I believe I was able to catch that. #SingleInstance, Force
#NoTrayIcon
SendMode Input
;-----------------------------------------;
; Winkey PowerToys Run ;
;-----------------------------------------;
; Use PowerToysRun as a replacement for Start Menu
*LWin::SendInput, {Blind}{vk00}{Lwin Down} ; Added {Blind} so it doesn't force release keys to push down, just a safety precaution
Return
*LWin Up::
if (A_PriorKey = "LWin") { ;A_PriorKey is the key that was last pressed
Process, Exist, PowerToys.PowerLauncher.exe ;Checks if PowerRun is alive
if (ErrorLevel == 0){ ;PTRun not running
SendInput {Blind}{vk00}{LWin}
SendInput {Blind}{vk00}{LWin Up}
} else { ;PTRun is running
SendInput {vk00}{LWin Down}{Space Down}{vk00}{LWin Up}{Space Up} ; Launch PowerRun
SendInput, {vk00}{LWin Up}
}
} else {
if GetKeyState("LWin" "P") {
SendInput, {Blind}{vk00}{Lwin Down} ; If user still pressing win, stay down
} Else {
SendInput, {Blind}{vk00}{Lwin Up} ; Else, the release adds a null({vk00}) key to prevent the start menu from opening.
}
}
Return
; Important: Allows Win Key Hotkeys to work
LWin & Space::
Return
; Can remove the below, just a few extra touches I added for myself
#s:: SendInput {LWin Down}{vk00}{Space Down}{vk00}{LWin Up}{Space Up} ; Opens PowerRun when win+s
Return
#IfWinActive ahk_exe PowerToys.PowerLauncher.exe ; Check to see if PowerRun is the active window
{
; While in PowerRun
::vs::
SendInput,{TEXT} .Vis ; vs -> .Vis | for vs code("Visual Studio Code" in PowerRun), . is to search through programs
Return
Tab::SendInput, {Down} ; Tab -> ↓ | To tab through options, rather than going through the
#w::SendInput, {Up} ; Win + W -> ↑ | to move up through options
#s::SendInput, {Down} ; Win + S -> ↓ | to move down through options
; To prevent a miss click of win, I know I mess that up a lot
!w::SendInput, {Up} ; Alt + W -> ↑ | to move up through options
!s::SendInput, {Down} ; Alt + S -> ↓ | to move down through options
}
|
There's one thing I'm wondering, because in Open-Shell you can choose to have the Windows key do nothing (or open the custom menu). https://github.com/Open-Shell/Open-Shell-Menu/blob/master/Src/StartMenu/StartMenu.cpp |
Here's a simple solution with AHK: #NoEnv
SendMode Input
~LWin & F1::return ; Make LWin a prefix key (https://www.autohotkey.com/docs/v2/Hotkeys.htm#prefix)
LWin::^!+F24 Line 4 makes LWin a prefix key, which means that other existing bindings will still work as expected. You will have to check "Use centralized keyboard hook" in the Powertoys Run configuration. You can then start the script and change the activation shortcut. I am using Ctrl+Shift+Alt+F24 because that's very unlikely to interfere with any other shortcuts. |
This works so well omg |
+1 works very well. For most people, if you don't have F24 to map your PowerToys Run, just change the F24 to F5 and it works beautifully |
The prefix key method by @xieve forces the Set your shortcut as ~LWin::F12 If you want to avoid using "open_powerlauncher": {
"win": true,
"ctrl": false,
"alt": false,
"shift": false,
"code": 135,
"key": ""
}, where code 135 is |
The above Autohotkey methods either suffer from impaired ability on win combo, or over-sensitivity when it's not intended (e.g. when pressing Win+V) import keyboard
class LWRemapper():
def __init__(self) -> None:
self.last_press_e = None
keyboard.on_press(self.handle_press)
keyboard.on_release_key('left windows', self.handle_lw_release, True)
keyboard.wait()
def handle_press(self, e: keyboard.KeyboardEvent) -> None:
self.last_press_e = e
def handle_lw_release(self, e: keyboard.KeyboardEvent) -> None:
if self.last_press_e.name == 'left windows':
keyboard.send('f12')
keyboard.release('left windows')
LWRemapper() A c++ solution is provided here https://github.com/mkmark/lwin-remapper/releases/tag/v1.0.0. |
I actually use this for a long time and it works perfectly fine. Here is what I've done:
|
So, ironically, the solution to this problem is actually in this thread. No AHK or Python needed. So, we use part of mkmark's answer. Editing ~\AppData\Local\Microsoft\PowerToys\PowerToys Run\settings.json
But we set it to code 91 (code 91 being the Windows key), then save it. Now, this kinda works, but the Windows menu pops up, closing it instantly. We then use the program oddkms mentions, that being https://github.com/Open-Shell/Open-Shell-Menu so, install that, and during install, all you can disable the parts other than the shell menu part. Then, once it launches, skip start menu style, go to basic settings, and set Windows key opens to nothing. If you want to use the regular Windows launcher, when you click on the symbol, set left click opens to Windows start menu. Using this method, all Windows-based hotkeys still work, and I don't really see a downside to it other than having to install OpenShell. Hope it helps. |
@Echo-Head-Wall's solution works great. The only problem is that PowerToys Run shows on |
hmmm yeah seems like they do that because they expect it to be a multi key anyways and feels snappier. at least once you finish the hotkey combo like win + r or win + e it goes away. i was looking at invoking it directly via openshells custom command call to see if thats on release but i cant seem to get the exe to actually open it which makes sense. i guess that is one downside to this solution |
I don't remember where I found this, but I have been using it for a long time and it works great. No opening of the start menu, and stuff like Win + E still work. It maps the Win key to ctrl + shift + space, which is then set as shortcut in PowerToys Run. The only thing I haven't figured out is how to make it work as well with Autohotkey V2, but using V1 it works like a charm. LWin:: Send, ^+{space}
;~ #w::SoundBeep
<#w::SoundBeep
;~ LWin & w::SoundBeep |
Would do this but wouldnt that break all the windows shortcuts (ex. Win+D to Desktop, or WinShiftS for Snip)? |
I found a solution similar to @Echo-Head-Wall's, without the need to install OpenShell. Run window still momentarily pops up when using meta shortcuts.
All shortcuts using meta modifier seem to work, including ctrl+meta+arrows to switch virtual desktops. |
this work for me although i cant get windows key shortcuts to work for example win + 1 to open the first app pinned to my taskbar |
Win + "J" isn't ideal placeholder and some shortcuts do not work. I tried others but settled on a reserved keycode (for example VK 252) instead of "J". Configure the shortcuts in keyboard manager gui and edit ~\AppData\Local\Microsoft\PowerToys\PowerToys Run\settings.json:
|
What’s the benefit is using VK 252 over win + j?
…On Sun, Apr 14, 2024 at 6:33 AM, ladislavkrivy ***@***.***(mailto:On Sun, Apr 14, 2024 at 6:33 AM, ladislavkrivy <<a href=)> wrote:
Win + "J" isn't ideal placeholder. I tried others but settled on a reserved keycode (for example VK 252) instead of "J". Configure the shortcuts in keyboard manager gui and edit ~\AppData\Local\Microsoft\PowerToys\PowerToys Run\settings.json:
"open_powerlauncher": {
"win": true,
"ctrl": false,
"alt": false,
"shift": false,
"code": 252,
"key": ""
},
—
Reply to this email directly, [view it on GitHub](#5571 (comment)), or [unsubscribe](https://github.com/notifications/unsubscribe-auth/A3H6HE2TDNRQCV2RKNRPDYDY5JLQ3AVCNFSM4PT5HQ4KU5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TEMBVGQYDAMJUG42A).
You are receiving this because you commented.Message ID: ***@***.***>
|
Probably avoids some shortcut conflict. With Win + J, some windows shortcuts did work for me (like Win + E) but Ctrl + Win + arrowkeys did not. With Win + VK 252, all shortcuts seem to work. Only annoyance is the powertoys run menu activating on keydown along with other shortcut. |
this fixed the issue for me. for anyone curious, after editing the json file and restarting powertoys this should be in your settings for Remap a Key in the Keyboard Manager of Powertoys (VK 252 is the last option in the drop down menu) |
Is it possible to bind to Win key – only when its I want to have other win-shortcuts to work without triggering any windows. |
#Requires AutoHotkey v2.0
LWin & R::Send "#r"
LWin Up::Send "!{Space}"
|
it would be great if the Win key (by itself) could be added as a shortcut for PowerToys Run, I know I have no reason to use the standard popup pane any more.
If you'd like to see this feature implemented, add a 👍 reaction to this post.
The text was updated successfully, but these errors were encountered: