talonhub / community

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

FEATURE: modular structure for adding APPS into TalonVoice framework #129

Closed auphofBSF closed 4 years ago

auphofBSF commented 4 years ago

The app folder structure as refactored by @knausj85 in bba1b56 for VSCODE is a step in the right direction for maintainability and extending. 🥇 updated from discussions below

app
  /<MYAPP>
            <MYAPP>.<OS>.talon  (implementation code - where <OS> is linux | mac | win)
            <MYAPP>.py (talon support python code for MYAPP)
            <MYAPP>.talon (Voice Commands for  MYAPP)

I still believe platform differences could be managed in 1 file, reducing the amount of duplicate work in building support for a cross platform app. This will however need extending the talon syntax to enable a line in the talon file to apply or be exempt from a specific platform context.

Additionally, the support, maintenance and monolithic nature of where this repository is heading should at some point be considered. It seems a huge task for this one repo to hold all commands for all conceivable applications. . It is also conceivable a user does not want a blotted command set but wants to pick and choose modules. The above structure that was introduced is in my opinion a great step forward. Together with some guidelines it will enable building on top of the great work the core of this repository has introduced with the awesome TalonVoice by @lunixbochs

my intent with this issue is a place holder FEATURE discussion around appropriate structuring

knausj85 commented 4 years ago

Long term, I believe the plan is a package management/plugin system in talon of some sort, so starting from a huge repository like this won’t be a thing, fwiw.

I’ll definitely consolidate Talon files where possible if/when that’s implemented.

I won’t accept all PRs; I am more likely to accept PRs for more specific contexts. The less specific the context, the more selective I’ll be.

I generally prefer a flatter folder structure. vscode is probably the direction I’ll slowly move things. I’d like to get rid of the platform subfolders, but that can probably wait until the consolidation.

WIP.

lunixbochs commented 4 years ago

why app/vscode/mac/vscode.talon instead of app/vscode/mac.talon

knausj85 commented 4 years ago

so searching for vscode finds everything vscode-related in most any app

the other option was apps/vscode/vscode.mac.talon apps/vscode/vscode.linux.talon apps/vscode/vscode.win.talon apps/vscode/vscode.talon

which is reasonable. can't remember why I didn't go this way now. :-/

auphofBSF commented 4 years ago

I agree with flatter the better apps/vscode/vscode.mac.talon, is a further good move. if no other immediate suggestions I can modify PR #128 to this as a trial ?

knausj85 commented 4 years ago

works for me

fidgetingbits commented 4 years ago

so searching for vscode finds everything vscode-related in most any app

the other option was apps/vscode/vscode.mac.talon apps/vscode/vscode.linux.talon apps/vscode/vscode.win.talon apps/vscode/vscode.talon

fwiw i think I also prefer the quoted layout over os-specific sub-folders for each app.

i also like the move towards relevant .py files into the given apps folder, ex apps/vim/vim.py instead of planting everything in code/ which used to be done? (or at least it what I've been doing).

knausj85 commented 4 years ago

yeah, i moved the relevant .py for vscode into apps/vscode too, so that's where we're headed.

fidgetingbits commented 4 years ago

Just mentioning this here, since it's technically part of the move towards a new structure. Moving vim.py to apps/vim/vim.py seems to result in errors about all the methods used in the .talon file not being defined:

10009 2020-06-05 17:06:07    IO EMIT ['split', 'right']                                                                                                                       
10010 2020-06-05 17:06:07    IO COMPILING                                                                                                                                     
10011 2020-06-05 17:06:07    IO dfa rules built in 0.101s                                                                                                                     
10012 2020-06-05 17:06:07    IO Rule not found: user.vim_surround_targets                                                                                                     
10013 2020-06-05 17:06:07    IO Rule not found: user.vim_text_objects                                                                                                         
10014 2020-06-05 17:06:07    IO Rule not found: user.vim_motions_all_adjust                                                                                                   
10015 2020-06-05 17:06:07    IO Rule not found: user.vim_unranged_surround_text_objects                                                                                       
10016 2020-06-05 17:06:07    IO Rule not found: user.vim_surround_targets                                                                                                     
10017 2020-06-05 17:06:07    IO Rule not found: user.vim_surround_targets                                                                                                     
10018 2020-06-05 17:06:07    IO Rule not found: user.vim_surround_targets                                                                                                     
10019 2020-06-05 17:06:07    IO Rule not found: user.vim_surround_targets                                                                                                     
10020 2020-06-05 17:06:07    IO Rule not found: user.vim_arrow                                                                                                                
10021 2020-06-05 17:06:07    IO Rule not found: user.vim_normal_counted_motion_command                                                                                        
10022 2020-06-05 17:06:07    IO Rule not found: user.vim_motions_all_adjust                                                                                                   
10023 2020-06-05 17:06:07    IO Rule not found: user.vim_normal_counted_action                                                                                                
10024 2020-06-05 17:06:07    IO Rule not found: user.vim_arrow                                                                                                                
10025 2020-06-05 17:06:07    IO Rule not found: user.vim_select_motion                                                                                                        
10026 2020-06-05 17:06:07    IO dfa rules linked 0.149s                                                                                                                       
10027 2020-06-05 17:06:08    IO minimize + cfg in 1.069s   

Though I confirm that it seems to load the vim.py at startup. I guess will be something to fix before we fully move stuff out of code/, guessing that's something that has to be fixed in talon maybe?

knausj85 commented 4 years ago

Edit: scratch this, that looks like something else. I'd run that one by aegis.

@fidgetingbits - I believe Talon loads things alphabetically, so that's probably what you're running into.

e.g., the apps folder loads like this

C:\Users\ruhroh\AppData\Roaming\talon\user\knausj_talon\apps\file_manager.talon
C:\Users\ruhroh\AppData\Roaming\talon\user\knausj_talon\apps\generic_browser.talon
...
C:\Users\ruhroh\AppData\Roaming\talon\user\knausj_talon\apps\linux\firefox.talon
...
C:\Users\ruhroh\AppData\Roaming\talon\user\knausj_talon\apps\mac\app.talon
knausj85 commented 4 years ago

Just mentioning this here, since it's technically part of the move towards a new structure. Moving vim.py to apps/vim/vim.py seems to result in errors about all the methods used in the .talon file not being defined:

10009 2020-06-05 17:06:07    IO EMIT ['split', 'right']                                                                                                                       
10010 2020-06-05 17:06:07    IO COMPILING                                                                                                                                     
10011 2020-06-05 17:06:07    IO dfa rules built in 0.101s                                                                                                                     
10012 2020-06-05 17:06:07    IO Rule not found: user.vim_surround_targets                                                                                                     
10013 2020-06-05 17:06:07    IO Rule not found: user.vim_text_objects                                                                                                         
10014 2020-06-05 17:06:07    IO Rule not found: user.vim_motions_all_adjust                                                                                                   
10015 2020-06-05 17:06:07    IO Rule not found: user.vim_unranged_surround_text_objects                                                                                       
10016 2020-06-05 17:06:07    IO Rule not found: user.vim_surround_targets                                                                                                     
10017 2020-06-05 17:06:07    IO Rule not found: user.vim_surround_targets                                                                                                     
10018 2020-06-05 17:06:07    IO Rule not found: user.vim_surround_targets                                                                                                     
10019 2020-06-05 17:06:07    IO Rule not found: user.vim_surround_targets                                                                                                     
10020 2020-06-05 17:06:07    IO Rule not found: user.vim_arrow                                                                                                                
10021 2020-06-05 17:06:07    IO Rule not found: user.vim_normal_counted_motion_command                                                                                        
10022 2020-06-05 17:06:07    IO Rule not found: user.vim_motions_all_adjust                                                                                                   
10023 2020-06-05 17:06:07    IO Rule not found: user.vim_normal_counted_action                                                                                                
10024 2020-06-05 17:06:07    IO Rule not found: user.vim_arrow                                                                                                                
10025 2020-06-05 17:06:07    IO Rule not found: user.vim_select_motion                                                                                                        
10026 2020-06-05 17:06:07    IO dfa rules linked 0.149s                                                                                                                       
10027 2020-06-05 17:06:08    IO minimize + cfg in 1.069s   

Though I confirm that it seems to load the vim.py at startup. I guess will be something to fix before we fully move stuff out of code/, guessing that's something that has to be fixed in talon maybe?

@fidgetingbits ^ fyi that looks like this issue https://github.com/talonvoice/beta/issues/83, which is fixed in v1365

fidgetingbits commented 4 years ago

@knausj85 yep that fixed it, thanks for filling that bug. i had no time to actually play around to figure out what the problem was yet.