I would like to launch the Bash shell included with the Windows Subsystem for Linux (WSL) via a keyboard hotkey.
I recently learned it is possible to assign a keyboard hotkey for an application by assigning a key combination in the application's shortcut's properties dialogue box.
This works well for regular applications. For example I assigned the hotkey for a terminal app to ctrl+f11. Upon pressing the respective key combination the application launches.
Snip: working application's shortcut properties:
edit: The shortcut is located in the start menu folder
If I assign a hotkey to a shortcut I created for the Bash.exe file located at C:\Windows\System32\bash.exe the bash shell does not run upon pressing the assigned key combination as I had expected it to.
Snip: Bash.exe shortcut properties:
Edit: The shortcut is located in a sub directory on the D:\ Drive
I was wondering what the reason for this might be and if there might be some way to work around this limitation without installing third party apps such as "AutoHotKey".
Thanking you,
Answer
According to the Microsoft support website the behavior of shortcut hotkeys is described as such:
"Shortcut keys work only for shortcuts on the desktop or in the Start menu hierarchy"
Source: Shortcut key for shortcut does not work
It is stated that Shortcut hotkeys behave differently depending on where the shortcuts are located.
If the shortcut is located in the desktop folder or the start menu hierarchy ie
Windows\Start Menu,Windows\Start Menu\Programsthe hotkey will work to launch the respective application.If the shortcut is not located on the desktop or within the Start menu hierarchy, the hotkey will work to switch focus to the assigned application only if it is already running
Shortcut hotkeys are also described as not being able to work for certain programs such as items in the quick launch bar
In this case, bash.exe had a shortcut which was located in a sub directory on the D:\ Drive. This will not work as explained above.
Instead, by pinning the bash.exe to the start menu, a shortcut is created in the
C:\Users\ folder.
By applying the hotkey to that shortcut the bash shell is launching with its respective hotkey.


No comments:
Post a Comment