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

Added voice command to create Talon application context #1242

Merged
merged 12 commits into from
Sep 2, 2023
Merged

Added voice command to create Talon application context #1242

merged 12 commits into from
Sep 2, 2023

Conversation

AndreasArvidsson
Copy link
Collaborator

@AndreasArvidsson AndreasArvidsson commented Aug 4, 2023

"talon create app context" will generate a new folder in apps with a Talon and a python file.

Example from visual studio code:

apps/visual_studio_code/visual_studio_code.talon

app: visual_studio_code
-

apps/visual_studio_code/visual_studio_code.py

from talon import Module, Context, actions

mod = Module()
ctx = Context()

mod.apps.visual_studio_code = r"""
os: windows
and app.exe: Code.exe
"""

ctx.matches = r"""
os: windows
app: visual_studio_code
"""

# @mod.action_class
# class Actions:

@nriley
Copy link
Collaborator

nriley commented Aug 4, 2023

Would recommend you create platform-specific .py/.talon files by default (e.g., visual_studio_code_win.py/talon). Some of us use Talon on more than one platform…

@AndreasArvidsson
Copy link
Collaborator Author

Is that standard for community now? When I look in the applications folder it's quite rare.

@nriley
Copy link
Collaborator

nriley commented Aug 4, 2023

It's a standard we discussed when we did our last rearrangement. Since keyboard commands usually differ between platforms, my feeling is that if you're using this feature, you may not be an advanced user enough to be able to build a cross-platform implementation. So it's better for the defaults to be "safe" even if the generated file names are a bit more verbose.

@AndreasArvidsson
Copy link
Collaborator Author

Sounds reasonable

@AndreasArvidsson
Copy link
Collaborator Author

@nriley Better?

@nriley
Copy link
Collaborator

nriley commented Aug 4, 2023

I'd recommend adding the platform suffix to the .talon file and the app: as well.

Also — if you're not watching the log, it doesn't seem like anything happens when I use this command. Perhaps consider opening the directory in the user's file browser, or at the least popping up a notification?

@AndreasArvidsson
Copy link
Collaborator Author

I don't think it makes sense to have a talon file per os for a single app. Maybe We can talk about this in tomorrow's meetup?

@nriley
Copy link
Collaborator

nriley commented Aug 4, 2023

Yeah, again that seems good as an ideal but not sure if appropriate for a beginning user who may not be comfortable with Python and the "make everything an action" style of implementation. Definitely we should talk about it — might even want to be a setting (argh!)

@AndreasArvidsson
Copy link
Collaborator Author

@nriley In today's meetup we decided to make the platform name an optional word in the spoken phrase. The current implementation just repeats the command I would prefer to have a list(user.platform) instead. What do people think?

plugin/talon_helpers/create_app_context.py Outdated Show resolved Hide resolved
@nriley nriley merged commit 9fafdc1 into talonhub:main Sep 2, 2023
1 check passed
@AndreasArvidsson AndreasArvidsson deleted the app_context branch November 12, 2023 06:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants