PowerToys icon indicating copy to clipboard operation
PowerToys copied to clipboard

[KBM] Add a hotkey key to turn it on/off

Open oxitran opened this issue 4 years ago • 13 comments

A way in which to easily toggle on and off the keyboard manager feature without having to leave fullscreen apps, specifically games.

A shortcut keybind that is resignable that would allow for the keyboard manager to be toggled on and off without the need to alt+tab out of games.

A resign-able shortcut key to toggle keyboard manager. This is for those of us out there who game, having an easy to access way to toggle the keyboard from alt setups to default qwerty for WASD would be great. At the moment I need to alt+tab and manually click the feature off and on and it is very cumbersome. I had a previous setup with a custom keyboard and portable keyboard layout, but there was always the odd app that would choose the wrong keyboard, so powertoys is better, but the toggle would be a huge help.

oxitran avatar Jul 08 '20 21:07 oxitran

Another option could be a right click context menu on the taskbar icon? Here just because I use the powertoy to switch L-WIN and L-ALT for a Mac keyboard.

StuartKent17 avatar Jul 13 '20 21:07 StuartKent17

Another option could be a right click context menu on the taskbar icon? Here just because I use the powertoy to switch L-WIN and L-ALT for a Mac keyboard.

I guess that would be fine for anyone who is not using an exclusive fullscreen app such as games.

oxitran avatar Jul 13 '20 22:07 oxitran

@crutkas, this wouldn't be very difficult to implement, but it might require us to always keep the KBM hook active (rather than unhooking on disable). We can't use a separate hook as we need to make sure the "Toggle shortcut/key" is unaffected by remaps.

arjunbalgovind avatar Oct 30 '20 20:10 arjunbalgovind

Any updates?

albertorm95 avatar Apr 30 '23 12:04 albertorm95

any updates ?

tcdongjun avatar Jun 02 '23 07:06 tcdongjun

Hello, I see that there are a lot of requests on this subject and that apparently things aren't progressing very well, so I was wondering if there might be a workaround. For example, modify a registry key to enable Keyboard manager and then automate the change. Or create a PowerToys launch shortcut with a launch option to enable or disable Keyboard manager. Or any other way you can think of. What do you think?

Ps : Sorry for my English, but I'm French

oOWestmalleOo avatar Jun 19 '23 16:06 oOWestmalleOo

please~

tcdongjun avatar Jun 30 '23 07:06 tcdongjun

It’s a real joke that the Keyboard Manager cannot be toggled on or off using keyboard shortcuts.

tcdongjun avatar Jun 30 '23 07:06 tcdongjun

Hi, any update on this? It's frustrating that i need to enable or disable the keyboard administrator with my mouse

Cheizr avatar Aug 20 '23 15:08 Cheizr

This look like a great solution for remapping keys in a game, but there HAS to be a fast way to toggle it on or of in case you need to just type some text, like chatting with a team mate.

Meukbox avatar Dec 10 '23 11:12 Meukbox

Please add this, It should be a shortcut keys of your choice to enable and disable the Keyboard Manager. There has been quite a few updates but this hasn't been added

Snipes89 avatar Dec 14 '23 04:12 Snipes89

Since there's now a "PowerToys" plugin in PowerToys Run, perhaps adding a toggle Keyboard Manager On/Off integration into that plugin would be useful and make a lot of people here happy.

For example, Win+Space to open PowerToys Run, type "@" to filter PowerToys options and select "Keyboard Manager" to toggle it on/off. This is quicker than opening PowerToys UI itself and going through the menus to toggle KBM.

I imagine that works around the issue of "keeping the kbm hook active" for a global hotkey.

peyao avatar Dec 15 '23 08:12 peyao

I did something like this as powershell script to toggle if the process is running or not, then just made a powershell icon on the desktop. Then you can probably keybind something to run that with autohotkeys:

`$km = Get-Process PowerToys.KeyboardManagerEngine

if ($km) { Stop-Process -Name PowerToys.KeyboardManagerEngine } else { Start-Process -FilePath 'C:\Users\USERNAME\AppData\Local\PowerToys\KeyboardManagerEngine\PowerToys.KeyboardManagerEngine.exe' }`

mattpang avatar Jan 15 '24 23:01 mattpang

I did something like this as powershell script to toggle if the process is running or not, then just made a powershell icon on the desktop. Then you can probably keybind something to run that with autohotkeys:

`$km = Get-Process PowerToys.KeyboardManagerEngine

if ($km) { Stop-Process -Name PowerToys.KeyboardManagerEngine } else { Start-Process -FilePath 'C:\Users\USERNAME\AppData\Local\PowerToys\KeyboardManagerEngine\PowerToys.KeyboardManagerEngine.exe' }`

Hi there, seems like this is the solution I have been waiting for, even tho I am not a developer I know basic coding, how can I run this script with power toys?

nuomation avatar Feb 06 '24 03:02 nuomation

I did not intend to learn so much about powershell today, but boy what an adventure. Here's my little script to toggle KBM + trigger notification to show whether its now on or off. At the bottom of this post I include instructions for using the script with a keyboard hotkey (no autohotkey).

thanks to @mattpang for getting me started here:

Did this on Windows 11, make sure your execution policy will allow you to run local scripts without signing. You can do that through the settings app here: image

Next, install BurntToast , which simplifies notifications from Powershell.

#  Install BurntToast for notifications
Install-Module -Name BurntToast

The script

$kbm = Get-Process PowerToys.KeyboardManagerEngine -ErrorAction SilentlyContinue

if ($kbm){
    Stop-Process -Name PowerToys.KeyboardManagerEngine
    New-BurntToastNotification -Text 'Powertoys Keyboard Manager DISABLED'
} else {
    Start-Process -FilePath 'C:\Program Files\PowerToys\KeyboardManagerEngine\PowerToys.KeyboardManagerEngine.exe'
    New-BurntToastNotification -Text 'Powertoys Keyboard Manager ENABLED'
}

Using with a keyboard shortcut:

Create a shortcut on your desktop (ugh...) From properties, set target to: pwsh -WindowStyle Hidden -file "C:\path\to\my\script.ps1" If you're using something older than powershell 7, replace pwsh with powershell.exe.

Set a shortcut key to whatever you want (I'm using Ctrl + Alt + K).

Then set the shortcut to "Run:"in Minimized window. This should stop a terminal window from opening up when you use the shortcut.

Using this confuses the Power Toys dashboard, it seems to lose track of whether or not KeyboardManager is running, but that hasn't been an issue so far.

SceptreData avatar Feb 11 '24 23:02 SceptreData

I appreciate the guide! Thanks a lot

nuomation avatar Mar 01 '24 14:03 nuomation

I did not intend to learn so much about powershell today, but boy what an adventure. Here's my little script to toggle KBM + trigger notification to show whether its now on or off. At the bottom of this post I include instructions for using the script with a keyboard hotkey (no autohotkey).

thanks to @mattpang for getting me started here:

Did this on Windows 11, make sure your execution policy will allow you to run local scripts without signing. You can do that through the settings app here: image

Next, install BurntToast , which simplifies notifications from Powershell.

#  Install BurntToast for notifications
Install-Module -Name BurntToast

The script

$kbm = Get-Process PowerToys.KeyboardManagerEngine -ErrorAction SilentlyContinue

if ($kbm){
    Stop-Process -Name PowerToys.KeyboardManagerEngine
    New-BurntToastNotification -Text 'Powertoys Keyboard Manager DISABLED'
} else {
    Start-Process -FilePath 'C:\Program Files\PowerToys\KeyboardManagerEngine\PowerToys.KeyboardManagerEngine.exe'
    New-BurntToastNotification -Text 'Powertoys Keyboard Manager ENABLED'
}

Using with a keyboard shortcut:

Create a shortcut on your desktop (ugh...) From properties, set target to: pwsh -WindowStyle Hidden -file "C:\path\to\my\script.ps1" If you're using something older than powershell 7, replace pwsh with powershell.exe.

Set a shortcut key to whatever you want (I'm using Ctrl + Alt + K).

Then set the shortcut to "Run:"in Minimized window. This should stop a terminal window from opening up when you use the shortcut.

Using this confuses the Power Toys dashboard, it seems to lose track of whether or not KeyboardManager is running, but that hasn't been an issue so far.

这个方法是可行的,但是有一点需要注意。Windows默认下是无法运行powershell脚本的,需要手动设置才行。按下win键,输入powershell,右键点击,以管理员身份运行powershell。输入set-executionpolicy remotesigned,接着输入y,然后就可以运行powershell脚本了。

mbybtjh avatar Apr 08 '24 05:04 mbybtjh