Skip to content
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

[New PowerToy] Launch apps / command with keyboard shortcuts #3350

Closed
mxrsoon opened this issue May 20, 2020 · 61 comments
Closed

[New PowerToy] Launch apps / command with keyboard shortcuts #3350

mxrsoon opened this issue May 20, 2020 · 61 comments
Labels
Help Wanted We encourage anyone to jump in on these and submit a PR. Idea-New PowerToy Suggestion for a PowerToy Product-Keyboard Shortcut Manager Issues regarding Keyboard Shortcut Manager Resolution-Fix Committed Fix is checked in, but it might be 3-4 weeks until a release.

Comments

@mxrsoon
Copy link

mxrsoon commented May 20, 2020

Summary of the new feature/enhancement

Aside from being able to remap a keyboard shortcut to another one, it would be nice to assign shortcuts for opening applications. Example: Open Windows Terminal with CTRL+ALT+T.

Proposed technical implementation details (optional)

Keyboard Manager already has the things needed to listen to keyboard shortcuts. Run has what's needed to launch apps.

@qsypoq
Copy link

qsypoq commented May 20, 2020

Would be amazing if we can target files, allowing us to run applications but also things like scripts. 👍

@Satanarious
Copy link

Satanarious commented May 20, 2020

WinHotKey is worth taking a look at for inspirations.

@saahmedm saahmedm added the Product-Keyboard Shortcut Manager Issues regarding Keyboard Shortcut Manager label May 21, 2020
@saahmedm saahmedm added this to the Suggested Enhancements milestone May 21, 2020
@saahmedm saahmedm added the Idea-Enhancement New feature or request on an existing product label Jul 23, 2020
@capedghost
Copy link

Set global shortcuts for apps, folders, files, and websites, use shortcut to launch them.
For example:
Set Alt+J for Windows Terminal;
Set Alt+K for "D:\MyDocuments\Work";
Set Alt+L for "D:\MyDocuments\Knowledge.pdf";
Set Alt+; for "https://github.com".

@ffes
Copy link

ffes commented Aug 4, 2020

Without this feature the Keyboard Manager doesn't add much value for me.

In addition to the comment about, I would love to able to use these options:

  • Start any default app set in the Windows Settings. For instance Win+M to start your mail client and Win+B to start the browser.
  • Start any installed app found in the Start Menu. For instance Win+T to start Windows Terminal or Win+V to start Visual Studio 2019.
  • Start any exe/bat/ps1 somewhere on my disk or network. Useful for internal or development tools that are not really installed. For instance Win+R to start the docker-run.bat script I use for my current project or Win+O to start the internal Order Management tool.
  • Start the Explorer in any given directory, including network shares (incl \\wsl$ shares). For instance Win+P to open the project directory I'm currently working on.
  • Open a given document.
  • Open a given URL.

And allow me to remap default Win-key combination I never use. For example, right now Win+C starts Cortana and Win+G opens the Game bar. I never use them, so please let me remap these keys.

@mxrsoon
Copy link
Author

mxrsoon commented Aug 4, 2020

I think a more general case would be to launch URIs with keyboard shortcuts, since it allows any of the mentioned cases.

@Jay-o-Way
Copy link
Collaborator

Jay-o-Way commented Aug 30, 2020

You can give a .lnk shortcut (file) a keyboard shortcut in the Properties. When pressing a single letter, Windows places "Ctrl+Alt" in front of it bij default.
The Start menu is a good place to find common shortcut files. One downside (of this location) I noticed so far is that when a program updates, often these shortcut files get re-created, which mean you have to set this again. But hey, it works.

@mxrsoon
Copy link
Author

mxrsoon commented Aug 30, 2020

@Jay-o-Way, I tried it before, and then remapped the CTRL+ALT+<Key> shortcut using PowerToys. The biggest downside for me is that it has a huge delay (sometimes of 5 seconds on my computer) before opening the application, even without the remapping. It's not related to my computer's performance, as clicking the shortcut works instantly.

@chall3ng3r
Copy link

Same interface like remapping a shortcut, but instead create a new shortcut to launch a process or command or even just add an string to current open window, be it terminal window, notepad, Word, etc.

This can be implemented in following way:

  1. Set shortcut
  2. Select type dropdown:
    -- Process (browse to exe)
    -- cmd line
    -- Text string
  3. Input field for entering exe path / command line / text

@enricogior enricogior changed the title [Feature Request] Launch apps with keyboard shortcuts [KBM] Launch apps with keyboard shortcuts Jan 10, 2021
@microsoft microsoft deleted a comment from Satanarious Mar 9, 2021
@microsoft microsoft deleted a comment from Jay-o-Way Mar 9, 2021
@enricogior enricogior added Idea-New PowerToy Suggestion for a PowerToy and removed Idea-Enhancement New feature or request on an existing product Product-Keyboard Shortcut Manager Issues regarding Keyboard Shortcut Manager labels Mar 9, 2021
@enricogior enricogior changed the title [KBM] Launch apps with keyboard shortcuts [New PowerToy] Launch apps with keyboard shortcuts Mar 9, 2021
@htcfreek
Copy link
Collaborator

htcfreek commented Oct 29, 2023

@jefflord Is it correct that currently only win32 apps (Exe file) are supported?

Right now, yes. It's using CreateProcessW so, anything executable should work. If you need to run a script you can call the script host and pass the script file as an argument, e.g.:

C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -File "C:\Path\MyCoolScript.ps1"

If you are asking if you can "run" something like URL (launching its default app), right now, only like this:

cmd.exe /c start https://www.asdf.com

image

@jefflord
I was more thinking on starting uwp apps using the AUMID or something else. Or supporting protocols to do things like ms-edge:https://bing.com or ms-settings:bluetooth.

@jefflord
Copy link
Contributor

@htcfreek oh, that has not been considered. However it seems that since this works:

explorer.exe "ms-settings:bluetooth"

this works just fine also:
image

Also, thanks for the example because I thought you might be talking about Store Apps, which, in theory can be started with PowerShell, though you need to use "Get-StartApps" and know the tricks "https://stackoverflow.com/questions/68907012/how-to-open-installed-microsoft-store-apps-from-powershell"

So, I guess the answer is yes, because since there is a way to do anything from the command line, you can do that here. One thing that is planned to be added is to start the app "hidden", in case you need to use cmd or something and don't want a console to flash up.

@crutkas
Copy link
Member

crutkas commented Oct 30, 2023

@jefflord, i do want to call out, there are two active PRs that could conflict with this workflow.

#29399
#28473

@htcfreek
Copy link
Collaborator

htcfreek commented Nov 3, 2023

Needs label "Status In-progress".

@Jay-o-Way Jay-o-Way added the Status-In progress This issue or work-item is under development label Nov 5, 2023
@jefflord
Copy link
Contributor

jefflord commented Nov 5, 2023

Needs label "Status In-progress".

htcfreek agreed.

I will attach a draft PR also, after I get all the previous commits pull into my code. Also, I got busy and sick, but don't worry, I'll continue ASAP.

@happyTonakai
Copy link

Happy to hear the progress. Looking forward to the release!

@jefflord
Copy link
Contributor

jefflord commented Dec 3, 2023

Draft PR (#30121) is in

@jaimecbernardo
Copy link
Collaborator

This has been worked on during the 0.79.0 release cycle.
Please update to the latest: https://github.com/microsoft/PowerToys/releases

@joeldeteves
Copy link

This has been worked on during the 0.79.0 release cycle. Please update to the latest: https://github.com/microsoft/PowerToys/releases

Awesome!

@happyTonakai
Copy link

Hello everyone! Is it working for you? I've updated to 0.80 and neither running program nor opening url work for me. Win+A seems to be conflict with Windows default shortcut and the other two are not conflict with any existing shortcuts.

image

@jefflord
Copy link
Contributor

jefflord commented Apr 19, 2024

Certainly still works. And Win+a should be OK to use.

EDIT: Are you running in elevated mode? See: https://learn.microsoft.com/en-us/windows/powertoys/administrator
If you have foreground/focused elevated app, shortcuts might have issues unless PT is also elevated.

To test this I configured this:

image

To make sure I got an error, and I did:

image

You can open the log to see if anything interesting is there (you might need to restart PT to flush this):

%LOCALAPPDATA%\Microsoft\PowerToys\Keyboard Manager\Engine\Logs*v0.80.1**\log

@tristan-k
Copy link

I'm on PowerToys v0.83.0 but there is no option available to launch a app or run a executable. Is this feature even available?

@htcfreek
Copy link
Collaborator

htcfreek commented Aug 29, 2024

I'm on PowerToys v0.83.0 but there is no option available to launch a app or run a executable. Is this feature even available?

Yes. You find it in the module Keyboard Manager. There you can define keyboard shortcuts to open apps.

https://learn.microsoft.com/windows/powertoys/keyboard-manager#remap-a-shortcut-to-start-an-app

@joeldeteves
Copy link

I'm on PowerToys v0.83.0 but there is no option available to launch a app or run a executable. Is this feature even available?

Latest version has this feature yes.

I've tested it myself and it works great.

It's located under Keyboard Manager -> Remap a shortcut

@tristan-k
Copy link

Thanks! I must have missed the option because I was only looking in the Dashboard.

@jtpavlock
Copy link

jtpavlock commented Sep 19, 2024

Can this be used to execute a powershell command?

@jefflord
Copy link
Contributor

Can this be used to execute a powershell command?

Yes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Help Wanted We encourage anyone to jump in on these and submit a PR. Idea-New PowerToy Suggestion for a PowerToy Product-Keyboard Shortcut Manager Issues regarding Keyboard Shortcut Manager Resolution-Fix Committed Fix is checked in, but it might be 3-4 weeks until a release.
Projects
Status: ⚠️Needs Walkthrough
Development

No branches or pull requests