Git Product home page Git Product logo

community's Introduction

community

Voice command set for Talon, community-supported.

(Originally called knausj_talon, after its original creator 🦸)

Can be used on its own, but shines when combined with:

  • Cursorless for programming and text editing
  • Rango for browser navigation
  • gaze-ocr for advanced cursor control using eye tracking and text recognition (OCR)
  • AXKit (macOS only) to enhance Talon with native OS accessibility integrations
  • Other user file sets

Installation

Prerequisites

  • Talon
  • Mac, Windows, or Linux
  • Can work with both Talon's built-in Conformer (wav2letter) speech recognition engine (recommended), or Dragon Naturally Speaking (Windows) / Dragon for Mac (although beware that Dragon for Mac is deprecated).
  • Includes commands for working with an eye tracker, but not required

Linux & Mac

It is recommended to install community using git.

  1. Install git

  2. Open a terminal (Mac / Ubuntu)

  3. Paste the following into the terminal and hit enter:

    cd ~/.talon/user
    git clone https://github.com/talonhub/community community

Note that it is also possible to install community by downloading and extracting a zip file, but this approach is discouraged because it makes it more difficult to keep track of any changes you may make to your copy of the files.

Windows

It is recommended to install community using git.

  1. Install git

  2. Open a terminal

  3. Paste the following into the terminal and hit enter:

    cd %AppData%\Talon\user
    git clone https://github.com/talonhub/community community
    

Note that it is also possible to install community by downloading and extracting a zip file, but this approach is discouraged because it makes it more difficult to keep track of any changes you may make to your copy of the files.

Getting started with Talon

  1. help active will display the available commands for the active application.
    • Available commands can change with the application, or even window title that has focus.
    • You may navigate help using the displayed numbers. e.g., help one one or help eleven to open the 11th item in the help list.
    • Note that all help-related commands are defined in core/help/help.talon and core/help/help_open.talon
  2. You can also search for commands by saying help search <phrase>. For example, help search tab displays all tab-related commands, and help search help displays all help-related commands.
  3. You can also jump immediately into a particular help context display by recalling the name displayed in help window (based on the name of the .talon file) e.g. help symbols or help visual studio
  4. help alphabet will display the alphabet
  5. command history will toggle a display of the recent commands
  6. help format will display the available formatters with examples.
  7. Many useful, basic commands are defined in https://github.com/talonhub/community/blob/main/core/edit/edit.talon
    • undo that and redo that are the default undo/redo commands.
    • paste that, copy that, and cut that for pasting/copy/cutting, respectively.
  8. For community-generated documentation on Talon itself, please visit https://talon.wiki/

It's recommended to learn the alphabet first, then get familiar with the keys, symbols, formatters, mouse, and generic_editor commands.

Once you have the basics of text input down, try copying some code from one window to another.

After that, explore using ordinal repetition for easily repeating a command without pausing (e.g., saying go up fifth will go up five lines), window switching (focus chrome), and moving around in your text editor of choice.

If you use vim, just start with the numbers and alphabet, otherwise look at generic_editor.talon as well at jetbrains, vscode, and any other integrations.

Alphabet

The alphabet is defined here https://github.com/talonhub/community/blob/main/core/keys/keys.py#L3

help alphabet will open a window that displays the alphabet. help close to hide the window.

Try saying e.g. air bat cap to insert abc.

Keys

Keys are defined in keys.py. The alphabet is used for A-Z. For the rest, search for modifier_keys and then keep scrolling through the file, eg. roughly https://github.com/talonhub/community/blob/main/core/keys/keys.py#L111

All key commands are defined in keys.talon. For example, say shift air to press shift-a, which types a capital A.

On Windows, try commands such as

  • control air to press control-a and select all.

  • super-shift-sun to press windows-shift-s to trigger the screenshot application (Windows 10). Then try escape to exit the screenshot application.

On Mac, try commands such as

  • command air to press command-a and select all.

  • control shift command 4 to press ctrl-shift-cmd-4 to trigger the screenshot application. Then try escape to exit the screenshot application. Please note the order of the modifiers doesn't matter.

Any combination of the modifiers, symbols, alphabet, numbers and function keys can be executed via voice to execute shorcuts. Modifier keys can be tapped using press, for example press control to tap the control key by itself.

Symbols

Some symbols are defined in keys.py, so you can say e.g. control colon to press those keys. https://github.com/talonhub/community/blob/main/core/keys/keys.py#L140

Some other symbols are defined here: https://github.com/talonhub/community/blob/main/plugin/symbols/symbols.talon

Formatters

help format will display the available formatters with examples of the output.

Try using formatters by saying e.g. snake hello world, which will insert hello_world

Multiple formatters can be used together, e.g. dubstring snake hello world. This will insert "hello_world"

Formatters (snake, dubstring) are defined here https://github.com/talonhub/community/blob/main/core/text/formatters.py#L137

All formatter-related commands are defined here https://github.com/talonhub/community/blob/main/core/text/text.talon#L8

Mouse commands

See https://github.com/talonhub/community/blob/main/plugin/mouse/mouse.talon for commands to click, drag, scroll, and use an eye tracker. To use a grid to click at a certain location on the screen, see mouse_grid.

Generic editing commands

https://github.com/talonhub/community/blob/main/core/edit/edit.talon

These generic commands are global. Commands such as go word left will work in any text box.

Repeating commands

For repeating commands, useful voice commands are defined here: https://github.com/talonhub/community/blob/main/plugin/repeater/repeater.talon

Try saying e.g. go up fifth will go up five lines. Try saying e.g. select up third to hit shift-up three times to select some lines in a text field.

Window management

Global window managment commands are defined here: https://github.com/talonhub/community/blob/main/core/windows_and_tabs/window_management.talon

  • running list will toggle a GUI list of words you can say to switch to running applications.
  • focus chrome will focus the chrome application.
  • launch music will launch the music application. Note this is currently only implemented on Mac OS X.

Screenshot commands

https://github.com/talonhub/community/blob/main/plugin/screenshot/screenshot.talon

Programming Languages

Specific programming languages may be activated by voice commands, or via title tracking.

Activating languages via commands will enable the commands globally, e.g. they'll work in any application. This will also disable the title tracking method (code.language in .talon files) until the "clear language modes" voice command is used.

The commands for enabling languages are defined here: https://github.com/talonhub/community/blob/main/core/modes/language_modes.talon

By default, title tracking activates coding languages in supported applications such as VSCode, Visual Studio (requires plugin), and Notepad++.

To enable title tracking for your application:

  1. The active filename (including extension) must be included in the editor's title
  2. Implement the required Talon-defined filename action to correctly extract the filename from the programs's title. See https://github.com/talonhub/community/blob/main/apps/vscode/vscode.py#L122-L138 for an example.

Python, C#, Talon and javascript language support is currently broken up into several tags in an attempt to define a common grammar where possible between languages. Each tag is defined by a .talon file, which defines the voice commands, and a Python file which declares the actions that should be implemented by each concrete language implementation to support those voice commands. Currently, the tags which are available are:

  • lang/tags/comment_block.{talon,py} - block comments (e.g., C++'s /* */)
  • lang/tags/comment_documentation.{talon,py} - documentation comments (e.g., Java's /** */)
  • lang/tags/comment_line.{talon,py} - line comments (e.g., Python's #)
  • lang/tags/data_null.{talon,py} - null & null checks (e.g., Python's None)
  • lang/tags/data_bool.{talon,py} - booleans (e.g., Haskell's True)
  • lang/tags/functions.{talon,py} - functions and definitions
  • lang/tags/functions_common.{talon,py} - common functions (also includes a GUI for picking functions)
  • lang/tags/imperative.{talon,py} - statements (e.g., if, while, switch)
  • lang/tags/libraries.{talon,py} - libraries and imports
  • lang/tags/libraries_gui.{talon,py} - graphical helper for common libraries
  • lang/tags/object_oriented.{talon,py} - objects and classes (e.g., this)
  • lang/tags/operators_array.{talon,py} - array operators (e.g., Ruby's x[0])
  • lang/tags/operators_assignment.{talon,py} - assignment operators (e.g., C++'s x += 5)
  • lang/tags/operators_bitwise.{talon,py} - bitwise operators (e.g., C's x >> 1)
  • lang/tags/operators_lambda.{talon,py} - anonymous functions (e.g., JavaScript's x => x + 1)
  • lang/tags/operators_math.{talon,py} - numeric, comparison, and logical operators
  • lang/tags/operators_pointer.{talon,py} - pointer operators (e.g., C's &x)

The support for the language-specific implementations of actions are then located in:

  • lang/{your-language}/{your-language}.py

To start support for a new language, ensure the appropriate extension is added to the language_extensions in language_modes.py. Then create the following files:

  • lang/{your-language}/{your-language}.py
  • lang/{your-language}/{your-language}.talon

Activate the appropriate tags in {your-language}.talon and implement the corresponding actions in {your-language}.py, following existing language implementations. If you wish to add additional voice commands for your language, put those in {your-language}.talon. You may also want to add a force command to language_modes.talon.

File Manager commands

For the following file manager commands to work, your file manager must display the full folder path in the title bar. https://github.com/talonhub/community/blob/main/tags/file_manager/file_manager.talon

For Mac OS X's Finder, run this command in terminal to display the full path in the title.

defaults write com.apple.finder _FXShowPosixPathInTitle -bool YES

For Windows Explorer, follow these directions https://www.howtogeek.com/121218/beginner-how-to-make-explorer-always-show-the-full-path-in-windows-8/

For the Windows command line, the refresh title command will force the title to the current directory, and all directory commands (follow 1) will automatically update the title.

Notes:

• Both Windows Explorer and Finder hide certain files and folder by default, so it's often best to use the imgui to list the options before issuing commands.

• If there no hidden files or folders, and the items are displayed in alphabetical order, you can typically issue the follow <number>, file <number> and open <number> commands based on the displayed order.

To implement support for a new program, you need to implement the relevant file manager actions for your application and assert the user.file_manager tag.

Terminal commands

Many terminal programs are supported out of the box, but you may not want all the commands enabled.

To disable various commandsets in your terminal, find the relevant talon file and enable/disable the tags for command sets as appropriate.

tag(): user.file_manager
tag(): user.git
tag(): user.kubectl
tag(): user.tabs

For instance, kubectl commands (kubernetes) aren't relevant to everyone.

Note also that while some of the command sets associated with these tags are defined in talon files within tags, others, like git, are defined within apps. Additionally, the commands for tabs are defined in tabs.talon.

Unix utilities

If you have a Unix (e.g. OSX) or Linux computer, you can enable support for a number of common terminal utilities like cat, tail, or grep by uncommenting the following line in unix_shell.py:

# ctx.tags = ["user.unix_utilities"]

Once you have uncommented the line, you can customize your utility commands by editing settings/unix_utilities.csv. Note: this directory is created when first running Talon with community enabled.

Jetbrains commands

For Jetbrains commands to work you must install https://plugins.jetbrains.com/plugin/10504-voice-code-idea into each editor.

Additional commands

There are other commands not described fully within this file. As an overview:

  • The apps folder has command sets for use within different applications
  • The core folder has various commands described here
  • The lang folder has commands for writing programming languages
  • The plugin folder has various commands described here
  • The tags folder has various other commands, such as using a browser, navigating a filesystem in terminal, and managing multiple cursors

Settings

Several options are configurable via a single settings file out of the box. Any setting can be made context specific as needed (e.g., per-OS, per-app, etc).

The most commonly adjusted settings are probably

imgui.scale to improve the visibility of all imgui-based windows (help, history, etc). This is simply a scale factor, 1.3 = 130%.

user.help_max_command_lines_per_page and user.help_max_contexts_per_page to ensure all help information is visible.

user.mouse_wheel_down_amount and user.mouse_continuous_scroll_amount for adjusting the scroll amounts for the various scroll commands.

Also, you can add additional vocabulary words, words to replace, search engines and more. Complete the community setup instructions above, then open the settings folder to see the provided CSV files and customize them as needed.

Other talon user file sets

In addition to this repo, there are other Talon user file sets containing additional commands that you may want to experiment with if you're feeling adventurous 😊. Many of them are meant to be used alongside community, but a few of them are designed as replacements. If it's not clear which, please file an issue against the given GitHub repository for that user file set!

Collaborators

This repository is now officially a team effort. The following contributors have direct access:

  • @dwiel
  • @fidgetingbits
  • @knausj85
  • @rntz
  • @splondike
  • @pokey

Collaborators will reply to issues and pull requests as time and health permits. Please be patient.

Guidelines for collaborators

  1. Collaborators prioritize their health and their personal/professional needs first. Their time commitment to this effort is limited.
  2. For "minor" fixes and improvements/bugs/new apps, collaborators are free to contribute without any review
  3. For "significant" new development and refactors, collaborators should seek appropriate input and reviews from each-other. Collaborators are encouraged to open a discussion before committing their time to any major effort.

Contributing

See CONTRIBUTING.md for our guidelines for contributors

Automatic formatting/linters

This repository uses pre-commit to run and manage its formatters/linters. Running these yourself is optional. If you wish to do so, first install pre-commit:

$ pip install pre-commit

You then have a few options as to when to run it:

  • Run yourself at any time on your locally changed files: pre-commit run
  • Run yourself on all files in the repository: pre-commit run --all-files
  • Run automatically on your PRs (fixes will be pushed automatically to your branch):
  • Set up an editor hook to run on save:
    • You could follow the instructions for Black, which are well written; simply replace black <path> with pre-commit run --files <file>.
    • It's more performant to only reformat the specific file you're editing, rather than all changed files.
  • Install a git pre-commit hook with pre-commit install (optional)
    • This essentially runs pre-commit run automatically before creating local commits, applying formatters/linters on all changed files. If it "fails", the commit will be blocked.
    • Note that because many of the rules automatically apply fixes, typically you just need to stage the changes that they made, then reattempt your commit.
    • Whether to use the hook comes down to personal taste. If you like to make many small incremental "work" commits developing a feature, it may be too much overhead.

If you run into setup difficulty with pre-commit, you might want to ensure that you have a modern Python 3 local environment first. pyenv is good way to install such Python versions without affecting your system Python (recommend installing 3.9 to match Talon's current version). On macOS you can also brew install pre-commit.

Automated tests

There are a number of automated unit tests in the repository. These are all run outside of the Talon environment (e.g. we don't have access to Talon's window management APIs). These make use of a set of stubbed out Talon APIs in test/stubs/ and a bit of class loader trickery in conftest.py.

To run the test suite you just need to install the pytest python package in to a non-Talon Python runtime you want to use for tests (i.e. don't install in the ~/.talon/.venv directory). You can then just run the pytest command from the repository root to execute all the tests.

Talon documentation

For official documentation on Talon's API and features, please visit https://talonvoice.com/docs/.

For community-generated documentation on Talon, please visit https://talon.wiki/

Alternate installation method: Zip file

It is possible to install community by downloading and extracting a zip file instead of using git. Note that this approach is discouraged, because it makes it more difficult to keep track of any changes you may make to your copy of the files.

If you wish to install community by downloading and extracting a zip file, proceed as follows:

  1. Download the zip archive of community
  2. Extract the files. If you don’t know how to extract zip files, a quick google search for "extract zip files" may be helpful.
  3. Place these extracted files inside the user folder of the Talon Home directory. You can find this folder by right clicking the Talon icon in taskbar, clicking Scripting > Open ~/talon, and navigating to user.

community's People

Contributors

2shea avatar andreasarvidsson avatar auscompgeek avatar brief avatar codecat555 avatar daanvdh avatar david-tejada avatar dwiel avatar fidgetingbits avatar gsingh93 avatar hbk619 avatar jaresty avatar jcaw avatar khornlund avatar knausj85 avatar nriley avatar phillco avatar pokey avatar pre-commit-ci[bot] avatar rntz avatar scdf avatar seananderson avatar splondike avatar tararoys avatar timo avatar timo95 avatar viacheslavkudinov avatar wenkokke avatar wolfmanstout avatar xavier630 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

community's Issues

use standard python code formatter

Do you have thoughts on using a standard python code formatter like black? There are a few reasons for putting all python code through such a tool.

  1. Using a tool like black makes editing code by voice significantly easier. You can dictate code in a nasty format and with no spaces, etc. Once you are done, you can just let your editor/formatter fix everything for you with a single command or on every save
  2. It makes it easier to keep a codebase like this being edited by multiple people in the same style for easier reading and contributing

One issue with this tool is that if I start using it on my code, any PR I make will include all kinds of formatting changes as well which is undesirable. I would be happy to make a PR which runs the entire code base through such a formatter, just let me know.

can't define actions for terminal

I can't put my finger on it, but some action definitions don't work in terminal.talon. For example:
action(app.tab_open): key(cmd-t)
This does not work, Talon doesn't even recognize it (it hears 'near tab'). In contrast this works perfectly:
new tab: key(cmd-t)
Note that I have no problem with 'new window', which is defined through an action.I'm just putting it out there and hope it would be useful. ``

'command history' toggle causes talon crash

Using the talon linux beta 1488, the phrase 'command history' successfully displays the panel, but after toggling another panel, ie 'formatter help', the history panel becomes unable to move and Talon crashes when 'command history' is repeated to close the panel.

The panel does work fine as long as other panels are not toggled.

Only relevant output in the console is:
Segmentation fault (core dumped)

Let me know if there is any other info that would be helpful!

Support 1Password X

Currently, the 1Password commands assume the user is using the 1Password installation on the OS + browser extension, but 1Password has the alternative 1Password X, which connects to my.1password.com. We should consider supporting both - maybe there's a way for Talon to tell which is being used?

including disabled scripts/rules in the repo

is there an 'official' or recommended way of disabling things other than deleting? i often rename files to talon_ or py_ to prevent talon from loading them, but it may be we want to start having some talon files available in the repo, but disabled by default so people can enable them only if they need them. so it may be we want to agree on the best way to disable rules/script files.

I feel like eventually we're going to have so many rule files the new users having to delete all of the one they don't need is going to be harder than them just enabling the ones they do need for their workflow.

I think another useful example for disabled by default scripts would be with debug scripts. right now we kind of rely on the slack channel and people to ask for certain debug scripts and they just keep getting pasted over and over again, but if we included something like debug/ folder with python and talon files that could be used for debugging, and that are just disabled by default, we could just tell people to enable them and then it helps us be sure that they're using debug scripts that actually work as intended. examples would be your debug app command, record.py, etc.

filing discussion as an issue so there is a record that won't disappear due to slack message limits.

Becoming a real "community" repo

This is just to discuss the possibility of adding a few direct contributors to the repo besides myself. I'm still poking a few other people, but ideally I'm hoping for 4 collaborators including myself.

The things I'm looking for help with:

  1. Responding to issues and PRs.
  2. If you have any specific areas or platform of expertise, e.g. jetbrains/vim or Mac/Linux, take some degree of "ownership" of those bits where feasible.

Collaborator guidelines

  • Take care of yourself and your health/needs first. Limit your time commitment to this effort.

  • For "minor" fixes/improvements/bugs/new apps, you're free to contribute without any review

  • For significant new development/refactoring you feel makes sense, it's likely still prudent to get a review from one of the other collaborators, or open a discussion as appropriate before committing your time?

Potential guidelines for contributions (PR review, etc)

  • Any addition to the global grammar should be scrutinized a bit more thoroughly. The more specific a new context, the less scrutiny I typically apply.

  • New grammars should follow the [subject][verb] standard where-ever possible.

  • For Mac OS X, the bundle id should be used for defining app contexts, rather than the name.

  • For Windows, both the friendly app name and exe name should be used for defining app contexts. For some people, the MUICache breaks.

  • For new web apps, ensure the domain is used to minimize potential mismatches
    https://github.com/knausj85/knausj_talon/blob/master/apps/web/window_titles.md

  • New applications should support the appropriate 'generic' grammars where possible

generic_browser.talon
find_and_replace.talon
line_commands.talon
multiple_cursors.talon
snippets.talon
splits.talon
tabs.talon
  • New programming languages should support the appropriate 'generic' grammars where possible as well
operators.talon
programming.talon
comment.talon
block_comment.talon

and should support the lists

user.code_functions
user.code_libraries

where appropriate. See e.g. csharp.py/csharp.talon. At least, until we come up with something better 👍

Windows switching could use fuzzier matching

Right now when you want to switch window focus you have to say a word the matches a generated list of running applications, and this list has an override that lets you more easily say the names of complex application names, for instance term is iTerm2 or whatever.

I propose we change the way the list works so that actually we just use focus <user.text> for the command, and then switcher_focus() does the lookup for whatever text it gets inside the running application list. Doing it this way allows us to leverage any additional vocabulary that's been added to vocabulary.py without necessarily having to hardcode it again inside of switcher.py.

in addition I propose that we introduce slightly fuzzer matching. IFor example, my vocabulary.py as a rule for "key pass" which becomes "keepass", and this is helpful when I am just talking to other people in chat or whatever. But the actual name of the running process is KeePassXC. I don't necessarily want to always be typing that exact word into chat with other people when I say key pass though. I suspect this type of thing will be increasingly common the more people are using it with different applications

As it stands if I wanted to match the app with current switcher I'd have to put "key pass":"KeePassXC" override in switcher.py, instead of just matching the result I already have in vocabulary.py.

In addition to using vocabulary.py, I propose we check for a partial match using startswith(), so then I would be able to say something like "focus key pass" and it would actually come through as focus keepass, which would in turn match against keepassxc.

We can of course keep the overrides for certain things that are a bit harder to say in switcher.py, for instance I think people aren't going to have term becoming iTerm2 in vocabulary.py.

This can mostly all be done with a simple switcher_focus() change like:

        running = ctx.lists["self.running"]
        wanted_app = None
        for running_name in running.keys():
            if running_name == name or running_name.lower().startswith(name):
                wanted_app = running[running_name]
                break
        if wanted_app is None:
            return

        for app in ui.apps():
            if app.name == wanted_app and not app.background:
                #os.system("i3-msg '[class=\"(?)%s\"] focus'" % app.name)
                app.focus()
                break

Not sending a PR for now as I figured I'd run it past others first.

One possible change could be that it does two passes, the first pass matches on explicit name matches so you don't accidentally match against something that has a more explicit match, and then if there are no explicit matches, it tries a second pass with fuzzy matching.

FEATURE: modular structure for adding APPS into TalonVoice framework

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

toggle display instead of show + hide display

May i make a quick suggestion about a design choice I've seen in the repo? I've noticed that whenever we need to show/hide some gui, the interface has tended to use two commands, e.g. show formatters and hide formatters. May i suggest that we try to use just one command instead, e.g., toggle formatters (or formatter display etc)?

The main reason is that the fewer the number of voice commands one has to remember, the better. But this may just be a purely stylistic preference.

Investigate support for different typesets

From #169 (comment):

Since you mentioned types, one the thing I have been wanting to do with types is have the ability to toggle between default types used by the C stuff, since for instance stdint (ex: uint8_t) vs default types (unsigned char) are two common used but different typing styles across many code bases (i constantly work on different codebases). originally I tried to do this with just updating a talon setting, but it seems like you can up to a setting on the fly, so I guess we need some way of maybe standardizing non talon setting 'settings' for different programming languages. may be suitable for a different issue if you want me to file it, but I thought I'd raise it since you mentioned types here if you plan on thinking about it. I suspect this might be something ran into other languages (cpp, windows (DWORD, etc)), so may also be worth having some quasi generic method of selecting the default type set

Is changing the typeset something that could be done cleanly per-project? I have my doubts, but...

For example, the default type list could be the std_*, or whatever’s considered vanilla C. Then for projects using some other set, the list could be changed via a more specific python context.

So a python file with something like the below, plus a modified list.

ctx.matches = r"""
mode: user.c
mode: command 
and code.language: c
tag: ctypes_fancy

Then, elsewhere opt-in:

title: \some project\
title: \some other project\
-
tag: ctypes_fancy

edit.extend_line_down different in mac vs windows

Is there a reason why these are defined differently for mac and windows?
mac:

action(edit.extend_line_down):       
	key(shift-down cmd-shift-right)

windows:

action(edit.extend_line_down): 
	key(shift-down)

In my opinion, the mac implementation is incorrect and the windows implementation is correct. Happy to make a PR

"bookmark show" command in help context generic browser

While in firefox, on my windows 10 machine, I said:

"bookmark show"

as expected, this shows me my bookmarks.

Problem #1 : help context generic browser does not explicitly say the "close window" command will close the bookmark window, although it seems like a fairly intuitive assumption. I certainly figured it out. This apparently created problem #2:

Problem #2: while looking to see if a folder was actually created, I used the "bookmark show" command. This opened a file browsing window showing my bookmarks. I switched to notepad with the "focus notepad" command, which brought notepad forward. Then I said "focus firefox," which only brought the firefox bookmark window forward. Then I use the "window close" command to close the bookmark window. My Firefox window was still behind my notepad window after this. Saying "focus Firefox" did not bring Firefox back in front of notepad. ( I assume that even though I had closed the bookmark window, that was still considered a firefox window. So the focus was on firefox still. If I had to guess.) I had to say "focus notepad" and then "focus firefox" to enable to main firefox window to be brought all the way forward to where I could see it.

documentation on the full QA test of the help context generic browser command set can be found here: https://gist.github.com/tararoys/041cf944f2d275176ea56eb2d24f5493

file_manager:update_maps throwing exception in Windows cmd.exe when running .bat script or WSL

On windows when focusing on a cmd.exe window that is running a bat file the extended window title is causing an exception. It looks like the path extraction from the title needs some exception trapping. I have observered this also whilst switching to a CMD window running a bash session of WSL.

Whilst this exception is not crashing Talon for sake of stability I am documenting this. I also am hesitating submitting a PR here as I have not explored the filemanager capabilities of this repo so don't know what may not work or be affected by code changes here.

Log snippets can be genererated by:

  1. Start Run: CMD.exe, conda activate , then focus on this open cmd window
  2. Start Run: CMD.exe, bash, then focus on this open cmd window

Log snippet: 1) BAT file

2020-05-25 09:07:21    IO app: App(pid=32236, "Windows Command Processor")
2020-05-25 09:07:21    IO app: 
2020-05-25 09:07:21    IO title: C:\WINDOWS\system32\cmd.exe - "C:\Users\BSFau\Anaconda3\condabin\conda.bat"  activate TRIAL19W32AIvisionPY36
2020-05-25 09:07:21    IO ui.active_window().doc: 
2020-05-25 09:07:21 ERROR cb error topic="win_focus" cb=<function update_maps at 0x0000000000BE0168>
   20:                  <stdlib>/threading.py:890 | 
   19:                  <stdlib>/threading.py:926 | 
   18:                  <stdlib>/threading.py:870 | 
   17:             talon\windows\winevents.py:172 | 
   16:            talon\scripting\dispatch.py:98  | 
   15:            talon\scripting\dispatch.py:133 | 
   14:            talon\scripting\dispatch.py:124 | 
   13:                talon\scripting\rctx.py:199 | 
   12: -------------------------------------------# 'win_focus' main:_on_event()
   11:                    talon\windows\ui.py:79  | 
   10:            talon\scripting\dispatch.py:98  | 
    9:            talon\scripting\dispatch.py:133 | 
    8:            talon\scripting\dispatch.py:126 | 
    7:                talon\scripting\rctx.py:201 | 
    6: -------------------------------------------# 'win_focus' user.knausj_talon.code.file_manager:update_maps()
    5: -------------------------------------------# stack splice
    4:                talon\scripting\rctx.py:199 | 
    3: user\knausj_talon\code\file_manager.py:337 | if not current_path.is_dir():
    2:                    <stdlib>/pathlib.py:1358| 
    1:                    <stdlib>/pathlib.py:1168| 
OSError: [WinError 123] The filename, directory name, or volume label syntax is incorrect: 'C:\\WINDOWS\\system32\\cmd.exe - "C:\\Users\\BSFau\\Anaconda3\\condabin\\conda.bat"  activate TRIAL19W32AIvisionPY36'

Log snippet 2) CMD.exe running bash presenting a WSL session

2020-05-25 09:28:24    IO app: App(pid=31948, "Windows Command Processor")
2020-05-25 09:28:24    IO app: 
2020-05-25 09:28:24    IO title: root@BSF-PC-AU1: /mnt/c/Users/BSFau/Cloudstation/BSFsoftDev/Talon/web2letter
2020-05-25 09:28:24    IO ui.active_window().doc: 
2020-05-25 09:28:24 ERROR cb error topic="win_focus" cb=<function update_maps at 0x0000000000BE0168>
   22:                  <stdlib>/threading.py:890 | 
   21:                  <stdlib>/threading.py:926 | 
   20:                  <stdlib>/threading.py:870 | 
   19:             talon\windows\winevents.py:158 | 
   18:             talon\windows\winevents.py:133 | 
   17:             talon\windows\winevents.py:208 | 
   16:            talon\scripting\dispatch.py:98  | 
   15:            talon\scripting\dispatch.py:133 | 
   14:            talon\scripting\dispatch.py:124 | 
   13:                talon\scripting\rctx.py:199 | 
   12: -------------------------------------------# 'win_focus' main:_on_event()
   11:                    talon\windows\ui.py:79  | 
   10:            talon\scripting\dispatch.py:98  | 
    9:            talon\scripting\dispatch.py:133 | 
    8:            talon\scripting\dispatch.py:126 | 
    7:                talon\scripting\rctx.py:201 | 
    6: -------------------------------------------# 'win_focus' user.knausj_talon.code.file_manager:update_maps()
    5: -------------------------------------------# stack splice
    4:                talon\scripting\rctx.py:199 | 
    3: user\knausj_talon\code\file_manager.py:337 | if not current_path.is_dir():
    2:                    <stdlib>/pathlib.py:1358| 
    1:                    <stdlib>/pathlib.py:1168| 
OSError: [WinError 123] The filename, directory name, or volume label syntax is incorrect: 'root@BSF-PC-AU1: \\mnt\\c\\Users\\BSFau\\Cloudstation\\BSFsoftDev\\Talon\\web2letter'

Programming language detection for Jetbrains on Mac

This seems like it'd already be known if others were having the same issue, so maybe there's something specific to my device but the new programming language detection introduced in this commit doesn't work for PyCharm for me on Mac. Both "file_extension" and "file_name" are blank. For reference, the regex-based method it replaced still works fine so I'm back to that one for now.

`i` not being capitalized in dictation / speak?

When I'm using dictation mode, i am finding that the first person singular is not being properly capitalized, as illustrated in this sentence. Compound constructions like "I'm" or "I've" work, but not a single i.

i am finding this happens whether i am using the command "say" or using dictation mode.

I'm really confused about this because it seems like there's code that should make the substitution:

image

[subject][action] vs [action][subject] standard for commands?

there is an inconsistency in the repo with regards to how generic command order is approached across the repo, specifically with the order of [subject][action] vs [action][subject]. The most obvious example is earlier in this review you recommended using the file save, which follows the [subject][action] order. However, with the generic tab commands they all support the [action][subject] order. I also mix up the order situationally within the vim grammars, but it's making me wonder if we should try to standardize on one over the other, since I know you don't want to have duplicate ways of saying commands in your own repo.

I personally prefer [subject][action] in general because I can speak the subject that I want to interact with and then say what I want to do with it and it helps me think about what commands I actually going to give. I also think it correlates well to command-line stuff, where we say the number of the command first, and then the sub command. That said I guess it will rely depend on the user as to what order seems most intuitive though. I can move this discussion into a separate issue if you prefer.

help overlay not movable

all of my help overlays and command histories are not movable. this is something that's a known issue ?

running the latest version of the talon beta. macos 10.14.6

talon.exe uses 20% of CPU and makes system slow to respond, while throwing errors continuously

I'm using talon beta on Windows 10 with Dragon 15.3. When I start up talon, after it initializes and connects to Dragon, it uses about 15 – 23% of my CPU (about one for core), and causes the computer to become slow to respond. The mouse becomes shaky, and applications can take several seconds to respond sometimes.

I ran talon_console.exe, and it constantly gives these errors which might be related (or they might not be, see my later discussion):

2020-08-19 11:59:31 WARNING actions: implementations skipped because they have no matching declaration: (user.password_show, user.password_duplicate, user.password_new, user.password_delete, user.password_edit, user.password_fill)
2020-08-19 11:59:31 WARNING actions: implementations skipped because they have no matching declaration: (user.password_show, user.password_duplicate, user.password_new, user.password_delete, user.password_edit, user.password_fill)
2020-08-19 11:59:31 ERROR cb error topic="win_focus" cb=<function update_maps at 0x0000000009ECEAF8>
18: /threading.py:890|
17: /threading.py:926|
16: /threading.py:870|
15: talon\windows\winevents.py:172|
14: talon\scripting\dispatch.py:98 |
13: talon\scripting\dispatch.py:133|
12: talon\scripting\dispatch.py:124|
11: talon\scripting\rctx.py:199|
10: ------------------------------------------# 'win_focus' main:_on_event()
9: talon\windows\ui.py:79 |
8: talon\scripting\dispatch.py:98 |
7: talon\scripting\dispatch.py:133|
6: talon\scripting\dispatch.py:126|
5: talon\scripting\rctx.py:201|
4: ------------------------------------------# 'win_focus' user.knausj_talon.code.file_manager:update_maps()
3: ------------------------------------------# stack splice
2: talon\scripting\rctx.py:199|
1: user\knausj_talon\code\file_manager.py:486| ctx.lists.update(lists)
AttributeError: 'DictionaryMeta' object has no attribute 'update'
2020-08-19 11:59:31 WARNING actions: implementations skipped because they have no matching declaration: (user.password_show, user.password_duplicate, user.password_new, user.password_delete, user.password_edit, user.password_fill)
2

It's very possible these errors are not related to the high CPU usage. I have another windows 10 machine with the same number of cores on which I see talon consume on 3 – 10% of the CPU, and talent_console.exe gives the same errors on that machine. The only relevant difference I think of is that machine is on Dragon 15 (not 15.3).

I'm hoping this is just something wrong with my setup. Please let me know if it is. In my talon home folder, under talon\user, has the latest version of https://github.com/knausj85/knausj_talon, which I cloned a few minutes ago. My talon executable might be older - I don't know how to update it. I tried the "Check for updates…" option from the taskbar icon, but it doesn't seem to do anything.

"Help Context Generic Browser" Command

I speak the command

"Help Context Generic Browser"

Problem: It is supposed to open the generic browser help context menu. It does it about one time in four. Have to repeat the command 3 times with the right accent, and then it opens the generic browser help context menu. Still not sure what the right accent/pronunciation is. It seems to have trouble with the word 'generic' since after that word it prints the word 'browser' in a text field if I have a cursor in a text field while giving that command.

Not sure if training the system more will help. This issue cropped up the first day I was using it.

OS: windows 10

documentation on the full QA test of the help context generic browser command set can be found here: https://gist.github.com/tararoys/041cf944f2d275176ea56eb2d24f5493

How to set variable mouse scroll speed for different programs?

I'm thinking of trying to set different mouse scroll speeds for different programs. That is, I currently have something like the following for mouse_scroll_down:

def mouse_scroll_down_continuous(delta: float = 50):
        global continuous_scoll_mode
        continuous_scoll_mode = "scroll down continuous"
        mouse_scroll(delta)()
        if scroll_job is None:
            start_scroll()

        gui_wheel.show()

and I would like to add a few conditionals to the function to hard-code in certain values for delta for certain programs. How do I (programmatically) check what app is active? And do you think this would be a good way to go about doing things?

Eventually, though, it would be nice to be able to have some of these parameters get set automatically by some machine learning algorithm.

Re-evaluate standard.talon

  • It seems to me that these commands should probably be terminal-specific?
cd: "cd "
grep: "grep "
elle less: "ls "
run L S: "ls\n"
run (S S H | S H): "ssh"
run vim: "vim "
run make: "make\n"
run make (durr | dear): "mkdir "
  • Should any of the below always be available, or perhaps moved to language-specific things?
args: 
	insert("()")
	key(left)
[inside] (index | array): 
	insert("[]") 
	key(left)
empty array: "[]"
list in it: 
	insert("[]") 
	key(left)
(dickt in it | inside bracket | in bracket): 
	insert("{}") 
	key(left)
block: 
	insert("{}") 
	key(left enter enter up tab)
  • These seems pretty C-specific and would probably be better off in a C-specific code_function list
word streak: 
	insert("streq()") 
	key(left)
word printf: "printf"
  • These seems pretty python-specific
dunder in it: "__init__"
state past: "pass"

etc, etc.

Request: Block completion for class, method, struct

I've been reading breadcrumbs left in the code, so I know that talon scripts can't take parameters yet. There's a note left to put the function paramter block () inside a language-specific function at some point.

This ticket is just a reminder for one of us to consider adding language specific block completion to whatever method is created. example:

insert(" {}")
# the following is just an example, not sure if it's ideal
key(left enter up end left left left)

No module named 'jsoncomment'

2020-08-29 14:19:22 ERROR user.knausj_talon.code.snippet_watcher (/home/rntz/.talon/user/knausj_talon/code/snippet_watcher.py) import failed
   17:                lib/python3.7/threading.py:890| 
   16:                lib/python3.7/threading.py:926| 
   15:                lib/python3.7/threading.py:870| 
   14:                   app/resources/loader.py:609| 
   13: ---------------------------------------------# loader thread
   12:                   app/resources/loader.py:588| 
   11:                   app/resources/loader.py:446| 
   10:                   app/resources/loader.py:477| 
    9:                   app/resources/loader.py:522| 
    8:                   app/resources/loader.py:335| 
    7: ---------------------------------------------# stack splice
    6:                   app/resources/loader.py:330| 
    5:       lib/python3.7/importlib/__init__.py:127| 
    4:                   app/resources/loader.py:224| 
    3:                   app/resources/loader.py:219| 
    2: user/knausj_talon/code/snippet_watcher.py:6  | from jsoncomment import JsonComment
    1:                   app/resources/loader.py:279| 
ModuleNotFoundError: No module named 'jsoncomment'

VSCode - missing ide.talon functionality + re-evaluate

The following are not yet implemented for VSCode.

  1. Evaluate whether ide.py/ide.talon experiment still make sense. It did help jumpstart the implementation of VSCode, at least.
ide_perfect
ide_toggle_tools

#only some of these have an analog in vscode
ide_extract_variable
ide_extract_field
ide_extract_constant
ide_extract_parameter
ide_extract_interface
ide_extract_method
ide_refactor_move

ide_fix_imports
ide_go_implementation
ide_go_usage
ide_go_type
ide_go_test
ide_find_class
ide_find_in_path
ide_create_template
ide_run_menu
ide_run_again

#requires a macro plugin of some sort
ide_toggle_recording
ide_change_recording
ide_play_recording

#not a thing
ide_go_next_method
ide_go_last_method

#requires a plugin of some sort
ide_clippings

ide_copy_reference
ide_copy_pretty

#require a plugin of some sort
ide_go_task
ide_go_browser_task
ide_switch_task
ide_clear_task

ide_configure_servers

#maybe git should be broken out elsewhere
ide_git_pull
ide_git_commit
ide_git_push
ide_git_log
ide_git_browse
ide_git_get
ide_git_pull_request
ide_git_list_requests
ide_git_annotate
ide_git_menu

ide_toggle_events

ide_toggle_structure
ide_toggle_database
ide_toggle_database_changes
ide_toggle_make

ide_toggle_to_do

#docker would be a plugin
ide_toggle_docker

ide_toggle_favorites
ide_toggle_last

ide_toggle_pinned
ide_toggle_docked

ide_toggle_floating
ide_toggle_windowed
ide_toggle_split

#most of these have analogs
ide_toggle_tool_buttons
ide_toggle_toolbar
ide_toggle_navigation_bar
ide_toggle_power_save
ide_toggle_lone_numbers
ide_toggle_gutter_icons
ide_toggle_parameters

ide_change_scheme
ide_toggle_documentation
ide_toggle_definition
ide_pop_type
ide_pop_parameters

ide_go_breakpoints

ide_toggle_method_breakpoint

ide_run_test
ide_run_test_again
ide_debug_test

ide_step_smart
ide_step_to_line
ide_continue

#these aren't a thing for VSCode
ide_resize_window_right
ide_resize_window_left
ide_resize_window_up
ide_resize_window_down

alphabetically order lists where possible

This issue is in the vein of #171, but one small thing I often do with my own lists is constantly makes sure alphabetized so that it's easier to quickly update them manually but also find a relevant entry while scanning with my eyes (vs searching), etc. examples would be things like the various formats in formatters.py (yours vs mine) , things in abbreviate.py, etc.

so it be worth considering to favor alphabetically ordered lists to make managing the code even easier/faster. might be kind of annoying in some editors, but in vim it is trivial so I can always do it and send pull requests if necessary. also sometimes alphabetizing doesn't make sense because things are categorized into smaller groups, but just in general it would be nice because even if they're grouped they could be alphabetized within the group.

this is obviously way less impactful then black changes, and possibly more subjective preference (would make merging easier for me sometimes lol) so of course feel free to close and ignore as needed :D

Consider generic code snippet grammar

Similar to the code.py actions, consider ide- and language-agnostic snippet actions

def snippet_state_if():
    """Inserts if statement"""

generic_snippets.talon

tag: generic_snippet
_
snippet if: snippet_if()
snippet function: snippet_function()
snippet try: snippet_try()

FEATURE: push commands

Commands to go to the end of the line and insert some sort of symbol, relative to the language being coded in may be quite useful.
For example for python, the following command may be quite useful,

push comma:
     edit.line_end()
     insert(",")
     key(enter)

This sort of command can be especially useful for languages like C, where brackets need to be commonly inserted at the end of lines and where semicolons are inserted at the end of statements.

Just wondering if this seems like a good idea or better for users to implement for their specific use cases.

FEATURE: extended dictation

Dictation mode functions , but at the moment is not best in class. What talon does give us is the ability to switch to a command mode and do editing that I believe is getting to best of class.
Whilst we can possibly look to integrate with a best of class Dictation Executor this is probably a bigger project. Maybe there is some low hanging fruit in enabling Talon dictation mode to use some of the noise commands two switch temporarily back to command mode and then automatically back into dictation mode

My proposal is if the mouse click chif is heard then switched to command mode and if a pause of X seconds of no voice happens then switch back to dictation mode.

It would be nice to display in a future Talon desktop widget which mode Talon is in.

Any other thoughts?

Cannot dictate a variable named "point"

With the Windows beta of Talon, and with Dragon NaturallySpeaking, when I try to write the word "point" using Talon formatters, it becomes '.'. For example:
"camel point" -> .
"hammer point" -> .
"word point" -> .

I was hoping this was something I could change in the Python config files in ~/talon, but I can't seem to find where it's happening. I did a grep search of my ~/talon folder and I don't see anything causing this. Particularly it's not configured in keys.py, nor formatters.py. When formatters are called, point has already been converted to '.'.

I don't think this is caused by Dragon because when Talon is disabled, with Dragon in dictation and command mode, if I say point it writes "point". In Dragon's command mode if I say point, it writes nothing, as expected since that's not a Dragon command and Talon was off.

Any help would be appreciated. Being able to write variables and types named "point" is important to me because I am trying to work on code involving two-dimensional graphics. Having "point" convert to "." when writing floating point numbers is great, but I'm hoping to disable that conversion in formatters. I know I can spell out "point", but it's twice as many syllables. I also don't want to modify the formatters to convert '.' back to "point" because then I couldn't use "dot" with formatters.

"show cache" command in help context generic browser

On my windows 10 machine, in firefox, I said

"show cache"

The first time I said it, a window appeared with a bunch of checkboxes and such. This was after I had been testing nearly every other command in the generic browser help context, so I had done a lot of browsing.

I shut down firefox, restarted my computer, restarted firefox, and said "show cache." No window appeared and nothing happened. I repeated the command several times. I expected a window to appear like the first time, but no window ever did.

documentation on the full QA test of the help context generic browser command set can be found here: https://gist.github.com/tararoys/041cf944f2d275176ea56eb2d24f5493

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.