talonhub / community

Voice command set for Talon, community-supported.
MIT License
643 stars 783 forks source link

`app_name_overrides.windows.csv` not working with exe #511

Open timo95 opened 3 years ago

timo95 commented 3 years ago

For example with Slack (the csv contains lock, slack.exe). launch slack and focus slack work without problem, but lock doesn't:

launch lock is not recognized. It always results in similar sounding apps or none at all.

focus lock while Slack is running results in the following exception:

2021-07-27 11:51:21 ERROR     9:    talon\scripting\talon_script.py:590|
    8:    talon\scripting\talon_script.py:297|
    7:    talon\scripting\talon_script.py:557|
    6:         talon\scripting\actions.py:75 |
    5:           talon\scripting\types.py:366|
    4: user\knausj_talon\code\switcher.py:268| app = actions.user.get_running_app(name)
    3:         talon\scripting\actions.py:75 |
    2:           talon\scripting\types.py:366|
    1: user\knausj_talon\code\switcher.py:264| raise RuntimeError(f'App not running: "{name}"')
RuntimeError: App not running: "slack.exe"

Changing slack.exe to Slack fixes focus, but not launch.

These two are btw not needed anymore. They are recognized without the override:

pycharm, pycharm64.exe
webstorm, webstorm64.exe
knausj85 commented 3 years ago

v0.2 fixed some things related to the app name, so it's not usually the exe anymore.

I think supporting both exe and app name makes sense for Windows. This is a minor change to switcher.

Launch has never supported the overrides. Enumerating the list of applications was a real hassle on Windows; I didn't see a way to grab the exe path with the existing mechanism either.

Maybe some fresh eyes could find an option I missed here? Dragon also somehow launches apps without the start menu, which would be great too.

timo95 commented 3 years ago

I don't know if it contains all apps, but maybe you can parse the start menu shortcuts C:\ProgramData\Microsoft\Windows\Start Menu Each shortcut contains the path to the executable and a pretty name. It even includes necessary flags to launch it directly.

knausj85 commented 3 years ago

I believe I tried that one, and it missed a lot of apps. If we can get an IShellItem2 (https://docs.microsoft.com/en-us/windows/win32/api/shobjidl_core/nn-shobjidl_core-ishellitem2) in python, we may be able to do better