diff --git a/.gitmodules b/.gitmodules index 1f4fbad..c24b168 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,6 @@ [submodule "proprietary"] path = proprietary url = git@git.katesiria.org:deprekated/dotfiles-proprietary +[submodule "talon/community"] + path = talon/community + url = https://github.com/talonhub/community diff --git a/nixos/configs/dotfiles/talon.hm.nix b/nixos/configs/dotfiles/talon.hm.nix index 1dab872..5ffa0fa 100644 --- a/nixos/configs/dotfiles/talon.hm.nix +++ b/nixos/configs/dotfiles/talon.hm.nix @@ -1,7 +1,10 @@ { pkgs, ... }: { # talon configuration - home.file.".talon/user".source = ../../../talon; + home.file.".talon/user" = { + source = ../../../talon; + recursive = true; + }; # talon -program- home.file.".talon/core" = { diff --git a/nixos/configs/gui/default.nix b/nixos/configs/gui/default.nix index 5dd8a3d..1498ff2 100644 --- a/nixos/configs/gui/default.nix +++ b/nixos/configs/gui/default.nix @@ -124,11 +124,15 @@ sddm = { enable = true; autoNumlock = true; - wayland.enable = true; + #wayland.enable = true; theme = "chili"; }; }; + # Provide Plasma6 for Talon support. + services.xserver.enable = true; + services.desktopManager.plasma6.enable = true; + # Use KDE connect. programs.kdeconnect.enable = true; diff --git a/talon/community b/talon/community new file mode 160000 index 0000000..b85932a --- /dev/null +++ b/talon/community @@ -0,0 +1 @@ +Subproject commit b85932a6aa2372f553ff7be988aeae6d7127dcaa diff --git a/talon/community/community-cursorless-0.4.0/.gitignore b/talon/community/community-cursorless-0.4.0/.gitignore deleted file mode 100644 index 5dd20fc..0000000 --- a/talon/community/community-cursorless-0.4.0/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -*.flac -data/ diff --git a/talon/community/community-cursorless-0.4.0/.vscode/settings.json b/talon/community/community-cursorless-0.4.0/.vscode/settings.json deleted file mode 100644 index 46966f4..0000000 --- a/talon/community/community-cursorless-0.4.0/.vscode/settings.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "python.formatting.provider": "black", - "python.analysis.stubPath": "/Applications/Talon.app/Contents/Resources/python/lib/python3.9/site-packages", - "cSpell.words": [ - "mkfifo" - ] -} \ No newline at end of file diff --git a/talon/community/community-cursorless-0.4.0/LICENSE b/talon/community/community-cursorless-0.4.0/LICENSE deleted file mode 100644 index bbc3522..0000000 --- a/talon/community/community-cursorless-0.4.0/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2021 Jeff Knaus, Ryan Hileman, Zach Dwiel, Michael Arntzenius, and others - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/talon/community/community-cursorless-0.4.0/README.md b/talon/community/community-cursorless-0.4.0/README.md deleted file mode 100644 index d2695c9..0000000 --- a/talon/community/community-cursorless-0.4.0/README.md +++ /dev/null @@ -1,328 +0,0 @@ -# Talon documentation -For up-to-date documentation on Talon's API and features, please visit https://talon.wiki/. - -https://talon.wiki/unofficial_talon_docs/ is a great place to learn about Talon files, actions, and voice command definitions. - -# knausj_talon - -Talon configs for Mac, Windows, and Linux. Very much in progress. This is also intended to work with both Dragon Naturally Speaking and wav2letter.\ - -Notes: -- commands are subject to change. We do our best to minimize changes, but we are moving to an [object][verb] standard slowly but surely. -- @knausj85 makes extensive use of Talon's eye tracking features, so the grammar for certain programs may be much smaller than you may require. -- The repository was mostly developed with Dragon, so commands are mostly still optimized for that speech engine. - -## Linux & Mac setup - -Clone repo into `~/.talon/user` - -```insert code: -cd ~/.talon/user -git clone git@github.com:knausj85/knausj_talon.git knausj_talon -``` - -Alternatively, access the directory by right clicking the Talon icon in taskbar, clicking Scripting>Open ~/talon, and navigating to user. - -The folder structure should look like: - -```insert code: -~/.talon/user/knausj_talon -~/.talon/user/knausj_talon/code -~/.talon/user/knausj_talon/lang -``` - -## Windows setup - -Note: Talon for Windows should be placed in the Program Files directory (or another 'secure' directory): `C:\Program Files\talon` Talon has been signed and utilizes uiAccess for several goodies: this will allow Talon to work with applications that are run as admin. - -Clone repo into `%AppData%\Talon\user` - -```insert code: -cd %AppData%\Talon\user -git clone git@github.com:knausj85/knausj_talon.git knausj_talon -``` - -Alternatively, access the directory by right clicking the Talon icon in taskbar, clicking Scripting>Open ~/talon, and navigating to user. - -The folder structure should look like: - -```insert code: -%AppData%\Talon\user\knausj_talon -%AppData%\Talon\user\knausj_talon\code -%AppData%\Talon\user\knausj_talon\lang -``` - -## 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. - - Without opening help first, you can also search for commands e.g. `help search tab` to display all tab-related commands - - Without opening help first, 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` - - All help-related commands are defined in misc/help.talon and misc/help_open.talon -2. `help alphabet` will display the alphabet -3. `command history` will toggle a display of the recent commands -4. `format help` will display the available formatters with examples. -5. Many useful, basic commands are defined in https://github.com/knausj85/knausj_talon/blob/master/misc/standard.talon#L36 - - `undo that` and `redo that` are the default undo/redo commands. - - `paste that`, `copy that`, and `cut that` for pasting/copy/cutting, respectively. - -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/knausj85/knausj_talon/blob/master/code/keys.py#L6 - -`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 from line 83 - 182. The alphabet is used for A-Z. -https://github.com/knausj85/knausj_talon/blob/84c6f637ba8304352aa15e01b030e8fa36f4f1a2/code/keys.py#L83 - -All key commands are defined in keys.talon -https://github.com/knausj85/knausj_talon/blob/master/misc/keys.talon - -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. Out of the box, only the modifier keys (command, shift, alt, super) cannot be triggered by themselves. - -### Symbols -Some symbols are defined in keys.py, so you can say e.g. `control colon` to press those keys. -https://github.com/knausj85/knausj_talon/blob/master/code/keys.py#L93 - -Some other symbols are defined here: -https://github.com/knausj85/knausj_talon/blob/master/text/symbols.talon - -### Formatters -`format help` 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 - -Mutliple formatters can be used togther, e.g. `dubstring snake hello world`. This will insert "hello_world" - -Formatters (snake, dubstring) are defined here -https://github.com/knausj85/knausj_talon/blob/master/code/formatters.py#L146 - -All formatter-related commands are defined here -https://github.com/knausj85/knausj_talon/blob/master/misc/formatters.talon#L2 - - -### Mouse commands -See https://github.com/knausj85/knausj_talon/blob/master/misc/mouse.talon - -### Generic editor -https://github.com/knausj85/knausj_talon/blob/master/text/generic_editor.talon#L7 - -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/knausj85/knausj_talon/blob/ced46aee4b59e6ec5e8545bb01434e27792c830e/misc/repeater.talon#L2 - -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/knausj85/knausj_talon/blob/master/misc/window_management.talon#L1 - -`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/knausj85/knausj_talon/blob/master/misc/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/knausj85/knausj_talon/blob/master/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 actions (filename, file_ext) to correctly extract the filename and extension from the programs's title. See https://github.com/knausj85/knausj_talon/blob/master/apps/vscode/vscode.py#L18 for an example. - -Python, C#, Talon and javascript language support is currently broken up into ~four contexts in an attempt to define a common grammar where possible between languages - -• operators.talon - operator commands - -• comment.talon - commenting commands - -• programming.talon - function, loop commands, etc - -• {your-language-here}.talon - for implementation of the actioIans for the above, and any language-specific stuff - - -## 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/knausj85/knausj_talon/blob/baa323fcd34d8a1124658a425abe8eed59cf2ee5/apps/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 `, `file ` and `open ` commands based on the displayed order. - -## 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. - - -## Jetbrains commands - -For Jetbrains commands to work you must install https://plugins.jetbrains.com/plugin/10504-voice-code-idea -into each editor. - -## 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). - -https://github.com/knausj85/knausj_talon/blob/master/settings.talon - - -``` -#adjust the scale of the imgui to my liking -imgui.scale = 1.3 -# enable if you'd like the picker gui to automatically appear when explorer has focus -user.file_manager_auto_show_pickers = 0 -#set the max number of command lines per page in help -user.help_max_command_lines_per_page = 50 -# set the max number of contexts display per page in help -user.help_max_contexts_per_page = 20 -# The default amount used when scrolling continuously -user.mouse_continuous_scroll_amount = 80 -#stop continuous scroll/gaze scroll with a pop -user.mouse_enable_pop_stops_scroll = 1 -#enable pop click with 'control mouse' mode -user.mouse_enable_pop_click = 1 -#When enabled, the 'Scroll Mouse' GUI will not be shown. -user.mouse_hide_mouse_gui = 0 -#hide cursor when mouse_wake is called to enable zoom mouse -user.mouse_wake_hides_cursor = 0 -#the amount to scroll up/down (equivalent to mouse wheel on Windows by default) -user.mouse_wheel_down_amount = 120 -``` - -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. - -• Uncomment `tag(): user.mouse_grid_enabled` to enable the mouse grid. - - -# Collaborators - -This repository is now officially a team effort. The following contributors have direct access: -- @dwiel -- @fidgetingbits -- @knausj85 -- @rntz - -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 - -Anyone is welcome to submit PRs and report issues. - -## Guidelines for contributions - -- Any addition to the global grammar will be scrutinized a bit more thoroughly. The more specific a new context, the less scrutiny that is typically applied. - -- 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 when they are different. 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 👍 - diff --git a/talon/community/community-cursorless-0.4.0/apps/1password/1password.talon b/talon/community/community-cursorless-0.4.0/apps/1password/1password.talon deleted file mode 100644 index 6536105..0000000 --- a/talon/community/community-cursorless-0.4.0/apps/1password/1password.talon +++ /dev/null @@ -1,6 +0,0 @@ -app: one_password -- -password new: user.password_new() -password dup: user.password_duplicate() -password edit: user.password_edit() -password delete: user.password_delete() diff --git a/talon/community/community-cursorless-0.4.0/apps/1password/1password_global.talon b/talon/community/community-cursorless-0.4.0/apps/1password/1password_global.talon deleted file mode 100644 index f9117be..0000000 --- a/talon/community/community-cursorless-0.4.0/apps/1password/1password_global.talon +++ /dev/null @@ -1,4 +0,0 @@ -#todo: tags -- -password fill: user.password_fill() -password show: user.password_show() diff --git a/talon/community/community-cursorless-0.4.0/apps/1password/password_manager.mac.talon b/talon/community/community-cursorless-0.4.0/apps/1password/password_manager.mac.talon deleted file mode 100644 index 0787d5e..0000000 --- a/talon/community/community-cursorless-0.4.0/apps/1password/password_manager.mac.talon +++ /dev/null @@ -1,24 +0,0 @@ -os: mac - -#i don't see a need to restrict the app here, this just defines the actions -#each app can support appropriate voice commands as needed -#the below are for 1password, redefine as needed -- -action(user.password_fill): - key(cmd-\) - -action(user.password_show): - key(cmd-alt-\) - -action(user.password_new): - key(cmd-i) - -action(user.password_duplicate): - key(cmd-d) - -action(user.password_edit): - key(cmd-e) - -action(user.password_delete): - key(cmd-backspace) - diff --git a/talon/community/community-cursorless-0.4.0/apps/1password/password_manager.py b/talon/community/community-cursorless-0.4.0/apps/1password/password_manager.py deleted file mode 100644 index b5b073d..0000000 --- a/talon/community/community-cursorless-0.4.0/apps/1password/password_manager.py +++ /dev/null @@ -1,29 +0,0 @@ -from talon import app, Context, Module - -mod = Module() - -# 1password -mod.apps.one_password = "app.bundle: com.agilebits.onepassword7" -mod.apps.one_password = "app.name: 1Password for Windows desktop" -mod.apps.one_password = "app.name: 1Password.exe" - - -@mod.action_class -class Actions: - def password_fill(): - """fill the password""" - - def password_show(): - """show the password""" - - def password_new(): - """New password""" - - def password_duplicate(): - """Duplicate password""" - - def password_edit(): - """Edit password""" - - def password_delete(): - """Delete password""" diff --git a/talon/community/community-cursorless-0.4.0/apps/1password/password_manager.win.talon b/talon/community/community-cursorless-0.4.0/apps/1password/password_manager.win.talon deleted file mode 100644 index 962f76a..0000000 --- a/talon/community/community-cursorless-0.4.0/apps/1password/password_manager.win.talon +++ /dev/null @@ -1,24 +0,0 @@ -os: windows - -#i don't see a need to restrict the app here, this just defines the actions -#each app can support appropriate voice commands as needed -#the below are for 1password, redefine as needed -- -action(user.password_fill): - key(ctrl-\\) - -action(user.password_show): - key(alt-ctrl-\\) - -action(user.password_new): - key(ctrl-n) - -action(user.password_duplicate): - key(ctrl-d) - -action(user.password_edit): - key(ctrl-e) - -action(user.password_delete): - key(ctrl-delete) - diff --git a/talon/community/community-cursorless-0.4.0/apps/amethyst/amethyst.talon b/talon/community/community-cursorless-0.4.0/apps/amethyst/amethyst.talon deleted file mode 100644 index ceb01a3..0000000 --- a/talon/community/community-cursorless-0.4.0/apps/amethyst/amethyst.talon +++ /dev/null @@ -1,12 +0,0 @@ -user.running: amethyst -- -window next: key("alt-shift-j") -window previous: key("alt-shift-k") -# window move desk: key("ctrl-alt-shift-h") -window full: key("alt-shift-d") -window tall: key("alt-shift-a") -window middle: key("alt-shift-`") -window move main: key("alt-shift-enter") -window grow: key("alt-shift-l") -window shrink: key("alt-shift-h") -window reevaluate: key("alt-shift-z") \ No newline at end of file diff --git a/talon/community/community-cursorless-0.4.0/apps/chrome/chrome.mac.talon b/talon/community/community-cursorless-0.4.0/apps/chrome/chrome.mac.talon deleted file mode 100644 index eb47afa..0000000 --- a/talon/community/community-cursorless-0.4.0/apps/chrome/chrome.mac.talon +++ /dev/null @@ -1,72 +0,0 @@ -os: mac -app: chrome -- -tag(): browser -tag(): user.tabs -#action(browser.address): - -action(browser.bookmark): - key(cmd-d) - -action(browser.bookmark_tabs): - key(cmd-shift-d) - -action(browser.bookmarks): - key(cmd-alt-b) - -action(browser.bookmarks_bar): - key(cmd-shift-b) - -action(browser.focus_address): - key(cmd-l) - -#action(browser.focus_page): - -action(browser.focus_search): - browser.focus_address() - -action(browser.go_blank): - key(cmd-n) - -action(browser.go_back): - key(cmd-[) - -action(browser.go_forward): - key(cmd-]) - -action(browser.go_home): - key(cmd-shift-h) - -action(browser.open_private_window): - key(cmd-shift-n) - -action(browser.reload): - key(cmd-r) - -action(browser.reload_hard): - key(cmd-shift-r) - -#action(browser.reload_hardest): - -action(browser.show_clear_cache): - key(cmd-shift-delete) - -action(browser.show_downloads): - key(cmd-shift-j) - -#action(browser.show_extensions) - -action(browser.show_history): - key(cmd-y) - -action(browser.submit_form): - key(enter) - -#action(browser.title) - -action(browser.toggle_dev_tools): - key(cmd-alt-i) - -action(user.dental_click): key(escape f) - -fill password: user.fill_password() \ No newline at end of file diff --git a/talon/community/community-cursorless-0.4.0/apps/chrome/chrome.py b/talon/community/community-cursorless-0.4.0/apps/chrome/chrome.py deleted file mode 100644 index c003347..0000000 --- a/talon/community/community-cursorless-0.4.0/apps/chrome/chrome.py +++ /dev/null @@ -1,52 +0,0 @@ -from talon import ctrl, ui, Module, Context, actions, clip, app -from talon.experimental.locate import locate_hover - -ctx = Context() -mod = Module() - -mod.apps.chrome = "app.name: Google Chrome" -mod.apps.chrome = """ -os: windows -and app.name: Google Chrome -os: windows -and app.exe: chrome.exe -""" -mod.apps.chrome = """ -os: mac -and app.bundle: com.google.Chrome -""" -ctx.matches = r""" -app: chrome -""" - - -@ctx.action_class("user") -class user_actions: - def tab_jump(number: int): - if number < 9: - if app.platform == "mac": - actions.key("cmd-{}".format(number)) - else: - actions.key("ctrl-{}".format(number)) - - def tab_final(): - if app.platform == "mac": - actions.key("cmd-9") - else: - actions.key("ctrl-9") - - -@mod.action_class -class Actions: - def fill_password(): - """Move mouse to last pass fill password button""" - locate_hover("templates/fill-password.png") - - -@ctx.action_class("browser") -class browser_actions: - def go(url: str): - actions.browser.focus_address() - actions.sleep("50ms") - actions.insert(url) - actions.key("enter") diff --git a/talon/community/community-cursorless-0.4.0/apps/chrome/chrome.win.talon b/talon/community/community-cursorless-0.4.0/apps/chrome/chrome.win.talon deleted file mode 100644 index 908ace2..0000000 --- a/talon/community/community-cursorless-0.4.0/apps/chrome/chrome.win.talon +++ /dev/null @@ -1,68 +0,0 @@ -os: windows -app: chrome -- -tag(): browser -tag(): user.tabs -#action(browser.address): - -action(browser.bookmark): - key(ctrl-d) - -action(browser.bookmark_tabs): - key(ctrl-shift-d) - -action(browser.bookmarks): - key(ctrl-shift-o) - -action(browser.bookmarks_bar): - key(ctrl-shift-b) - -action(browser.focus_address): - key(ctrl-l) - -#action(browser.focus_page): - -action(browser.focus_search): - browser.focus_address() - -action(browser.go_blank): - key(ctrl-n) - -action(browser.go_back): - key(alt-left) - -action(browser.go_forward): - key(alt-right) - -action(browser.go_home): - key(alt-home) - -action(browser.open_private_window): - key(ctrl-shift-n) - -action(browser.reload): - key(ctrl-r) - -action(browser.reload_hard): - key(ctrl-shift-r) - -#action(browser.reload_hardest): - -action(browser.show_clear_cache): - key(ctrl-shift-delete) - -action(browser.show_downloads): - key(ctrl-j) - -#action(browser.show_extensions) - -action(browser.show_history): - key(ctrl-h) - -action(browser.submit_form): - key(enter) - -#action(browser.title) - -action(browser.toggle_dev_tools): - key(ctrl-shift-i) diff --git a/talon/community/community-cursorless-0.4.0/apps/conemu.talon b/talon/community/community-cursorless-0.4.0/apps/conemu.talon deleted file mode 100644 index e227497..0000000 --- a/talon/community/community-cursorless-0.4.0/apps/conemu.talon +++ /dev/null @@ -1,7 +0,0 @@ -os: windows -app.exe: ConEmu64.exe -- - -tag(): terminal -tag(): user.git - diff --git a/talon/community/community-cursorless-0.4.0/apps/discord/discord.mac.talon b/talon/community/community-cursorless-0.4.0/apps/discord/discord.mac.talon deleted file mode 100644 index 6da5af1..0000000 --- a/talon/community/community-cursorless-0.4.0/apps/discord/discord.mac.talon +++ /dev/null @@ -1,35 +0,0 @@ -os: mac -app: discord -- -tag(): user.messaging - -# Navigation: Servers -action(user.messaging_workspace_previous): key(cmd-alt-up) -action(user.messaging_workspace_next): key(cmd-alt-down) - -# Navigation: Channels -action(user.messaging_open_channel_picker): key(cmd-k) -action(user.messaging_channel_previous): key(alt-up) -action(user.messaging_channel_next): key(alt-down) -action(user.messaging_unread_previous): key(alt-shift-up) -action(user.messaging_unread_next): key(alt-shift-down) -action(user.discord_mentions_last): key(cmd-alt-shift-up) -action(user.discord_mentions_next): key(cmd-alt-shift-down) -action(user.discord_oldest_unread): key(shift-pageup) - -# UI -action(user.discord_toggle_pins): key(cmd-p) -action(user.discord_toggle_inbox): key(cmd-i) -action(user.discord_toggle_members): key(cmd-u) -action(user.discord_emoji_picker): key(cmd-e) -action(user.discord_gif_picker): key(cmd-g) - -# Misc -action(user.messaging_mark_workspace_read): key(shift-esc) -action(user.messaging_mark_channel_read): key(esc) -action(user.messaging_upload_file): key(cmd-shift-u) -action(user.discord_mark_inbox_read): key(cmd-shift-e) -action(user.discord_mute): key(cmd-shift-m) -action(user.discord_deafen): key(cmd-shift-d) -action(user.discord_answer_call): key(cmd-enter) -action(user.discord_decline_call): key(esc) diff --git a/talon/community/community-cursorless-0.4.0/apps/discord/discord.py b/talon/community/community-cursorless-0.4.0/apps/discord/discord.py deleted file mode 100644 index 1cbdcb8..0000000 --- a/talon/community/community-cursorless-0.4.0/apps/discord/discord.py +++ /dev/null @@ -1,47 +0,0 @@ -from talon import Module - -mod = Module() -apps = mod.apps -apps.discord = "app.name: Discord" -apps.discord = "app.name: Discord.exe" - -@mod.action_class -class discord_actions: - def discord_mentions_last(): - """Go up to channel with unread mentions""" - - def discord_mentions_next(): - """Go down to channel with unread mentions""" - - def discord_oldest_unread(): - """Go to oldest unread message""" - - def discord_toggle_pins(): - """Toggle pins popout""" - - def discord_toggle_inbox(): - """Toggle inbox popout""" - - def discord_toggle_members(): - """Toggle channel member list""" - - def discord_emoji_picker(): - """Toggle emoji picker""" - - def discord_gif_picker(): - """Toggle gif picker""" - - def discord_mark_inbox_read(): - """Mark top inbox channel read""" - - def discord_mute(): - """Toggle mute""" - - def discord_deafen(): - """Toggle deafen""" - - def discord_answer_call(): - """Answer incoming call""" - - def discord_decline_call(): - """Decline incoming call""" diff --git a/talon/community/community-cursorless-0.4.0/apps/discord/discord.talon b/talon/community/community-cursorless-0.4.0/apps/discord/discord.talon deleted file mode 100644 index f6e4346..0000000 --- a/talon/community/community-cursorless-0.4.0/apps/discord/discord.talon +++ /dev/null @@ -1,20 +0,0 @@ -app: discord -- -# Navigation: Channels -[channel] mentions last: user.discord_mentions_last() -[channel] mentions next: user.discord_mentions_next() -oldest unread: user.discord_oldest_unread() - -# UI -toggle pins: user.discord_toggle_pins() -toggle inbox: user.discord_toggle_inbox() -toggle (members | member list): user.discord_toggle_members() -pick emoji: user.discord_emoji_picker() -pick (jif | gif | gift): user.discord_gif_picker() - -# Misc -mark inbox channel read: user.discord_mark_inbox_read() -[toggle] (mute | unmute): user.discord_mute() -[toggle] (deafen | undeafen): user.discord_deafen() -answer call: user.discord_answer_call() -decline call: user.discord_decline_call() diff --git a/talon/community/community-cursorless-0.4.0/apps/discord/discord.win.talon b/talon/community/community-cursorless-0.4.0/apps/discord/discord.win.talon deleted file mode 100644 index f068907..0000000 --- a/talon/community/community-cursorless-0.4.0/apps/discord/discord.win.talon +++ /dev/null @@ -1,36 +0,0 @@ -os: windows -os: linux -app: discord -- -tag(): user.messaging - -# Navigation: Servers -action(user.messaging_workspace_previous): key(ctrl-alt-up) -action(user.messaging_workspace_next): key(ctrl-alt-down) - -# Navigation: Channels -action(user.messaging_open_channel_picker): key(ctrl-k) -action(user.messaging_channel_previous): key(alt-up) -action(user.messaging_channel_next): key(alt-down) -action(user.messaging_unread_previous): key(alt-shift-up) -action(user.messaging_unread_next): key(alt-shift-down) -action(user.discord_mentions_last): key(ctrl-alt-shift-up) -action(user.discord_mentions_next): key(ctrl-alt-shift-down) -action(user.discord_oldest_unread): key(shift-paegup) - -# UI -action(user.discord_toggle_pins): key(ctrl-p) -action(user.discord_toggle_inbox): key(ctrl-i) -action(user.discord_toggle_members): key(ctrl-u) -action(user.discord_emoji_picker): key(ctrl-e) -action(user.discord_gif_picker): key(ctrl-g) - -# Misc -action(user.messaging_mark_workspace_read): key(shift-esc) -action(user.messaging_mark_channel_read): key(esc) -action(user.messaging_upload_file): key(ctrl-shift-u) -action(user.discord_mark_inbox_read): key(ctrl-shift-e) -action(user.discord_mute): key(ctrl-shift-m) -action(user.discord_deafen): key(ctrl-shift-d) -action(user.discord_answer_call): key(ctrl-enter) -action(user.discord_decline_call): key(esc) diff --git a/talon/community/community-cursorless-0.4.0/apps/eclipse/eclipse.py b/talon/community/community-cursorless-0.4.0/apps/eclipse/eclipse.py deleted file mode 100644 index 238d641..0000000 --- a/talon/community/community-cursorless-0.4.0/apps/eclipse/eclipse.py +++ /dev/null @@ -1,174 +0,0 @@ -from talon import Context, actions, ui, Module, app, clip -from typing import List, Union - -is_mac = app.platform == "mac" - -ctx = Context() -mod = Module() - -mod.apps.eclipse = """ -os: windows -and app.name: eclipse.exe -""" - -ctx.matches = r""" -app: eclipse -""" - - -@ctx.action_class("win") -class win_actions: - def filename(): - title = actions.win.title() - # this doesn't seem to be necessary on VSCode for Mac - # if title == "": - # title = ui.active_window().doc - - if " - " in title: - result = title.split(" - ")[1] - else: - result = title - - if "." in result: - return result - - return "" - - -@ctx.action_class("edit") -class edit_actions: - def find(text: str): - actions.key("ctrl-f") - actions.insert(text) - - def line_swap_up(): - actions.key("alt-up") - - def line_swap_down(): - actions.key("alt-down") - - def line_clone(): - actions.key("ctrl-alt-down") - - def jump_line(n: int): - actions.key("ctrl-l") - actions.insert(str(n)) - actions.key("enter") - - def delete_line(): - actions.key("ctrl-d") - - -@ctx.action_class("user") -class user_actions: - # snippet.py support beginHelp close - # def snippet_search(text: str): - # actions.user.vscode("Insert Snippet") - # actions.insert(text) - - # def snippet_insert(text: str): - # """Inserts a snippet""" - # actions.user.vscode("Insert Snippet") - # actions.insert(text) - # actions.key("enter") - - # def snippet_create(): - # """Triggers snippet creation""" - # actions.user.vscode("Preferences: Configure User Snippets") - - # snippet.py support end - - # def tab_jump(number: int): - # if number < 10: - # if is_mac: - # actions.key("ctrl-{}".format(number)) - # else: - # actions.key("alt-{}".format(number)) - - # def tab_final(): - # if is_mac: - # actions.key("ctrl-0") - # else: - # actions.key("alt-0") - - # splits.py support begin - # def split_number(index: int): - # """Navigates to a the specified split""" - # if index < 9: - # if is_mac: - # actions.key("cmd-{}".format(index)) - # else: - # actions.key("ctrl-{}".format(index)) - - # splits.py support end - - # find_and_replace.py support begin - - def find(text: str): - """Triggers find in current editor""" - - actions.key("ctrl-f") - if text: - actions.insert(text) - - def find_next(): - actions.key("enter") - - def find_previous(): - actions.key("shift-enter") - - def find_everywhere(text: str): - """Triggers find across project""" - actions.key("ctrl-h") - - if text: - actions.insert(text) - - # todo: these commands should only be available - # when it's focused - def find_toggle_match_by_case(): - """Toggles find match by case sensitivity""" - actions.key("alt-c") - - def find_toggle_match_by_word(): - """Toggles find match by whole words""" - actions.key("alt-w") - - def find_toggle_match_by_regex(): - """Toggles find match by regex""" - actions.key("alt-e") - - def replace(text: str): - """Search and replaces in the active editor""" - actions.key("ctrl-f") - - if text: - actions.insert(text) - - def replace_everywhere(text: str): - """Search and replaces in the entire project""" - actions.key("alt-a f") - - if text: - actions.insert(text) - - def replace_confirm(): - """Confirm replace at current position""" - actions.key("alt-r") - - def replace_confirm_all(): - """Confirm replace all""" - actions.key("alt-a") - - def select_previous_occurrence(text: str): - actions.edit.find(text) - actions.sleep("100ms") - actions.key("alt-b alt-f enter esc") - - def select_next_occurrence(text: str): - actions.edit.find(text) - actions.sleep("100ms") - actions.key("alt-f alt-o esc") - - # find_and_replace.py support end - diff --git a/talon/community/community-cursorless-0.4.0/apps/eclipse/eclipse.talon b/talon/community/community-cursorless-0.4.0/apps/eclipse/eclipse.talon deleted file mode 100644 index 49e8d21..0000000 --- a/talon/community/community-cursorless-0.4.0/apps/eclipse/eclipse.talon +++ /dev/null @@ -1,195 +0,0 @@ -#custom eclipse commands go here -app: eclipse -- -tag(): user.find_and_replace -tag(): user.line_commands -# tag(): user.multiple_cursors -# tag(): user.snippets -tag(): user.splits -tag(): user.tabs -#talon app actions -action(app.tab_close): key(ctrl-w) -action(app.tab_next): key(ctrl-pagedown) -action(app.tab_previous): key(ctrl-pageup) -#action(app.tab_reopen): -action(app.window_close): key(alt-f4) -action(app.window_open): key(alt-w n) -#talon code actions -action(code.toggle_comment): key(ctrl-7) - -#talon edit actions -action(edit.indent_more): key(tab) -action(edit.indent_less): key(shift-tab) -action(edit.save_all): key(ctrl-shift-s) - -# splits.py support begin -# requires https://marketplace.eclipse.org/content/handysplit -action(user.split_clear_all): key(alt-shift-s f) -action(user.split_clear): key(alt-shift-s f) -# action(user.split_flip): -action(user.split_last): key(alt-shift-s t) -action(user.split_next): key(alt-shift-s t) -action(user.split_window_down): key(alt-shift-s m) -action(user.split_window_horizontally): key(alt-ctrl-s s) -action(user.split_window_right): key(alt-shift-s m) -action(user.split_window_up): key(alt-shift-s m) -action(user.split_window_vertically): key(alt-shift-s s) -action(user.split_window): key(alt-ctrl-s s) -# splits.py support end - -#multiple_cursor.py support begin -#note: vscode has no explicit mode for multiple cursors -# action(user.multi_cursor_add_above): -# action(user.multi_cursor_add_below): -# action(user.multi_cursor_add_to_line_ends): -# action(user.multi_cursor_disable): -# action(user.multi_cursor_enable): -# action(user.multi_cursor_select_all_occurrences): -# action(user.multi_cursor_select_fewer_occurrences): -# action(user.multi_cursor_select_more_occurrences): -#multiple_cursor.py support end - -please []: - key(ctrl-3) - insert(user.text or "") - -# Sidebar -bar explore: key(alt-shift-w p) -# bar extensions: -bar outline: key(alt-shift-q o) - -# bar run: - -# bar source: -# bar switch: - -# Panels -# panel control: -panel output: - key(alt-shift-q) - sleep(200ms) - key(c) -panel problems: - key(alt-shift-q) - sleep(200ms) - key(x) -panel errors: - key(alt-shift-q) - sleep(200ms) - key(l) -panel breakpoints: - key(alt-shift-q) - sleep(200ms) - key(b) -panel search: - key(alt-shift-q) - sleep(200ms) - key(s) -panel variables: - key(alt-shift-q) - sleep(200ms) - key(v) -# panel switch: -# panel terminal: - -# Settings -show settings: key(alt-w p) -show shortcuts: key(ctrl-shift-l) -#show snippets: - -# Display -# centered switch: -# fullscreen switch: -# theme switch: -# wrap switch: -# zen switch: - -# File Commands -file hunt []: - key(ctrl-shift-r) - sleep(50ms) - insert(text or "") -# file copy path: -# file create sibling: -file create: key(ctrl-n) -file open folder: key(alt-shift-w x) -file rename: - key(alt-shift-w p enter f2) -file reveal: key(alt-shift-w p enter) - -# Language Features -# suggest show: -# hint show: -# definition show: -# definition peek: -# definition side: -# references show: -# references find: -# format that: -# format selection: -imports fix: key(ctrl-shift-o) -# problem last: -# problem fix: -# rename that: -# refactor that: -# whitespace trim: -# language switch: -refactor rename: key(alt-shift-r) -refactor this: key(alt-shift-i) - -#code navigation -(go declaration | follow): key(f3) -go back: key(alt-left) -go forward: key(alt-right) -# go implementation: -# go recent: -# go type: -# go usage: - -# Bookmarks. -#requires https://marketplace.eclipse.org/content/quick-bookmarks -go marks: key(alt-end) -toggle mark: key(ctrl-alt-b down enter) -go next mark: key(alt-pagedown) -go last mark: key(alt-pageup) - -# Folding -# fold that: -# unfold that: -# fold those: -# unfold those: -# fold all: -# unfold all: -# fold comments: - -#Debugging -break point: key(ctrl-shift-b) -step over: key(f6) -debug step into: key(f5) -debug step out [of]: key(f7) -#debug start: user.vscode("workbench.action.debug.start") -#debug pause: -#debug stopper: -debug continue: key(f8) -#debug restart: - -# Terminal -# terminal external: user.vscode("workbench.action.terminal.openNativeConsole") - -# terminal new: user.vscode("workbench.action.terminal.new") -# terminal next: user.vscode("workbench.action.terminal.focusNextPane") -# terminal last:user.vscode("workbench.action.terminal.focusPreviousPane") -# terminal split: user.vscode("workbench.action.terminal.split") -# terminal trash: user.vscode("Terminal:Kill") -# terminal scroll up: user.vscode("Terminal:ScrollUp") -# terminal scroll down: user.vscode("Terminal:ScrollDown") - -#TODO: should this be added to linecommands? -copy line down: key(ctrl-alt-down) -copy line up: key(ctrl-alt-up) - -#Expand/Shrink AST Selection -# select less: user.vscode("editor.action.smartSelect.shrink") -# select (more|this): user.vscode("editor.action.smartSelect.expand") - - diff --git a/talon/community/community-cursorless-0.4.0/apps/edge/edge.mac.talon b/talon/community/community-cursorless-0.4.0/apps/edge/edge.mac.talon deleted file mode 100644 index 3f8046f..0000000 --- a/talon/community/community-cursorless-0.4.0/apps/edge/edge.mac.talon +++ /dev/null @@ -1,68 +0,0 @@ -os: mac -app: microsoft_edge -- -tag(): browser -tag(): user.tabs -#action(browser.address): - -action(browser.bookmark): - key(ctrl-d) - -action(browser.bookmark_tabs): - key(ctrl-shift-d) - -action(browser.bookmarks): - key(ctrl-shift-o) - -action(browser.bookmarks_bar): - key(ctrl-shift-b) - -action(browser.focus_address): - key(ctrl-l) - -#action(browser.focus_page): - -action(browser.focus_search): - browser.focus_address() - -action(browser.go_blank): - key(ctrl-n) - -action(browser.go_back): - key(alt-left) - -action(browser.go_forward): - key(alt-right) - -action(browser.go_home): - key(alt-home) - -action(browser.open_private_window): - key(ctrl-shift-p) - -action(browser.reload): - key(ctrl-r) - -action(browser.reload_hard): - key(shift-f5) - -#action(browser.reload_hardest): - -action(browser.show_clear_cache): - key(ctrl-shift-delete) - -action(browser.show_downloads): - key(ctrl-j) - -#action(browser.show_extensions) - -action(browser.show_history): - key(ctrl-h) - -action(browser.submit_form): - key(enter) - -#action(browser.title) - -action(browser.toggle_dev_tools): - key(ctrl-shift-i) diff --git a/talon/community/community-cursorless-0.4.0/apps/edge/edge.py b/talon/community/community-cursorless-0.4.0/apps/edge/edge.py deleted file mode 100644 index 7aa55fe..0000000 --- a/talon/community/community-cursorless-0.4.0/apps/edge/edge.py +++ /dev/null @@ -1,42 +0,0 @@ -from talon import ctrl, ui, Module, Context, actions, clip, app - -ctx = Context() -mod = Module() - -mod.apps.microsoft_edge = """ -os: windows -and app.name: msedge.exe -os: windows -and app.name: Microsoft Edge -os: windows -and app.exe: msedge.exe -""" - -ctx.matches = r""" -app: microsoft_edge -""" - - -@ctx.action_class("user") -class user_actions: - def tab_jump(number: int): - if number < 9: - if app.platform == "mac": - actions.key("cmd-{}".format(number)) - else: - actions.key("ctrl-{}".format(number)) - - def tab_final(): - if app.platform == "mac": - actions.key("cmd-9") - else: - actions.key("ctrl-9") - - -@ctx.action_class("browser") -class browser_actions: - def go(url: str): - actions.browser.focus_address() - actions.sleep("50ms") - actions.insert(url) - actions.key("enter") diff --git a/talon/community/community-cursorless-0.4.0/apps/edge/edge.win.talon b/talon/community/community-cursorless-0.4.0/apps/edge/edge.win.talon deleted file mode 100644 index 9af3439..0000000 --- a/talon/community/community-cursorless-0.4.0/apps/edge/edge.win.talon +++ /dev/null @@ -1,68 +0,0 @@ -os: windows -app: microsoft_edge -- -tag(): browser -tag(): user.tabs -#action(browser.address): - -action(browser.bookmark): - key(ctrl-d) - -action(browser.bookmark_tabs): - key(ctrl-shift-d) - -action(browser.bookmarks): - key(ctrl-shift-o) - -action(browser.bookmarks_bar): - key(ctrl-shift-b) - -action(browser.focus_address): - key(ctrl-l) - -#action(browser.focus_page): - -action(browser.focus_search): - browser.focus_address() - -action(browser.go_blank): - key(ctrl-n) - -action(browser.go_back): - key(alt-left) - -action(browser.go_forward): - key(alt-right) - -action(browser.go_home): - key(alt-home) - -action(browser.open_private_window): - key(ctrl-shift-p) - -action(browser.reload): - key(ctrl-r) - -action(browser.reload_hard): - key(shift-f5) - -#action(browser.reload_hardest): - -action(browser.show_clear_cache): - key(ctrl-shift-delete) - -action(browser.show_downloads): - key(ctrl-j) - -#action(browser.show_extensions) - -action(browser.show_history): - key(ctrl-h) - -action(browser.submit_form): - key(enter) - -#action(browser.title) - -action(browser.toggle_dev_tools): - key(ctrl-shift-i) diff --git a/talon/community/community-cursorless-0.4.0/apps/file_manager.talon b/talon/community/community-cursorless-0.4.0/apps/file_manager.talon deleted file mode 100644 index fbe77e3..0000000 --- a/talon/community/community-cursorless-0.4.0/apps/file_manager.talon +++ /dev/null @@ -1,47 +0,0 @@ -tag: user.file_manager -- -title force: user.file_manager_refresh_title() -manager show: user.file_manager_toggle_pickers() -manager refresh: user.file_manager_update_lists() -go desk: user.file_manager_open_user_directory("Desktop") -go docks: user.file_manager_open_user_directory("Documents") -go downloads: user.file_manager_open_user_directory("Downloads") -go pictures: user.file_manager_open_user_directory("Pictures") -go profile: user.file_manager_open_user_directory("") -go talon home: user.file_manager_open_directory(path.talon_home()) -go talon user: user.file_manager_open_directory(path.talon_user()) -go user: user.file_manager_open_directory(path.user_home()) -go back: user.file_manager_go_back() -go forward: user.file_manager_go_forward() -daddy: user.file_manager_open_parent() -^follow $: - directory = user.file_manager_get_directory_by_index(number - 1) - user.file_manager_open_directory(directory) -^follow {user.file_manager_directories}$: user.file_manager_open_directory(file_manager_directories) -^open $: - file = user.file_manager_get_file_by_index(number - 1) - user.file_manager_open_file(file) -^folder $: - directory = user.file_manager_get_directory_by_index(number - 1) - user.file_manager_select_directory(directory) -^file $: - file = user.file_manager_get_file_by_index(number - 1) - user.file_manager_select_file(file) -^file {user.file_manager_files}$: user.file_manager_select_file(file_manager_files) - -#new folder -folder new : - user.file_manager_new_folder(text) - -#show properties -properties show: user.file_manager_show_properties() - -# open terminal at location -terminal here: user.file_manager_terminal_here() - -folder next: user.file_manager_next_folder_page() -folder last: user.file_manager_previous_folder_page() - -file next: user.file_manager_next_file_page() -file last: user.file_manager_previous_file_page() - diff --git a/talon/community/community-cursorless-0.4.0/apps/firefox/firefox.linux.talon b/talon/community/community-cursorless-0.4.0/apps/firefox/firefox.linux.talon deleted file mode 100644 index 9a02593..0000000 --- a/talon/community/community-cursorless-0.4.0/apps/firefox/firefox.linux.talon +++ /dev/null @@ -1,61 +0,0 @@ -os: linux -app: Firefox -app: firefox -- -action(app.tab_next): key(ctrl-pagedown) -action(app.tab_previous): key(ctrl-pageup) - -action(browser.bookmark): - key(ctrl-d) - -action(browser.bookmark_tabs): - key(ctrl-shift-d) - -action(browser.bookmarks): - key(ctrl-shift-o) - -action(browser.bookmarks_bar): - key(ctrl-b) - -action(browser.focus_address): - key(ctrl-l) - -#action(browser.focus_page): - -action(browser.go_blank): - key(ctrl-n) - -action(browser.go_back): - key(alt-left) - -action(browser.go_forward): - key(alt-right) - -action(browser.go_home): - key(alt-home) - -action(browser.open_private_window): - key(ctrl-shift-p) - -action(browser.reload): - key(ctrl-r) - -action(browser.reload_hard): - key(ctrl-shift-r) - -#action(browser.reload_hardest): - -action(browser.show_clear_cache): - key(ctrl-shift-del) - -action(browser.show_downloads): - key(ctrl-shift-y) - -action(browser.show_extensions): - key(ctrl-shift-a) - -action(browser.show_history): - key(ctrl-h) - -action(browser.toggle_dev_tools): - key(ctrl-shift-i) diff --git a/talon/community/community-cursorless-0.4.0/apps/firefox/firefox.mac.talon b/talon/community/community-cursorless-0.4.0/apps/firefox/firefox.mac.talon deleted file mode 100644 index d6a79e3..0000000 --- a/talon/community/community-cursorless-0.4.0/apps/firefox/firefox.mac.talon +++ /dev/null @@ -1,57 +0,0 @@ -os: mac -app: firefox -- -action(browser.bookmark): - key(cmd-d) - -action(browser.bookmark_tabs): - key(cmd-shift-d) - -action(browser.bookmarks): - key(cmd-alt-b) - -#action(browser.bookmarks_bar): -# key(ctrl-shift-b) - -action(browser.focus_address): - key(cmd-l) - -#action(browser.focus_page): - -action(browser.go_blank): - key(cmd-n) - -action(browser.go_back): - key(cmd-left) - -action(browser.go_forward): - key(cmd-right) - -action(browser.go_home): - key(cmd-shift-h) - -action(browser.open_private_window): - key(cmd-shift-p) - -action(browser.reload): - key(cmd-r) - -action(browser.reload_hard): - key(cmd-shift-r) - -#action(browser.reload_hardest): - -action(browser.show_clear_cache): - key(cmd-shift-delete) - -action(browser.show_downloads): - key(cmd-shift-j) - -action(browser.show_extensions): - key(cmd-shift-a) - -action(browser.show_history): - key(cmd-y) - -action(browser.toggle_dev_tools): - key(cmd-alt-i) diff --git a/talon/community/community-cursorless-0.4.0/apps/firefox/firefox.py b/talon/community/community-cursorless-0.4.0/apps/firefox/firefox.py deleted file mode 100644 index ce8861c..0000000 --- a/talon/community/community-cursorless-0.4.0/apps/firefox/firefox.py +++ /dev/null @@ -1,46 +0,0 @@ -from talon import ctrl, ui, Module, Context, actions, clip, app - -ctx = Context() -mod = Module() -apps = mod.apps -apps.firefox = "app.name: Firefox" -apps.firefox = "app.name: firefox" -apps.firefox = """ -os: windows -and app.name: Firefox -os: windows -and app.exe: firefox.exe -""" -apps.firefox = """ -os: mac -and app.bundle: org.mozilla.firefox -""" - -ctx.matches = r""" -app: firefox -""" - - -@ctx.action_class("user") -class user_actions: - def tab_jump(number: int): - if number < 9: - if app.platform == "mac": - actions.key("cmd-{}".format(number)) - else: - actions.key("ctrl-{}".format(number)) - - def tab_final(): - if app.platform == "mac": - actions.key("cmd-9") - else: - actions.key("ctrl-9") - - -@ctx.action_class("browser") -class browser_actions: - def go(url: str): - actions.browser.focus_address() - actions.sleep("50ms") - actions.insert(url) - actions.key("enter") diff --git a/talon/community/community-cursorless-0.4.0/apps/firefox/firefox.talon b/talon/community/community-cursorless-0.4.0/apps/firefox/firefox.talon deleted file mode 100644 index 1492d6a..0000000 --- a/talon/community/community-cursorless-0.4.0/apps/firefox/firefox.talon +++ /dev/null @@ -1,23 +0,0 @@ -app: firefox -- -tag(): browser -tag(): user.tabs - -# TODO -#action(browser.address): -#action(browser.title): - -action(browser.focus_search): - browser.focus_address() - -action(browser.submit_form): - key(enter) - -tab search: - browser.focus_address() - insert("% ") -tab search $: - browser.focus_address() - insert("% {text}") - key(down) - diff --git a/talon/community/community-cursorless-0.4.0/apps/firefox/firefox.win.talon b/talon/community/community-cursorless-0.4.0/apps/firefox/firefox.win.talon deleted file mode 100644 index 5e97056..0000000 --- a/talon/community/community-cursorless-0.4.0/apps/firefox/firefox.win.talon +++ /dev/null @@ -1,64 +0,0 @@ -os: windows -app: firefox -- -action(app.tab_next): key(ctrl-pagedown) -action(app.tab_previous): key(ctrl-pageup) - -action(browser.bookmark): - key(ctrl-d) - -action(browser.bookmark_tabs): - key(ctrl-shift-d) - -action(browser.bookmarks): - key(ctrl-shift-b) - -action(browser.bookmarks_bar): - key(alt-v) - sleep(50ms) - key(t) - sleep(50ms) - key(b) - -action(browser.focus_address): - key(ctrl-l) - -#action(browser.focus_page): - -action(browser.go_blank): - key(ctrl-n) - -action(browser.go_back): - key(alt-left) - -action(browser.go_forward): - key(alt-right) - -action(browser.go_home): - key(alt-home) - -action(browser.open_private_window): - key(ctrl-shift-p) - -action(browser.reload): - key(ctrl-r) - -action(browser.reload_hard): - key(ctrl-shift-r) - -#action(browser.reload_hardest): - -action(browser.show_clear_cache): - key(ctrl-shift-delete) - -action(browser.show_downloads): - key(ctrl-j) - -action(browser.show_extensions): - key(ctrl-shift-a) - -action(browser.show_history): - key(ctrl-h) - -action(browser.toggle_dev_tools): - key(ctrl-shift-i) diff --git a/talon/community/community-cursorless-0.4.0/apps/gdb/gdb.py b/talon/community/community-cursorless-0.4.0/apps/gdb/gdb.py deleted file mode 100644 index b3c4a07..0000000 --- a/talon/community/community-cursorless-0.4.0/apps/gdb/gdb.py +++ /dev/null @@ -1,19 +0,0 @@ -from talon import Context, Module, actions, ui - -ctx = Context() - -ctx.matches = r""" -mode: user.gdb -""" - - -@ctx.action_class("user") -class user_actions: - def debugger_clear_breakpoint_id(number_small: int): - actions.insert(f"d br {number_small}\n") - - def debugger_disable_breakpoint_id(number_small: int): - actions.insert(f"disable br {number_small}\n") - - def debugger_enable_breakpoint_id(number_small: int): - actions.insert(f"enable br {number_small}\n") diff --git a/talon/community/community-cursorless-0.4.0/apps/gdb/gdb.talon b/talon/community/community-cursorless-0.4.0/apps/gdb/gdb.talon deleted file mode 100644 index 2008688..0000000 --- a/talon/community/community-cursorless-0.4.0/apps/gdb/gdb.talon +++ /dev/null @@ -1,156 +0,0 @@ -os: linux -# XXX - this matches .gdb files atm -#win.title: /gdb/ -tag: terminal -mode: user.gdb -- -tag(): user.gdb -tag(): user.debugger - -## -# Generic debugger actions -## - -# Code execution -action(user.debugger_step_into): "stepi\n" -action(user.debugger_step_over): "nexti\n" -action(user.debugger_step_line): "step\n" -action(user.debugger_step_over_line): "next\n" -action(user.debugger_step_out): "finish\n" -until : "until {number}" -action(user.debugger_continue): "c\n" -action(user.debugger_stop): key("ctrl-c") -action(user.debugger_start): "run\n" -action(user.debugger_restart): "run\n" -# XXX - -action(user.debugger_detach): "" - -# Registers -action(user.debugger_show_registers): "info registers\n" -action(user.debugger_get_register): "r " -action(user.debugger_set_register): - insert("set $=") - edit.left() - -# Breakpoints -action(user.debugger_show_breakpoints): "info breakpoints\n" -action(user.debugger_add_sw_breakpoint): "break " -# XXX - -action(user.debugger_add_hw_breakpoint): "" -action(user.debugger_break_now): key("ctrl-c") -action(user.debugger_break_here): "break\n" -action(user.debugger_clear_all_breakpoints): "d br\n" -force clear all break points: - insert("d br\n") - insert("y\n") -action(user.debugger_clear_breakpoint): - insert("d br ") -action(user.debugger_enable_all_breakpoints): - insert("enable br\n") -action(user.debugger_enable_breakpoint): - insert("enable br ") -action(user.debugger_disable_all_breakpoints): - insert("disable br\n") -action(user.debugger_disable_breakpoint): - insert("disable br ") - -break [on] clipboard: - insert("break ") - key(ctrl-shift-v) - key(enter) - -# Memory inspection - -# Type inspection - -## -# gdb specific functionality -## - -# information -list [source]: "list\n" -info source: "info source\n" - -print: "p " -print [variable] : "p {text}" -print hex: "p/x " -print hex [variable] : "p/x {text}" -print string: "p/s " - -# hexdumping -# XXX - switch the sizes to a list in python? -# XXX - should cache the last used size -hex dump bytes: "x/{number}bx " -hex dump (half|short) words: "x/{number}hx " -hex dump (d|long) words: "x/{number}dx " -hex dump quad words: "x/{number}gx " -# this is some arbitrary default for convenience -hex dump: "x/100gx " -hex dump highlighted: - insert("x/100gx ") - edit.copy() - edit.paste() - key(enter) -hex dump clipboard: - insert("x/100gx ") - edit.paste() - key(enter) - - -# execution -source: "source \t\t" - -# displays -# XXX - move thee invoke command into a python script -(list|show|info) display: "info display\n" -display assembly line$: "display /i $pc\n" -display source: "display " -enable display : "enable display {number_small}\n" -disable display : "disable display {number_small}\n" -undisplay: "undisplay\n" - -# variables -(list|show|info) local: "info local " -(list|show|info) local typed: "info local -t " -(list|show|info) variable: "info variable " -(list|show|info) variable typed: "info variable -t " -(list|show|info) locals: "info local\n" -(list|show|info) variables: "info variables\n" - -# threads -info threads: "info threads\n" - -restart [program]: "r\n" -continue: "c\n" -back trace: "bt\n" -debug quit: "quit\n" -# more quickly quit when there are inferiors -debug force quit: "quit\ny\n" -(show|info) (inf|inferiors): "info inferiors\n" -inferior $: "inferior {number_small}\n" -inferior: "inferior " -resume main (inf|inferior): - insert("inferior 1\n") - insert("c\n") -resume [from] (inf|inferior) $: - insert("inferior {number_small}\n") - insert("c\n") - -# arguments -set args: "set args " - -# settings -show follow (fork|forks) [mode]: "show follow-fork-mode\n" -[set] follow (fork|forks) [mode] child: "set follow-fork-mode child\n" -[set] follow (fork|forks) [mode] parent: "set follow-fork-mode parent\n" - -show detach on fork: "show detach-on-fork\n" -set detach on fork: "set detach-on-fork on\n" -unset detach on fork: "set detach-on-fork off\n" - -# list -show list size: "show listsize\n" -set list size : "set listsize {number_small}\n" - -# misc -clear screen: "shell clear\n" diff --git a/talon/community/community-cursorless-0.4.0/apps/generic_browser.talon b/talon/community/community-cursorless-0.4.0/apps/generic_browser.talon deleted file mode 100644 index 8eac5e9..0000000 --- a/talon/community/community-cursorless-0.4.0/apps/generic_browser.talon +++ /dev/null @@ -1,64 +0,0 @@ -tag: browser -- -(address bar | go address | go url): browser.focus_address() -go home: browser.go_home() -[go] forward: browser.go_forward() -go (back | backward): browser.go_back() - -go private: browser.open_private_window() - -bookmark show: browser.bookmarks() -bookmark bar: browser.bookmarks_bar() -bookmark it: browser.bookmark() -bookmark tabs: browser.bookmark_tabs() - -(refresh | reload) it: browser.reload() -(refresh | reload) it hard: browser.reload_hard() - -show downloads: browser.show_downloads() -show extensions: browser.show_extensions() -show history: browser.show_history() -show cache: browser.show_clear_cache() - -dev tools: browser.toggle_dev_tools() - -#todo - port to apps -# navigating current page -# help: key(?) -# scroll tiny down: key(j) -# scroll tiny up: key(k) -# scroll left: key(h) -# scroll right: key(l) -# scroll (pop | spring): key(z H) -# scroll push: key(z L) -# scroll top: key(gg) -# scroll (bottom | end): key(G) -# (scroll half down | mini page): key(d) -# scroll half up: key(u) -# [open] link: key(f) -# [open] link new: key(F) -# copy link: key(y f) -# copy (address | url): key(escape y y) -# (refresh | reload): browser.reload() -# view source: key(g s) -# insert mode: key(i) -# next frame: key(g f) -# main frame: key(g F) - # navigating to new pages -# (open | go) (url | history): key(o) -# (open | go) (url | history) new: key(O) -# (open | go) bookmark: key(b) -# (open | go) bookmark new: key(B) - # using find -# find mode: key(/) -# next match: key(n) -# previous match: key(N) - # navigating history -# history back: key(H) -# history forward: key(L) - # manipulating tabs -# last visited: key(^) -# dupe tab: key(y t) -# restore: key(X) -# search tabs: key(T) -# move to window: key(W) \ No newline at end of file diff --git a/talon/community/community-cursorless-0.4.0/apps/generic_debugger.talon b/talon/community/community-cursorless-0.4.0/apps/generic_debugger.talon deleted file mode 100644 index 2e721fd..0000000 --- a/talon/community/community-cursorless-0.4.0/apps/generic_debugger.talon +++ /dev/null @@ -1,73 +0,0 @@ -tag: debugger -- - -# Code execution - -## instruction level -step into: user.debugger_step_into() -step over: user.debugger_step_over() - -## line level -step line: user.debugger_step_line() -step over line: user.debugger_step_over_line() -step out: user.debugger_step_out() -continue: user.debugger_continue() - -## these are multi word to avoid accidental utterance -debug start: user.debugger_start() -debug stop: user.debugger_stop() -debug exit: user.debugger_exit() -debug detach: user.debugger_detach() -debug restart: user.debugger_restart() - -# Register -show registers: user.debugger_show_registers() -# XXX - -get register: user.debugger_get_register() -set register: user.debugger_set_register() - -# Breakpoints -break now: user.debugger_break_now() -break here: user.debugger_break_here() -(list|show) (breaks|break points): user.debugger_show_breakpoints() -(set|add) (break|break point): user.debugger_add_sw_breakpoint() -(set|add) hardware (break|break point): user.debugger_add_hw_breakpoint() -clear all (breaks|break points): user.debugger_clear_all_breakpoints() -clear (break|break point): user.debugger_clear_breakpoint() -clear (break|break point) : - user.debugger_clear_breakpoint_id(number_small) -disable all (breaks|break points): user.debugger_disable_all_breakpoints() -disable (break|break point): user.debugger_disable_breakpoint() -disable (break|break point) : - user.debugger_disable_breakpoint_id(number_small) -enable all (breaks|break points): user.debugger_enable_all_breakpoints() -enable (break|break point): user.debugger_enable_breakpoint() -enable (break|break point) : - user.debugger_enable_breakpoint_id(number_small) - -# Navigation - - -# Memory Inspection -(stack|back) trace: user.debugger_backtrace() -disassemble: user.debugger_disassemble() -disassemble here: user.debugger_disassemble_here() -disassemble clipboard: user.debugger_disassemble_clipboard() -jump to address: user.debugger_goto_address() -jump to clipboard: user.debugger_goto_clipboard() -jump to highlighted: user.debugger_goto_highlighted() - -dump string: user.debugger_dump_ascii_string() -dump unicode [string]: user.debugger_dump_unicode_string() -dump pointers: user.debugger_dump_pointers() - -list modules: user.debugger_list_modules() - -# Type inspection -inspect type: user.debugger_inspect_type() - -# Hex Dumping Memory -#hex dump register: - -# Convenience -clear line: user.debugger_clear_line() diff --git a/talon/community/community-cursorless-0.4.0/apps/generic_terminal/generic_terminal.py b/talon/community/community-cursorless-0.4.0/apps/generic_terminal/generic_terminal.py deleted file mode 100644 index 697f00c..0000000 --- a/talon/community/community-cursorless-0.4.0/apps/generic_terminal/generic_terminal.py +++ /dev/null @@ -1,29 +0,0 @@ -from talon import app, Module, Context, actions, ui, imgui, settings, app, registry - -mod = Module() -mod.tag("generic_terminal", desc="Tag for enabling generic terminal commands") - - -@mod.action_class -class Actions: - def terminal_list_directories(): - """Lists directories""" - - def terminal_list_all_directories(): - """Lists all directories including hidden""" - - def terminal_change_directory(path: str): - """Lists change directory""" - - def terminal_change_directory_root(): - """Root of current drive""" - - def terminal_clear_screen(): - """Clear screen""" - - def terminal_run_last(): - """Repeats the last command""" - - def terminal_kill_all(): - """kills the running command""" - diff --git a/talon/community/community-cursorless-0.4.0/apps/generic_terminal/generic_terminal.talon b/talon/community/community-cursorless-0.4.0/apps/generic_terminal/generic_terminal.talon deleted file mode 100644 index c544ddf..0000000 --- a/talon/community/community-cursorless-0.4.0/apps/generic_terminal/generic_terminal.talon +++ /dev/null @@ -1,11 +0,0 @@ -tag: user.generic_terminal -- -lisa: - user.terminal_list_directories() -lisa all: - user.terminal_list_all_directories() -katie []: user.terminal_change_directory(text or "") -katie root: user.terminal_change_directory_root() -clear screen: user.terminal_clear_screen() -run last: user.terminal_run_last() -kill all: user.terminal_kill_all() \ No newline at end of file diff --git a/talon/community/community-cursorless-0.4.0/apps/i3wm/i3wm.py b/talon/community/community-cursorless-0.4.0/apps/i3wm/i3wm.py deleted file mode 100644 index 5ebe444..0000000 --- a/talon/community/community-cursorless-0.4.0/apps/i3wm/i3wm.py +++ /dev/null @@ -1,35 +0,0 @@ -from talon import Context, Module, actions, settings, ui - -mod = Module() - -mod.tag("i3wm", desc="tag for loading i3wm related files") -mod.setting( - "i3_config_path", - type=str, - default="~/.i3/config", - desc="Where to find the configuration path", -) -mod.setting( - "i3_mod_key", - type=str, - default="super", - desc="The default key to use for i3wm commands", -) - - -@mod.action_class -class Actions: - def i3wm_launch(): - """Trigger the i3 launcher: ex rofi""" - key = settings.get("user.i3_mod_key") - actions.key(f"{key}-d") - - def i3wm_shell(): - """Launch a shell""" - key = settings.get("user.i3_mod_key") - actions.key(f"{key}-enter") - - def i3wm_lock(): - """Trigger the lock screen""" - key = settings.get("user.i3_mod_key") - actions.key(f"{key}-shift-x") diff --git a/talon/community/community-cursorless-0.4.0/apps/i3wm/i3wm.talon b/talon/community/community-cursorless-0.4.0/apps/i3wm/i3wm.talon deleted file mode 100644 index fe1f619..0000000 --- a/talon/community/community-cursorless-0.4.0/apps/i3wm/i3wm.talon +++ /dev/null @@ -1,100 +0,0 @@ -# NOTE: If you want to use i3wm you must enable the tag settings.talon. ex: `tag(): user.i3wm` -os: linux -tag: user.i3wm -- -settings(): - user.i3_config_path = "~/.i3/config" - user.i3_mod_key = "super" - - -port : user.system_command("i3-msg workspace {number_small}") -port ten: user.system_command("i3-msg workspace 10") -(port flip|flipper): user.system_command("i3-msg workspace back_and_forth") -port right: user.system_command("i3-msg workspace next") -port left: user.system_command("i3-msg workspace prev") - -(win|window) left: user.system_command("i3-msg focus left") -(win|window) right: user.system_command("i3-msg focus right") -(win|window) up: user.system_command("i3-msg focus up") -(win|window) down: user.system_command("i3-msg focus down") -((win|window) kill|murder): user.system_command("i3-msg kill") -(win|window) stacking: user.system_command("i3-msg layout stacking") -(win|window) default: user.system_command("i3-msg layout toggle split") -(win|window) tabbed: user.system_command("i3-msg layout tabbed") - -reload i three config: user.system_command("i3-msg reload") -restart i three: user.system_command("i3-msg restart") - -(full screen|scuba): user.system_command("i3-msg fullscreen") -toggle floating: user.system_command("i3-msg floating toggle") -focus floating: user.system_command("i3-msg focus mode_toggle") -center window: user.system_command("i3-msg move position center") -resize mode: user.system_command('i3-msg mode "resize"') -focus parent: user.system_command("i3-msg focus parent") -focus child: user.system_command("i3-msg focus child") - -# resize helpers -grow window: - user.system_command('i3-msg mode "resize"') - key(right:10) - key(down:10) - # escape resize mode - key(escape) - # center window - sleep(200ms) - user.system_command("i3-msg move position center") - - -# resize helpers -shrink window: - user.system_command('i3-msg mode "resize"') - key(left:10) - key(up:10) - # escape resize mode - key(escape) - # center window - sleep(200ms) - user.system_command("i3-msg move position center") - -horizontal (shell|terminal): - user.system_command("i3-msg split h") - user.i3wm_shell() - -vertical (shell|terminal): - user.system_command("i3-msg split v") - user.i3wm_shell() - -# XXX - just replace with shuffle eventually? -# XXX - like also need to match the generic talon commands -(shuffle|move (win|window) [to] port) : user.system_command("i3-msg move container to workspace {number_small}") -(shuffle|move (win|window) [to] port ten): user.system_command("i3-msg move container to workspace 10") -(shuffle|move (win|window) [to] last port): user.system_command("i3-msg move container to workspace back_and_forth") -(shuffle|move (win|window) left): user.system_command("i3-msg move left") -(shuffle|move (win|window) right): user.system_command("i3-msg move right") -(shuffle|move (win|window) up): user.system_command("i3-msg move up") -(shuffle|move (win|window) down): user.system_command("i3-msg move down") - -(win|window) horizontal: user.system_command("i3-msg split h") -(win|window) vertical: user.system_command("i3-msg split v") - -make scratch: user.system_command("i3-msg move scratchpad") -[(show|hide)] scratch: user.system_command("i3-msg scratchpad show") -next scratch: - user.system_command("i3-msg scratchpad show") - user.system_command("i3-msg scratchpad show") - -# these rely on the user settings for the mod key. see i3wm.py Actions class -launch: user.i3wm_launch() -launch : - user.i3wm_launch() - sleep(100ms) - insert("{text}") -lock screen: user.i3wm_launch() - -(launch shell|koopa): user.i3wm_shell() - -new scratch (shell|window): - user.i3wm_shell() - sleep(200ms) - user.system_command("i3-msg move scratchpad") - user.system_command("i3-msg scratchpad show") diff --git a/talon/community/community-cursorless-0.4.0/apps/jetbrains/jetbrains.py b/talon/community/community-cursorless-0.4.0/apps/jetbrains/jetbrains.py deleted file mode 100644 index ba35839..0000000 --- a/talon/community/community-cursorless-0.4.0/apps/jetbrains/jetbrains.py +++ /dev/null @@ -1,206 +0,0 @@ -import os -import os.path -import requests -import time -from pathlib import Path -from talon import ctrl, ui, Module, Context, actions, clip -import tempfile - -# Courtesy of https://github.com/anonfunc/talon-user/blob/master/apps/jetbrains.py - -extendCommands = [] - -# Each IDE gets its own port, as otherwise you wouldn't be able -# to run two at the same time and switch between them. -# Note that MPS and IntelliJ ultimate will conflict... -port_mapping = { - "com.google.android.studio": 8652, - "com.jetbrains.AppCode": 8655, - "com.jetbrains.CLion": 8657, - "com.jetbrains.datagrip": 8664, - "com.jetbrains.goland-EAP": 8659, - "com.jetbrains.goland": 8659, - "com.jetbrains.intellij-EAP": 8653, - "com.jetbrains.intellij.ce": 8654, - "com.jetbrains.intellij": 8653, - "com.jetbrains.PhpStorm": 8662, - "com.jetbrains.pycharm": 8658, - "com.jetbrains.rider": 8660, - "com.jetbrains.rubymine": 8661, - "com.jetbrains.rubymine-EAP": 8661, - "com.jetbrains.WebStorm": 8663, - "google-android-studio": 8652, - "idea64.exe": 8653, - "IntelliJ IDEA": 8653, - "jetbrains-appcode": 8655, - "jetbrains-clion": 8657, - "jetbrains-datagrip": 8664, - "jetbrains-goland-eap": 8659, - "jetbrains-goland": 8659, - "jetbrains-idea-ce": 8654, - "jetbrains-idea-eap": 8653, - "jetbrains-idea": 8653, - "jetbrains-phpstorm": 8662, - "jetbrains-pycharm-ce": 8658, - "jetbrains-pycharm": 8658, - "jetbrains-rider": 8660, - "jetbrains-rubymine": 8661, - "jetbrains-rubymine-eap": 8661, - "jetbrains-studio": 8652, - "jetbrains-webstorm": 8663, - "RubyMine": 8661, - "RubyMine-EAP": 8661, - "PyCharm": 8658, - "pycharm64.exe": 8658, - "webstorm64.exe": 8663, -} - - -def _get_nonce(port, file_prefix): - file_name = file_prefix + str(port) - try: - with open(os.path.join(tempfile.gettempdir(), file_name), "r") as fh: - return fh.read() - except FileNotFoundError as e: - try: - home = str(Path.home()) - with open(os.path.join(home, file_name), "r") as fh: - return fh.read() - except FileNotFoundError as eb: - print(f"Could not find {file_name} in tmp or home") - return None - except IOError as e: - print(e) - return None - - -def send_idea_command(cmd): - print("Sending {}".format(cmd)) - active_app = ui.active_app() - bundle = active_app.bundle or active_app.name - port = port_mapping.get(bundle, None) - nonce = _get_nonce(port, ".vcidea_") or _get_nonce(port, "vcidea_") - print(f"sending {bundle} {port} {nonce}") - if port and nonce: - response = requests.get( - "http://localhost:{}/{}/{}".format(port, nonce, cmd), timeout=(0.05, 3.05) - ) - response.raise_for_status() - return response.text - - -def get_idea_location(): - return send_idea_command("location").split() - - -def idea_commands(commands): - command_list = commands.split(",") - print("executing jetbrains", commands) - global extendCommands - extendCommands = command_list - for cmd in command_list: - if cmd: - send_idea_command(cmd.strip()) - time.sleep(0.1) - - -ctx = Context() -mod = Module() - -mod.apps.jetbrains = "app.name: /jetbrains/" -mod.apps.jetbrains = "app.name: IntelliJ IDEA" -mod.apps.jetbrains = "app.name: PyCharm" -mod.apps.jetbrains = "app.name: RubyMine" -mod.apps.jetbrains = "app.name: RubyMine-EAP" - -# windows -mod.apps.jetbrains = "app.name: idea64.exe" -mod.apps.jetbrains = "app.name: PyCharm64.exe" -mod.apps.jetbrains = "app.name: pycharm64.exe" -mod.apps.jetbrains = "app.name: webstorm64.exe" -mod.apps.jetbrains = """ -os: mac -and app.bundle: com.jetbrains.pycharm -""" - - -@mod.action_class -class Actions: - def idea(commands: str): - """Send a command to Jetbrains product""" - idea_commands(commands) - - def idea_grab(times: int): - """Copies specified number of words to the left""" - old_clip = clip.get() - try: - original_line, original_column = get_idea_location() - for _ in range(times): - send_idea_command("action EditorSelectWord") - send_idea_command("action EditorCopy") - send_idea_command("goto {} {}".format(original_line, original_column)) - send_idea_command("action EditorPaste") - finally: - clip.set(old_clip) - global extendCommands - extendCommands = [] - - -ctx.matches = r""" -app: jetbrains -""" - - -@ctx.action_class("win") -class win_actions: - def filename(): - title = actions.win.title() - result = title.split(" ") - - for word in result: - if "." in word: - return word - - return "" - -@ctx.action_class("edit") -class edit_actions: - def jump_line(n: int): - actions.user.idea("goto {} 0".format(n)) - # move the cursor to the first nonwhite space character of the line - actions.user.idea("action EditorLineEnd") - actions.user.idea("action EditorLineStart") - - -@ctx.action_class("user") -class user_actions: - def tab_jump(number: int): - # depends on plugin GoToTabs - if number < 10: - actions.user.idea("action GoToTab{}".format(number)) - - def extend_until_line(line: int): - actions.user.idea("extend {}".format(line)) - - def select_range(line_start: int, line_end: int): - # if it's a single line, select the entire thing including the ending new-line5 - if line_start == line_end: - actions.user.idea("goto {} 0".format(line_start)) - actions.user.idea("action EditorSelectLine"), - else: - actions.user.idea("range {} {}".format(line_start, line_end)) - - def extend_camel_left(): - actions.user.idea("action EditorPreviousWordInDifferentHumpsModeWithSelection") - - def extend_camel_right(): - actions.user.idea("action EditorNextWordInDifferentHumpsModeWithSelection") - - def camel_left(): - actions.user.idea("action EditorPreviousWordInDifferentHumpsMode") - - def camel_right(): - actions.user.idea("action EditorNextWordInDifferentHumpsMode") - - def line_clone(line: int): - actions.user.idea("clone {}".format(line)) diff --git a/talon/community/community-cursorless-0.4.0/apps/jetbrains/jetbrains.talon b/talon/community/community-cursorless-0.4.0/apps/jetbrains/jetbrains.talon deleted file mode 100644 index d21a3d0..0000000 --- a/talon/community/community-cursorless-0.4.0/apps/jetbrains/jetbrains.talon +++ /dev/null @@ -1,307 +0,0 @@ -# Requires https://plugins.jetbrains.com/plugin/10504-voice-code-idea -app: jetbrains -- -tag(): user.line_commands -tag(): user.multiple_cursors -tag(): user.splits -tag(): user.tabs - -#talon app actions (+custom tab actions) -action(user.tab_final): user.idea("action GoToLastTab") -action(app.tab_next): user.idea("action NextTab") -action(app.tab_previous): user.idea("action PreviousTab") - -action(app.tab_close): user.idea("action CloseContent") -action(app.tab_reopen): user.idea("action ReopenClosedTab") -#talon code actions -action(code.toggle_comment): user.idea("action CommentByLineComment") - -#talon edit actions -action(edit.copy): user.idea("action EditorCopy") -action(edit.cut): user.idea("action EditorCut") -action(edit.delete): user.idea("action EditorBackSpace") -action(edit.paste): user.idea("action EditorPaste") -action(edit.find_next): user.idea("action FindNext") -action(edit.find_previous): user.idea("action FindPrevious") -action(edit.find): user.idea("action Find") -action(edit.line_clone): user.idea("action EditorDuplicate") -action(edit.line_swap_down): user.idea("action MoveLineDown") -action(edit.line_swap_up): user.idea("action MoveLineUp") -action(edit.indent_more): user.idea("action EditorIndentLineOrSelection") -action(edit.indent_less): user.idea("action EditorUnindentSelection") -action(edit.select_line): user.idea("action EditorSelectLine") -action(edit.select_word): user.idea("action EditorSelectWord") -action(edit.select_all): user.idea("action $SelectAll") -action(edit.file_start): user.idea("action EditorTextStart") -action(edit.file_end): user.idea("action EditorTextEnd") -action(edit.extend_file_start): user.idea("action EditorTextStartWithSelection") -action(edit.extend_file_end): user.idea("action EditorTextEndWithSelection") - -# splits.py support begin -action(user.split_clear_all): user.idea("action UnsplitAll") -action(user.split_clear): user.idea("action Unsplit") -action(user.split_flip): user.idea("action ChangeSplitOrientation") -action(user.split_last): user.idea("action LastSplitter") -action(user.split_next): user.idea("action NextSplitter") -action(user.split_window_down): user.idea("action MoveTabDown") -action(user.split_window_horizontally): user.idea("action SplitHorizontally") -#action(user.split_window_left): user.idea("action MoveTabLeft") -action(user.split_window_right): user.idea("action MoveTabRight") -#action(user.split_window_up): user.idea("action MoveTabUp") -action(user.split_window_vertically): user.idea("action SplitVertically") -action(user.split_window): user.idea("action EditSourceInNewWindow") -# splits.py support end - -# multiple_cursors.py support begin -action(user.multi_cursor_add_above): user.idea("action EditorCloneCaretAbove") -action(user.multi_cursor_add_below): user.idea("action EditorCloneCaretBelow") -action(user.multi_cursor_disable): key(escape) -action(user.multi_cursor_enable): key(shift-alt-insert) -action(user.multi_cursor_select_all_occurrences): user.idea("action SelectAllOccurrences") -action(user.multi_cursor_select_fewer_occurrences): user.idea("action UnselectPreviousOccurrence") -action(user.multi_cursor_select_more_occurrences): user.idea("action SelectNextOccurrence") -# multiple_cursors.py support end - -# Auto complete -complete: user.idea("action CodeCompletion") -perfect: user.idea("action CodeCompletion,action CodeCompletion") -smart: user.idea("action SmartTypeCompletion") -(done | finish): user.idea("action EditorCompleteStatement") -# Copying -grab : user.idea_grab(number) -# Actions -(action | please): user.idea("action GotoAction") -(action | please) : - user.idea("action GotoAction") - insert(text) -# Refactoring -refactor: user.idea("action Refactorings.QuickListPopupAction") -refactor : - user.idea("action Refactorings.QuickListPopupAction") - insert(text) -extract variable: user.idea("action IntroduceVariable") -extract field: user.idea("action IntroduceField") -extract constant: user.idea("action IntroduceConstant") -extract parameter: user.idea("action IntroduceParameter") -extract interface: user.idea("action ExtractInterface") -extract method: user.idea("action ExtractMethod") -refactor in line: user.idea("action Inline") -refactor move: user.idea("action Move") -refactor rename: user.idea("action RenameElement") -rename file: user.idea("action RenameFile") -fix (format | formatting): user.idea("action ReformatCode") -fix imports: user.idea("action OptimizeImports") -#navigation -(go declaration | follow): user.idea("action GotoDeclaration") -go implementation: user.idea("action GotoImplementation") -go usage: user.idea("action FindUsages") -go type: user.idea("action GotoTypeDeclaration") -go test: user.idea("action GotoTest") -go back: user.idea("action Back") -go forward: user.idea("action Forward") -# Search -find (everywhere | all): user.idea("action SearchEverywhere") -find (everywhere | all) [over]: - user.idea("action SearchEverywhere") - sleep(500ms) - insert(text) -(search | find) class: user.idea("action GotoClass") -(search | find) file: user.idea("action GotoFile") -(search | find) path: user.idea("action FindInPath") -(search | find) symbol: user.idea("action GotoSymbol") -(search | find) symbol $: - user.idea("action GotoSymbol") - insert(text) - key("enter") -recent: user.idea("action RecentFiles") - -surround [this] with [over]: - idea("action SurroundWith") - sleep(500ms) - insert(text) -# Making these longer to reduce collisions with real code dictation. -insert generated [over]: - user.idea("action Generate") - sleep(500ms) - insert(text) -insert template [over]: - idea("action InsertLiveTemplate") - sleep(500ms) - insert(text) -create (template|snippet): user.idea("action SaveAsTemplate") -# Recording -toggle recording: user.idea("action StartStopMacroRecording") -change (recording | recordings): user.idea("action EditMacros") -play recording: user.idea("action PlaybackLastMacro") -play recording [over]: - idea("action PlaySavedMacrosAction") - insert(text) - sleep(500ms) - Key("enter") -# Marks -go mark: user.idea("action ShowBookmarks") -toggle mark: user.idea("action ToggleBookmark") -go next mark: user.idea("action GotoNextBookmark") -go last mark: user.idea("action GotoPreviousBookmark") -toggle mark : user.idea("action ToggleBookmark{number}") -go mark : user.idea("action GotoBookmark{number}") -# Folding -expand deep: user.idea("action ExpandRegionRecursively") -expand all: user.idea("action ExpandAllRegions") -collapse deep: user.idea("action CollapseRegionRecursively") -collapse all: user.idea("action CollapseAllRegions") -# miscellaneous -# XXX These might be better than the structural ones depending on language. -go next (method | function): user.idea("action MethodDown") -go last (method | function): user.idea("action MethodUp") -# Clipboard -clippings: user.idea("action PasteMultiple") -copy path: user.idea("action CopyPaths") -copy reference: user.idea("action CopyReference") -copy pretty: user.idea("action CopyAsRichText") -# File Creation -create sibling: user.idea("action NewElementSamePlace") -create sibling [over]: - user.idea("action NewElementSamePlace") - sleep(500ms) - insert(text) -create file: user.idea("action NewElement") -create file [over]: - user.idea("action NewElement") - sleep(500ms) - insert(text) -# Task Management -go task: user.idea("action tasks.goto") -go browser task: user.idea("action tasks.open.in.browser") -switch task: user.idea("action tasks.switch") -clear task: user.idea("action tasks.close") -configure servers: user.idea("action tasks.configure.servers") -# Git / Github (not using verb-noun-adjective pattern, mirroring terminal commands.) -git pull: user.idea("action Vcs.UpdateProject") -git commit: user.idea("action CheckinProject") -git push: user.idea("action CheckinProject") -git log: user.idea("action Vcs.ShowTabbedFileHistory") -git browse: user.idea("action Github.Open.In.Browser") -git (gets | gist): user.idea("action Github.Create.Gist") -git (pull request | request): user.idea("action Github.Create.Pull.Request") -git (view | show | list) (requests | request): user.idea("action Github.View.Pull.Request") -git (annotate | blame): user.idea("action Annotate") -git menu: user.idea("action Vcs.QuickListPopupAction") -# Tool windows: -# Toggling various tool windows -toggle project: user.idea("action ActivateProjectToolWindow") -toggle find: user.idea("action ActivateFindToolWindow") -toggle run: user.idea("action ActivateRunToolWindow") -toggle debug: user.idea("action ActivateDebugToolWindow") -toggle events: user.idea("action ActivateEventLogToolWindow") -toggle terminal: user.idea("action ActivateTerminalToolWindow") -toggle git: user.idea("action ActivateVersionControlToolWindow") -toggle structure: user.idea("action ActivateStructureToolWindow") -toggle database: user.idea("action ActivateDatabaseToolWindow") -toggle database changes: user.idea("action ActivateDatabaseChangesToolWindow") -toggle make: user.idea("action ActivatemakeToolWindow") -toggle to do: user.idea("action ActivateTODOToolWindow") -toggle docker: user.idea("action ActivateDockerToolWindow") -toggle favorites: user.idea("action ActivateFavoritesToolWindow") -toggle last: user.idea("action JumpToLastWindow") -# Pin/dock/float -toggle pinned: user.idea("action TogglePinnedMode") -toggle docked: user.idea("action ToggleDockMode") -toggle floating: user.idea("action ToggleFloatingMode") -toggle windowed: user.idea("action ToggleWindowedMode") -toggle split: user.idea("action ToggleSideMode") -# Settings, not windows -toggle tool buttons: user.idea("action ViewToolButtons") -toggle toolbar: user.idea("action ViewToolBar") -toggle status [bar]: user.idea("action ViewStatusBar") -toggle navigation [bar]: user.idea("action ViewNavigationBar") -# Active editor settings -toggle power save: user.idea("action TogglePowerSave") -toggle whitespace: user.idea("action EditorToggleShowWhitespaces") -toggle indents: user.idea("action EditorToggleShowIndentLines") -toggle line numbers: user.idea("action EditorToggleShowLineNumbers") -toggle (bread crumbs | breadcrumbs): user.idea("action EditorToggleShowBreadcrumbs") -toggle gutter icons: user.idea("action EditorToggleShowGutterIcons") -toggle wrap: user.idea("action EditorToggleUseSoftWraps") -toggle parameters: user.idea("action ToggleInlineHintsAction") -# Toggleable views -toggle fullscreen: user.idea("action ToggleFullScreen") -toggle distraction [free mode]: user.idea("action ToggleDistractionFreeMode") -toggle presentation [mode]: user.idea("action TogglePresentationMode") -# Toggle additionals -toggle comment: code.toggle_comment() -# Quick popups -change scheme: user.idea("action QuickChangeScheme") - # Always javadoc -(toggle | pop) (doc | documentation): user.idea("action QuickJavaDoc") -(pop deaf | toggle definition): user.idea("action QuickImplementations") -pop type: user.idea("action ExpressionTypeInfo") -pop parameters: user.idea("action ParameterInfo") -# Breakpoints / debugging -go breakpoints: user.idea("action ViewBreakpoints") -toggle [line] breakpoint: user.idea("action ToggleLineBreakpoint") -toggle method breakpoint: user.idea("action ToggleMethodBreakpoint") -run menu: user.idea("action ChooseRunConfiguration") -run test: user.idea("action RunClass") -run test again: user.idea("action Rerun") -debug test: user.idea("action DebugClass") -step over: user.idea("action StepOver") -step into: user.idea("action StepInto") -step smart: user.idea("action SmartStepInto") -step to line: user.idea("action RunToCursor") -continue: user.idea("action Resume") -# Grow / Shrink -(grow | shrink) window right: user.idea("action ResizeToolWindowRight") -(grow | shrink) window left: user.idea("action ResizeToolWindowLeft") -(grow | shrink) window up: user.idea("action ResizeToolWindowUp") -(grow | shrink) window down: user.idea("action ResizeToolWindowDown") -# Movement -go next (error | air): user.idea("action GotoNextError") -go last (error | air): user.idea("action GotoPreviousError") -fix next (error | air): - user.idea("action GotoNextError") - user.idea("action ShowIntentionActions") -fix last (error | air): - user.idea("action GotoPreviousError") - user.idea("action ShowIntentionActions") -# Special Selects -select less: user.idea("action EditorUnSelectWord") -select (more|this): user.idea("action EditorSelectWord") -#jet brains-specific line commands. see line_commands.talon for generic ones -expand until : - user.select_range(number_1, number_2) - user.idea("action ExpandRegion") -collapse until : - user.select_range(number_1, number_2) - user.idea("action CollapseRegion") -paste until : - user.select_range(number_1, number_2) - user.idea("action EditorPaste") -refactor until : - user.select_range(number_1, number_2) - user.idea("action Refactorings.QuickListPopupAction") -clone : user.line_clone(number) - -#find/replace -clear last [over]: user.idea("find prev {text}, action EditorBackSpace") -clear next [over]: user.idea("find next {text}, action EditorBackSpace") -comment last [over]: user.idea("find prev {text}, action CommentByLineComment") -comment next [over]: user.idea("find next {text}, action CommentByLineComment") -go last [over]: user.idea("find prev {text}, action EditorRight") -go next [over]: user.idea("find next {text}, action EditorRight") -paste last [over]: user.idea("find prev {text}, action EditorRight, action EditorPaste") -paste next [over]: user.idea("find next {text}, action EditorRight, action EditorPaste") -refactor last [over]: user.idea("find prev {text}, action Refactorings.QuickListPopupAction") -refactor next [over]: user.idea("find next {text}, action Refactorings.QuickListPopupAction") -replace last [over]: user.idea("find prev {text}, action EditorPaste") -replace next [over]: user.idea("find next {text}, action EditorPaste") -select last [over]: user.idea("find prev {text}") -select next [over]: user.idea("find next {text}") - -select camel left: user.extend_camel_left() -select camel right: user.extend_camel_right() -go camel left: user.camel_left() -go camel right: user.camel_right() - -# requires plug-in: black-pycharm -blacken: user.idea("action BLACKReformatCode") diff --git a/talon/community/community-cursorless-0.4.0/apps/kubectl/kubectl.py b/talon/community/community-cursorless-0.4.0/apps/kubectl/kubectl.py deleted file mode 100644 index 1cd721b..0000000 --- a/talon/community/community-cursorless-0.4.0/apps/kubectl/kubectl.py +++ /dev/null @@ -1,26 +0,0 @@ -from talon import Module, Context - -mod = Module() -mod.tag("kubectl", desc="tag for enabling kubectl commands in your terminal") -kubectl = "kubectl" - -ctx = Context() -ctx.matches = r""" -tag: user.kubectl -""" - -mod.list("kubectl_action", desc="actions performed by kubectl") -ctx.lists["self.kubectl_action"] = ("get", "delete", "describe", "label") - -mod.list("kubectl_object", desc="objects performed by kubectl") -ctx.lists["self.kubectl_object"] = ( - "nodes", - "jobs", - "pods", - "namespaces", - "services", - "events", - "deployments", - "replicasets", - "daemonsets", -) diff --git a/talon/community/community-cursorless-0.4.0/apps/kubectl/kubectl.talon b/talon/community/community-cursorless-0.4.0/apps/kubectl/kubectl.talon deleted file mode 100644 index a26ca07..0000000 --- a/talon/community/community-cursorless-0.4.0/apps/kubectl/kubectl.talon +++ /dev/null @@ -1,68 +0,0 @@ -tag: terminal -and tag: user.kubectl -- -cube [control]: "kubectl " - -cube create: "kubectl create " -cube expose: "kubectl expose " -cube run: "kubectl run " -cube set: "kubectl set " -cube run container: "kubectl run-container " - -cube explain: "kubectl explain " -cube get: "kubectl get " -cube edit: "kubectl edit " -cube delete: "kubectl delete " - -cube rollout: "kubectl rollout " -cube rolling-update: "kubectl rolling-update " -cube scale: "kubectl scale " -cube auto scale: "kubectl autoscale " - -cube certificate: "kubectl certificate " -cube top: "kubectl top " -cube drain: "kubectl drain " -cube taint: "kubectl taint " -cube (cord | cordon): "kubectl cordon " -cube (uncord | uncordon): "kubectl uncordon " -cube cluster (info | information): "kubectl cluster-info " - -cube describe: "kubectl describe " -cube logs: "kubectl logs " -cube attach: "kubectl attach " -cube exec: "kubectl exec " -cube port forward: "kubectl port-forward " -cube proxy: "kubectl proxy " -cube copy: "kubectl cp " -cube auth: "kubectl auth " - -cube diff: "kubectl diff " -cube apply: "kubectl apply " -cube patch: "kubectl patch " -cube replace: "kubectl replace " -cube wait: "kubectl wait " -cube convert: "kubectl convert " -cube customize: "kubectl kustomize " - -cube label: "kubectl label " -cube annotate: "kubectl annotate " -cube completion: "kubectl completion " - -cube (interface | API): "kubectl api " -cube interface resources: "kubectl api-resources " -cube interface versions: "kubectl api-versions " -cube config: "kubectl config " -cube help: "kubectl help " -cube plugin: "kubectl plugin " -cube version: "kubectl version " - -cube {user.kubectl_action} [{user.kubectl_object}]: - insert("kubectl {kubectl_action} ") - insert(kubectl_object or "") - -cube detach: - key("ctrl-p") - key("ctrl-q") -cube shell: - insert("kubectl exec -it -- /bin/bash") - key("left:13") diff --git a/talon/community/community-cursorless-0.4.0/apps/linear.py b/talon/community/community-cursorless-0.4.0/apps/linear.py deleted file mode 100644 index 3483f06..0000000 --- a/talon/community/community-cursorless-0.4.0/apps/linear.py +++ /dev/null @@ -1,11 +0,0 @@ -from talon import ctrl, ui, Module, Context, actions, clip, app - -ctx = Context() -mod = Module() -apps = mod.apps -apps.linear = """ -app.name: Linear -""" -ctx.matches = r""" -app: linear -""" diff --git a/talon/community/community-cursorless-0.4.0/apps/linear.talon b/talon/community/community-cursorless-0.4.0/apps/linear.talon deleted file mode 100644 index 3ae4db5..0000000 --- a/talon/community/community-cursorless-0.4.0/apps/linear.talon +++ /dev/null @@ -1,7 +0,0 @@ -app: linear -- -show cycle active: "gv" -show cycle upcoming: "gw" -(please | issue hunt) []: - key(cmd-k) - insert(user.text or "") \ No newline at end of file diff --git a/talon/community/community-cursorless-0.4.0/apps/linux/dunst.talon b/talon/community/community-cursorless-0.4.0/apps/linux/dunst.talon deleted file mode 100644 index 802df00..0000000 --- a/talon/community/community-cursorless-0.4.0/apps/linux/dunst.talon +++ /dev/null @@ -1,9 +0,0 @@ -os: linux -- - -show notifications: key(ctrl-`) -dismiss [notifications]: user.system_command('dunstctl close') -dismiss all [notifications]: user.system_command('dunstctl close-all') -#dunce pause: user.system_command('notify-send "DUNST_COMMAND_PAUSE"') -#dunce resume: user.system_command('notify-send "DUNST_COMMAND_RESUME"') -#test notification: user.system_command('notify-send "Hello from Talon"') diff --git a/talon/community/community-cursorless-0.4.0/apps/linux/gnome-terminal.talon b/talon/community/community-cursorless-0.4.0/apps/linux/gnome-terminal.talon deleted file mode 100644 index ac4fad7..0000000 --- a/talon/community/community-cursorless-0.4.0/apps/linux/gnome-terminal.talon +++ /dev/null @@ -1,5 +0,0 @@ -os: linux -app.name: Gnome-terminal -- -tag(): terminal -tag(): user.git diff --git a/talon/community/community-cursorless-0.4.0/apps/linux/guake.talon b/talon/community/community-cursorless-0.4.0/apps/linux/guake.talon deleted file mode 100644 index 90fb217..0000000 --- a/talon/community/community-cursorless-0.4.0/apps/linux/guake.talon +++ /dev/null @@ -1,19 +0,0 @@ -os: linux -app: Guake -- -#comment or remove tags for command sets you don't want -#quake doesn't support the file_manager stuff -#tag(): user.file_manager -tag(): user.git -tag(): user.kubectl -tag(): user.tabs -tag(): terminal - -action(app.tab_open): - key(ctrl-shift-t) -action(app.tab_close): - key(ctrl-shift-w) -action(app.tab_next): - key(ctrl-pagedown) -action(app.tab_previous): - key(ctrl-pageup) diff --git a/talon/community/community-cursorless-0.4.0/apps/linux/keepassx.talon b/talon/community/community-cursorless-0.4.0/apps/linux/keepassx.talon deleted file mode 100644 index bcf8a08..0000000 --- a/talon/community/community-cursorless-0.4.0/apps/linux/keepassx.talon +++ /dev/null @@ -1,22 +0,0 @@ -app: keepass -- -# Database -open database: key(ctrl-o) -save database: key(ctrl-s) -close database: key(ctrl-w) -lock database: key(ctrl-l) -quit: key(ctrl-q) - -# Entries -[add] new entry: key(ctrl-n) -clone entry: key(ctrl-k) -(view|edit) entry: key(ctrl-e) -delete entry: key(ctrl-d) -copy user [name]: key(ctrl-b) -copy password: key(ctrl-c) -open (earl|url|link): key(ctrl-u) -copy (earl|url|link): key(ctrl-alt-u) -find: key(ctrl-f) -find : - key(ctrl-f) - insert("{text}") diff --git a/talon/community/community-cursorless-0.4.0/apps/linux/signal.talon b/talon/community/community-cursorless-0.4.0/apps/linux/signal.talon deleted file mode 100644 index e0d74bc..0000000 --- a/talon/community/community-cursorless-0.4.0/apps/linux/signal.talon +++ /dev/null @@ -1,42 +0,0 @@ -app: signal -- -show shortcuts: key("ctrl-/") - -# Note that the order below matches Keyboard Shortcuts listings - -# Navigation -(next|nav|navigate) [by] (sec|section): key("ctrl-t") -(prev|previous) (chat|conversation): key("alt-down") -next (chat|conversation): key("alt-up") -(prev|previous) unread: key("alt-shift-down") -next unread: key("alt-shift-up") -[open] (pref|preferences): key("ctrl-,") -open conversation menu: key("ctrl-shift-l") -search: key("ctrl-f") -search chat: key("ctrl-shift-f") -focus (chat|composer): key("ctrl-shift-t") -open media: key("ctrl-shift-m") -open emoji: key("ctrl-shift-j") -open sticker: key("ctrl-shift-s") -record [voice] message: key("ctrl-shift-v") -archive chat: key("ctrl-shift-a") -unarchive chat: key("ctrl-shift-u") -(first|top) message: key("ctrl-up") -(last|bottom) message: key("ctrl-down") -close chat: key("ctrl-shift-c") - -# Messages -send it: key("enter") -message details: key("ctrl-d") -reply [message]: key("ctrl-shift-r") -react [message]: key("ctrl-shift-e") -save attachment: key("ctrl-s") -delete [message]: key("ctrl-shift-d") - -# Composer -send message: key("ctrl-enter") -expand chat: key("ctrl-shift-x") -attach [file]: key("ctrl-u") -remove [link] preview: key("ctrl-p") -remove [link] attachment: key("ctrl-shift-p") - diff --git a/talon/community/community-cursorless-0.4.0/apps/linux/taskwarrior.talon b/talon/community/community-cursorless-0.4.0/apps/linux/taskwarrior.talon deleted file mode 100644 index 3868c7d..0000000 --- a/talon/community/community-cursorless-0.4.0/apps/linux/taskwarrior.talon +++ /dev/null @@ -1,30 +0,0 @@ -os: linux -tag: terminal -and tag: user.taskwarrior -- -# general -task version: "task --version\n" -task commands: "task commands\n" -task help: "task help\n" - -# task list -task list: "task list\n" -task list orphans: "task project: list\n" -task list untagged: "task tags.none: list\n" -task list : "task list {text}\n" -task list project: "task list project: " -task list project : "task list project:{text}\n" - -# task add -task add: "task add " -task add : "task add {text}\n" -task undo: "task undo\n" - -(tasks|task next): "task next\n" - -# task editing -task edit$: "task {number} edit" - -# task completion -task done$: "task {number} done" -task delete$: "task {number} delete" diff --git a/talon/community/community-cursorless-0.4.0/apps/linux/terminal.talon b/talon/community/community-cursorless-0.4.0/apps/linux/terminal.talon deleted file mode 100644 index 66980d4..0000000 --- a/talon/community/community-cursorless-0.4.0/apps/linux/terminal.talon +++ /dev/null @@ -1,46 +0,0 @@ -os: linux -tag: terminal -- -tag(): user.file_manager -#todo: generic tab commands -#tag(): tabs -action(edit.page_down): - key(shift-pagedown) -action(edit.page_up): - key(shift-pageup) -action(edit.paste): - key(ctrl-shift-v) -action(edit.copy): - key(ctrl-shift-c) - -run last: - key(up) - key(enter) -rerun : - key(ctrl-r) - insert(text) -rerun search: - key(ctrl-r) -kill all: - key(ctrl-c) - -# XXX - these are specific to certain terminals only and should move into their -# own .talon file -action(edit.find): - key(ctrl-shift-f) -action(edit.word_left): - key(ctrl-w left) -action(edit.word_right): - key(ctrl-w right) -action(app.tab_open): - key(ctrl-shift-t) -action(app.tab_close): - key(ctrl-shift-w) -action(app.tab_next): - key(ctrl-pagedown) -action(app.tab_previous): - key(ctrl-pageup) -action(app.window_open): - key(ctrl-shift-n) -go tab : - key("alt-{number}") diff --git a/talon/community/community-cursorless-0.4.0/apps/linux/termite.talon b/talon/community/community-cursorless-0.4.0/apps/linux/termite.talon deleted file mode 100644 index 143e508..0000000 --- a/talon/community/community-cursorless-0.4.0/apps/linux/termite.talon +++ /dev/null @@ -1,17 +0,0 @@ -app: termite -and not win.title: /VIM/ -- -#comment or remove tags for command sets you don't want -#termite doesn't support the file_manager stuff yet -#tag(): user.file_manager -tag(): user.kubectl -tag(): user.git -tag(): user.taskwarrior -tag(): terminal - -# Selection mode -shell yank: key("y") -shell select: key("ctrl-shift-space") -shell insert: key("escape") -visual line: key("v") -visual line mode: key("V") diff --git a/talon/community/community-cursorless-0.4.0/apps/linux/tmux.talon b/talon/community/community-cursorless-0.4.0/apps/linux/tmux.talon deleted file mode 100644 index a43706f..0000000 --- a/talon/community/community-cursorless-0.4.0/apps/linux/tmux.talon +++ /dev/null @@ -1,55 +0,0 @@ -os: linux -tag: user.tmux -- -mux: "tmux " - -#session management -mux new session: - insert('tmux new ') -mux sessions: - key(ctrl-b) - key(s) -mux name session: - key(ctrl-b) - key($) -mux kill session: - insert('tmux kill-session -t ') -#window management -mux new window: - key(ctrl-b) - key(c) -mux window : - key(ctrl-b ) - key('{number}') -mux previous window: - key(ctrl-b) - key(p) -mux next window: - key(ctrl-b) - key(n) -mux rename window: - key(ctrl-b) - key(,) -mux close window: - key(ctrl-b) - key(&) -#pane management -mux split horizontal: - key(ctrl-b) - key(%) -mux split vertical: - key(ctrl-b) - key(") -mux next pane: - key(ctrl-b) - key(o) -mux move : - key(ctrl-b) - key(arrow_key) -mux close pane: - key(ctrl-b) - key(x) -#Say a number right after this command, to switch to pane -mux pane numbers: - key(ctrl-b) - key(q) diff --git a/talon/community/community-cursorless-0.4.0/apps/mac/app.talon b/talon/community/community-cursorless-0.4.0/apps/mac/app.talon deleted file mode 100644 index fafc33e..0000000 --- a/talon/community/community-cursorless-0.4.0/apps/mac/app.talon +++ /dev/null @@ -1,40 +0,0 @@ -os: mac -- -action(app.preferences): - key(cmd-,) - -action(app.tab_close): - key(cmd-w) - -#action(app.tab_detach): -# Move the current tab to a new window - -action(app.tab_next): - key(cmd-alt-right) - -action(app.tab_open): - key(cmd-t) - -action(app.tab_previous): - key(cmd-alt-left) - -action(app.tab_reopen): - key(cmd-shift-t) - -action(app.window_close): - key(cmd-w) - -action(app.window_hide): - key(cmd-m) - -action(app.window_hide_others): - key(cmd-alt-h) - -action(app.window_next): - key(cmd-`) - -action(app.window_open): - key(cmd-n) - -action(app.window_previous): - key(cmd-shift-`) diff --git a/talon/community/community-cursorless-0.4.0/apps/mac/datagrip.talon b/talon/community/community-cursorless-0.4.0/apps/mac/datagrip.talon deleted file mode 100644 index c1883b1..0000000 --- a/talon/community/community-cursorless-0.4.0/apps/mac/datagrip.talon +++ /dev/null @@ -1,17 +0,0 @@ -app: datagrip -- -run: key(cmd-enter) -run it: - key(cmd-enter) - sleep(50ms) - key(enter) -back: - key(alt-left) -fwack: - key(alt-right) -erase: - key(alt-backspace) -move up: - key(cmd-shift-up) -move down: - key(cmd-shift-down) diff --git a/talon/community/community-cursorless-0.4.0/apps/mac/desktops.py b/talon/community/community-cursorless-0.4.0/apps/mac/desktops.py deleted file mode 100644 index 1528d54..0000000 --- a/talon/community/community-cursorless-0.4.0/apps/mac/desktops.py +++ /dev/null @@ -1,65 +0,0 @@ -import contextlib -import time - -from talon import actions, ctrl, Module, ui, Context - - -mod = Module() - - -@mod.action_class -class ModuleActions: - def desktop(number: int): - "change the current desktop" - - def window_move_desktop_left(): - """move the current window to the desktop to the left""" - - def window_move_desktop_right(): - """move the current window to the desktop to the right""" - - def window_move_desktop(desktop_number: int): - """move the current window to a different desktop""" - - -ctx = Context() -ctx.matches = r""" -os: mac -""" - - -@contextlib.contextmanager -def _drag_window_mac(win=None): - if win is None: - win = ui.active_window() - fs = win.children.find(AXSubrole="AXFullScreenButton")[0] - rect = fs.AXFrame["$rect2d"] - x = rect["x"] + rect["width"] + 5 - y = rect["y"] + rect["height"] / 2 - ctrl.mouse_move(x, y) - ctrl.mouse_click(button=0, down=True) - yield - time.sleep(0.1) - ctrl.mouse_click(button=0, up=True) - - -@ctx.action_class("self") -class MacActions: - def desktop(number: int): - if number < 10: - actions.key("ctrl-{}".format(number)) - - def window_move_desktop_left(): - with _drag_window_mac(): - actions.key("ctrl-cmd-alt-left") - - def window_move_desktop_right(): - with _drag_window_mac(): - actions.key("ctrl-cmd-alt-right") - - def window_move_desktop(desktop_number: int): - if ui.apps(bundle="com.amethyst.Amethyst"): - actions.key(f"ctrl-alt-shift-{desktop_number}") - else: - with _drag_window_mac(): - actions.key(f"ctrl-{desktop_number}") diff --git a/talon/community/community-cursorless-0.4.0/apps/mac/desktops.talon b/talon/community/community-cursorless-0.4.0/apps/mac/desktops.talon deleted file mode 100644 index 340393c..0000000 --- a/talon/community/community-cursorless-0.4.0/apps/mac/desktops.talon +++ /dev/null @@ -1,8 +0,0 @@ -# TODO: Once implementations exist for other platforms, maybe remove this -# restriction. -os: mac -- -desk : user.desktop(number) -window move desk : user.window_move_desktop(number) -window move desk left: user.window_move_desktop_left() -window move desk right: user.window_move_desktop_right() diff --git a/talon/community/community-cursorless-0.4.0/apps/mac/edit.talon b/talon/community/community-cursorless-0.4.0/apps/mac/edit.talon deleted file mode 100644 index c584356..0000000 --- a/talon/community/community-cursorless-0.4.0/apps/mac/edit.talon +++ /dev/null @@ -1,208 +0,0 @@ -os: mac -- -action(edit.copy): - key(cmd-c) - -action(edit.cut): - key(cmd-x) - -action(edit.delete): - key(backspace) - -action(edit.delete_line): - edit.select_line() - edit.delete() - -#action(edit.delete_paragraph): - -#action(edit.delete_sentence): - -action(edit.delete_word): - edit.select_word() - edit.delete() - -action(edit.down): - key(down) - -#action(edit.extend_again): - -#action(edit.extend_column): - -action(edit.extend_down): - key(shift-down) - -action(edit.extend_file_end): - key(cmd-shift-down) - -action(edit.extend_file_start): - key(cmd-shift-up) - -action(edit.extend_left): - key(shift-left) - -#action(edit.extend_line): - -action(edit.extend_line_down): - key(shift-down) - -action(edit.extend_line_end): - key(cmd-shift-right) - -action(edit.extend_line_start): - key(cmd-shift-left) - -action(edit.extend_line_up): - key(shift-up) - -action(edit.extend_page_down): - key(cmd-shift-pagedown) - -action(edit.extend_page_up): - key(cmd-shift-pageup) - -#action(edit.extend_paragraph_end): -#action(edit.extend_paragraph_next()): -#action(edit.extend_paragraph_previous()): -#action(edit.extend_paragraph_start()): - -action(edit.extend_right): - key(shift-right) - -#action(edit.extend_sentence_end): -#action(edit.extend_sentence_next): -#action(edit.extend_sentence_previous): -#action(edit.extend_sentence_start): - -action(edit.extend_up): - key(shift-up) - -action(edit.extend_word_left): - key(shift-alt-left) - -action(edit.extend_word_right): - key(shift-alt-right) - -action(edit.file_end): - key(cmd-down cmd-left) - -action(edit.file_start): - key(cmd-up cmd-left) - -action(edit.find): - key(cmd-f) - #actions.insert(text) - -action(edit.find_next): - key(cmd-g) - -action(edit.find_previous): - key(cmd-shift-g) - -action(edit.indent_less): - key(cmd-left delete) - -action(edit.indent_more): - key(cmd-left tab) - -#action(edit.jump_column(n: int) -#action(edit.jump_line(n: int) - -action(edit.left): - key(left) - -action(edit.line_down): - key(down home) - -action(edit.line_end): - key(cmd-right) - -action(edit.line_insert_down): - key(end enter) - -action(edit.line_insert_up): - key(cmd-left enter up) - -action(edit.line_start): - key(cmd-left) - -action(edit.line_up): - key(up cmd-left) - -#action(edit.move_again): - -action(edit.page_down): - key(pagedown) - -action(edit.page_up): - key(pageup) - -#action(edit.paragraph_end): -#action(edit.paragraph_next): -#action(edit.paragraph_previous): -#action(edit.paragraph_start): - -action(edit.paste): - key(cmd-v) - -action(edit.paste_match_style): - key(cmd-alt-shift-v) - -action(edit.print): - key(cmd-p) - -action(edit.redo): - key(cmd-shift-z) - -action(edit.right): - key(right) - -action(edit.save): - key(cmd-s) - -action(edit.save_all): - key(cmd-shift-s) - -action(edit.select_all): - key(cmd-a) - -action(edit.select_line): - key(cmd-right cmd-shift-left) - -#action(edit.select_lines(a: int, b: int)): - -action(edit.select_none): - key(right) - -#action(edit.select_paragraph): -#action(edit.select_sentence): - -action(edit.select_word): - edit.word_left() - edit.extend_word_right() - -#action(edit.selected_text): -> str -#action(edit.sentence_end): -#action(edit.sentence_next): -#action(edit.sentence_previous): -#action(edit.sentence_start): - -action(edit.undo): - key(cmd-z) - -action(edit.up): - key(up) - -action(edit.word_left): - key(alt-left) - -action(edit.word_right): - key(alt-right) - -action(edit.zoom_in): - key(cmd-=) - -action(edit.zoom_out): - key(cmd--) - -action(edit.zoom_reset): - key(cmd-0) diff --git a/talon/community/community-cursorless-0.4.0/apps/mac/finder/finder.py b/talon/community/community-cursorless-0.4.0/apps/mac/finder/finder.py deleted file mode 100644 index 5d9e70c..0000000 --- a/talon/community/community-cursorless-0.4.0/apps/mac/finder/finder.py +++ /dev/null @@ -1,83 +0,0 @@ -from talon import Context, Module, actions, imgui, settings, ui -from talon.experimental.locate import locate -from talon.mac import applescript - -import os - -mod = Module() -ctx = Context() -ctx.matches = r""" -app: finder -""" -directories_to_remap = {"": "/Volumes"} -directories_to_exclude = {} - - -@ctx.action_class("user") -class user_actions: - def file_manager_current_path(): - title = ui.active_window().title - - if "~" in title: - title = os.path.expanduser(title) - - if title in directories_to_remap: - title = directories_to_remap[title] - - if title in directories_to_exclude: - title = "" - - return title - - def file_manager_terminal_here(): - applescript.run( - r""" - tell application "Finder" - set myWin to window 1 - set thePath to (quoted form of POSIX path of (target of myWin as alias)) - tell application "Terminal" - activate - tell window 1 - do script "cd " & thePath - end tell - end tell - end tell""" - ) - - def file_manager_show_properties(): - """Shows the properties for the file""" - actions.key("cmd-i") - - def file_manager_open_directory(path: str): - """opens the directory that's already visible in the view""" - actions.key("cmd-shift-g") - actions.sleep("50ms") - actions.insert(path) - actions.key("enter") - - def file_manager_select_directory(path: str): - """selects the directory""" - actions.insert(path) - - def file_manager_new_folder(name: str): - """Creates a new folder in a gui filemanager or inserts the command to do so for terminals""" - actions.key("cmd-shift-n") - actions.insert(name) - - def file_manager_open_file(path: str): - """opens the file""" - actions.key("home") - actions.insert(path) - actions.key("cmd-o") - - def file_manager_select_file(path: str): - """selects the file""" - actions.key("home") - actions.insert(path) - - -@mod.action_class -class Actions: - def resize_finder_column(): - """Move mouse to resize a finder column""" - print(locate("templates/finder-resize.png")) diff --git a/talon/community/community-cursorless-0.4.0/apps/mac/finder/finder.talon b/talon/community/community-cursorless-0.4.0/apps/mac/finder/finder.talon deleted file mode 100644 index bddf5b0..0000000 --- a/talon/community/community-cursorless-0.4.0/apps/mac/finder/finder.talon +++ /dev/null @@ -1,39 +0,0 @@ -os: mac -app: finder -- -tag(): user.file_manager - -action(user.file_manager_open_parent): - key(cmd-up) - -action(user.file_manager_go_forward): - key("cmd-]") - -action(user.file_manager_go_back): - key("cmd-[") - -re size column: user.resize_finder_column() - -preferences: key(cmd-,) -options: key(cmd-j) -search: key(cmd-alt-f) - -# bit of a mouthful, but it's probably not the kind of thing you'd be saying frequently -sort by none: key(ctrl-alt-cmd-0) -sort by name: key(ctrl-alt-cmd-1) -sort by kind: key(ctrl-alt-cmd-2) -sort by date opened: key(ctrl-alt-cmd-3) -sort by date added: key(ctrl-alt-cmd-4) -sort by date modified: key(ctrl-alt-cmd-5) -sort by size: key(ctrl-alt-cmd-6) - -icon view: key(cmd-1) -column view: key(cmd-3) -list view: key(cmd-2) -gallery view: key(cmd-4) - -copy path: key(alt-cmd-c) -trash it: key(cmd-backspace) - -hide [finder]: key(cmd-h) -hide others: app.window_hide_others() diff --git a/talon/community/community-cursorless-0.4.0/apps/mac/iterm/iterm.py b/talon/community/community-cursorless-0.4.0/apps/mac/iterm/iterm.py deleted file mode 100644 index 766662f..0000000 --- a/talon/community/community-cursorless-0.4.0/apps/mac/iterm/iterm.py +++ /dev/null @@ -1,86 +0,0 @@ -from talon import Context, Module, actions, imgui, settings, ui -import os - -ctx = Context() -ctx.matches = r""" -app: iterm2 -""" -directories_to_remap = {} -directories_to_exclude = {} - - -@ctx.action_class("user") -class user_actions: - # def file_manager_current_path(): - # title = ui.active_window().title - - # if "~" in title: - # title = os.path.expanduser(title) - - # if title in directories_to_remap: - # title = directories_to_remap[title] - - # if title in directories_to_exclude: - # title = None - - # return title - - # def file_manager_show_properties(): - # """Shows the properties for the file""" - - # def file_manager_open_directory(path: str): - # """opens the directory that's already visible in the view""" - # actions.insert("cd ") - # path = '"{}"'.format(path) - # actions.insert(path) - # actions.key("enter") - # actions.user.file_manager_refresh_title() - - # def file_manager_select_directory(path: str): - # """selects the directory""" - # actions.insert(path) - - # def file_manager_new_folder(name: str): - # """Creates a new folder in a gui filemanager or inserts the command to do so for terminals""" - # name = '"{}"'.format(name) - - # actions.insert("mkdir " + name) - - # def file_manager_open_file(path: str): - # """opens the file""" - # actions.insert(path) - # actions.key("enter") - - # def file_manager_select_file(path: str): - # """selects the file""" - # actions.insert(path) - - def terminal_list_directories(): - actions.insert("ls") - actions.key("enter") - - def terminal_list_all_directories(): - actions.insert("ls -a") - actions.key("enter") - - def terminal_change_directory(path: str): - actions.insert("cd {}".format(path)) - if path: - actions.key("enter") - - def terminal_change_directory_root(): - """Root of current drive""" - actions.insert("cd /") - actions.key("enter") - - def terminal_clear_screen(): - """Clear screen""" - actions.key("ctrl-l") - - def terminal_run_last(): - actions.key("up enter") - - def terminal_kill_all(): - actions.key("ctrl-c") - actions.insert("y") - actions.key("enter") diff --git a/talon/community/community-cursorless-0.4.0/apps/mac/iterm/iterm.talon b/talon/community/community-cursorless-0.4.0/apps/mac/iterm/iterm.talon deleted file mode 100644 index b367f20..0000000 --- a/talon/community/community-cursorless-0.4.0/apps/mac/iterm/iterm.talon +++ /dev/null @@ -1,10 +0,0 @@ -os: mac -app: iterm2 -- -tag(): terminal -# todo: filemanager support -#tag(): user.file_manager -tag(): user.generic_terminal -tag(): user.git -tag(): user.kubectl -tag(): user.tabs \ No newline at end of file diff --git a/talon/community/community-cursorless-0.4.0/apps/mac/preview.py b/talon/community/community-cursorless-0.4.0/apps/mac/preview.py deleted file mode 100644 index 0ba0f70..0000000 --- a/talon/community/community-cursorless-0.4.0/apps/mac/preview.py +++ /dev/null @@ -1,11 +0,0 @@ -from talon import ctrl, ui, Module, Context, actions, clip, app - -ctx = Context() -mod = Module() -apps = mod.apps -apps.preview = """ -app.name: Preview -""" -ctx.matches = r""" -app: preview -""" diff --git a/talon/community/community-cursorless-0.4.0/apps/mac/preview.talon b/talon/community/community-cursorless-0.4.0/apps/mac/preview.talon deleted file mode 100644 index c3d7fbd..0000000 --- a/talon/community/community-cursorless-0.4.0/apps/mac/preview.talon +++ /dev/null @@ -1,9 +0,0 @@ -app: preview -- - page : - key(cmd-alt-g) - "{number}" - key(enter) -add text []: - key(cmd-ctrl-t:2) - insert(text or "") \ No newline at end of file diff --git a/talon/community/community-cursorless-0.4.0/apps/mac/rstudio.talon b/talon/community/community-cursorless-0.4.0/apps/mac/rstudio.talon deleted file mode 100644 index 21b3e51..0000000 --- a/talon/community/community-cursorless-0.4.0/apps/mac/rstudio.talon +++ /dev/null @@ -1,127 +0,0 @@ -os: mac -app: RStudio -- - -run that: key("cmd-enter") -run document: key("cmd-alt-r") -run from top: key("cmd-alt-b") -run to end: key("cmd-alt-e") -run (function|funk): key("cmd-alt-f") -run section: key("cmd-alt-t") -run previous chunks: key("cmd-alt-p") -run chunk: key("cmd-alt-c") -run next chunk: key("cmd-alt-n") -run all: key("cmd-shift-s") -run knitter: key("cmd-shift-k") -run profiler: key("cmd-shift-alt-p") - -# Moving around and formatting -jump back: key("cmd-f9") -jump forward: key("cmd-f10") -close all tabs: key("cmd-shift-w") -indent lines: key("cmd-i") -toggle comment: key("cmd-shift-c") -reformat comment: key("cmd-shift-/") -reformat R code: key("cmd-shift-a") -line up: key("alt-up") -line down: key("alt-down") -duplicate line up: key("cmd-alt-up") -duplicate line [down]: key("cmd-alt-down") -select to paren: key("ctrl-shift-e") -select to matching paren: key("ctrl-shift-alt-e") -jump to matching: key("ctrl-p") -expand selection: key("shift-alt-cmd-up") -reduce selection: key("shift-alt-cmd-down") -add cursor up: key("ctrl-alt-up") -add cursor down: key("ctrl-alt-down") -move active cursor up: key("ctrl-alt-shift-up") -move active cursor down: key("ctrl-alt-shift-down") -delete line: key("cmd-d") -delete word left: key("alt-backspace") -delete word right: key("alt-delete") -assign that: key("alt--") -pipe that: key("cmd-shift-m") -insert knitter chunk: key("cmd-alt-i") - -# Folding -fold that: key("cmd-alt-l") -unfold that: key("cmd-shift-alt-l") -fold all: key("cmd-alt-o") -unfold all: key("cmd-shift-alt-o") - -# Find and replace -find and replace: key("cmd-f") -find next: key("cmd-g") -find previous: key("cmd-shift-g") -find with selection: key("cmd-e") -find in files: key("cmd-shift-f") -run replace: key("cmd-shift-j") -run spell check: key("f7") - -# Navigation and panels -go to source: key("ctrl-1") -go to console: key("ctrl-2") -go to help: key("ctrl-3") -go to history: key("ctrl-4") -go to files: key("ctrl-5") -go to (plots|plot): key("ctrl-6") -go to packages: key("ctrl-7") -go to environment: key("ctrl-8") -go to git: key("ctrl-9") -go to build: key("ctrl-0") -go to terminal: key("alt-shift-t") -go to omni: key("ctrl-.") -go to line: key("cmd-shift-alt-g") -go to section: key("cmd-shift-alt-j") -go to tab: key("ctrl-shift-.") -go to previous tab: key("ctrl-f11") -go to next tab: key("ctrl-f12") -go to first tab: key("ctrl-shift-f11") -go to last tab: key("ctrl-shift-f12") - -zoom source: key("ctrl-shift-1") -(zoom|show) all: key("ctrl-shift-0") - -help that: key("f1") -define that: key("f2") -previous plot: key("cmd-alt-f11") -next plot: key("cmd-alt-f12") - -# devtools, package development, and session management -restart R session: key("cmd-shift-f10") -dev tools build: key("cmd-shift-b") -dev tools load all: key("cmd-shift-l") -dev tools test: key("cmd-shift-t") -dev tools check: key("cmd-shift-e") -dev tools document: key("cmd-shift-d") - -# Debugging -toggle breakpoint: key("shift-f9") -debug next: key("f10") -debug step into (function|funk): key("shift-f4") -debug finish (function|funk): key("shift-f6") -debug continue: key("shift-f5") -debug stop: key("shift-f8") - -# Git/SVN -run git diff: key("ctrl-alt-d") -run git commit: key("ctrl-alt-m") - -# Other shortcuts that could be enabled -# run line and stay: key("alt-enter") -# run and echo all: key("cmd-shift-enter") -# extract (function|funk): key("cmd-alt-x") -# extract variable: key("cmd-alt-v") -# new terminal: key("shift-alt-t") -# rename current terminal: key("shift-alt-r") -# clear current terminal: key("ctrl-shift-l") -# previous terminal: key("ctrl-alt-f11") -# next terminal: key("ctrl-alt-f12") -# clear console: key("ctrl-l") -# popup history: key("cmd-up") -# change working directory: key("ctrl-shift-h") -# new document: key("cmd-shift-n") -# new document (chrome only): key("cmd-shift-alt-n") -# insert code section: key("cmd-shift-r") -# scroll diff view: key("ctrl-up/down") -# sync editor & pdf preview: key("cmd-f8") diff --git a/talon/community/community-cursorless-0.4.0/apps/mac/safari.py b/talon/community/community-cursorless-0.4.0/apps/mac/safari.py deleted file mode 100644 index 2e3c869..0000000 --- a/talon/community/community-cursorless-0.4.0/apps/mac/safari.py +++ /dev/null @@ -1,32 +0,0 @@ -from talon import ctrl, ui, Module, Context, actions, clip, app - -ctx = Context() -mod = Module() -apps = mod.apps -mod.apps.safari = """ -os: mac -and app.bundle: com.apple.Safari -""" - -ctx.matches = r""" -app: safari -""" - - -@ctx.action_class("user") -class user_actions: - def tab_jump(number: int): - if number < 9: - actions.key("cmd-{}".format(number)) - - def tab_final(): - actions.key("cmd-9") - - -@ctx.action_class("browser") -class browser_actions: - def go(url: str): - actions.browser.focus_address() - actions.sleep("50ms") - actions.insert(url) - actions.key("enter") diff --git a/talon/community/community-cursorless-0.4.0/apps/mac/safari.talon b/talon/community/community-cursorless-0.4.0/apps/mac/safari.talon deleted file mode 100644 index a640afe..0000000 --- a/talon/community/community-cursorless-0.4.0/apps/mac/safari.talon +++ /dev/null @@ -1,68 +0,0 @@ -app: safari -- -tag(): browser -tag(): user.tabs -#action(browser.address): - -action(browser.bookmark): - key(cmd-d) - -action(browser.bookmark_tabs): - key(cmd-shift-d) - -action(browser.bookmarks): - key(cmd-alt-b) - -#action(browser.bookmarks_bar): -# key(ctrl-shift-b) - -action(browser.focus_address): - key(cmd-l) - -#action(browser.focus_page): - -action(browser.focus_search): - browser.focus_address() - -action(browser.go_blank): - key(cmd-n) - -action(browser.go_back): - key(cmd-left) - -action(browser.go_forward): - key(cmd-right) - -action(browser.go_home): - key(cmd-shift-h) - -action(browser.open_private_window): - key(cmd-shift-n) - -action(browser.reload): - key(cmd-r) - -action(browser.reload_hard): - key(cmd-shift-r) - -#action(browser.reload_hardest): - -#action(browser.show_clear_cache): -# key(cmd-shift-delete) - -action(browser.show_downloads): - key(cmd-shift-j) - -action(browser.show_extensions): - key(ctrl-shift-a) - -action(browser.show_history): - key(cmd-y) - -action(browser.submit_form): - key(enter) - -#action(browser.title) - -action(browser.toggle_dev_tools): - key(cmd-alt-i) diff --git a/talon/community/community-cursorless-0.4.0/apps/mac/terminal/terminal.py b/talon/community/community-cursorless-0.4.0/apps/mac/terminal/terminal.py deleted file mode 100644 index 50c98a6..0000000 --- a/talon/community/community-cursorless-0.4.0/apps/mac/terminal/terminal.py +++ /dev/null @@ -1,87 +0,0 @@ -from talon import Context, Module, actions, imgui, settings, ui -import os - -ctx = Context() -ctx.matches = r""" -app: apple_terminal -""" -directories_to_remap = {} -directories_to_exclude = {} - - -@ctx.action_class("user") -class user_actions: - def file_manager_current_path(): - title = ui.active_window().title - - if "~" in title: - title = os.path.expanduser(title) - - if title in directories_to_remap: - title = directories_to_remap[title] - - if title in directories_to_exclude: - title = None - - return title - - def file_manager_show_properties(): - """Shows the properties for the file""" - - def file_manager_open_directory(path: str): - """opens the directory that's already visible in the view""" - actions.insert("cd ") - path = '"{}"'.format(path) - actions.insert(path) - actions.key("enter") - actions.user.file_manager_refresh_title() - - def file_manager_select_directory(path: str): - """selects the directory""" - actions.insert(path) - - def file_manager_new_folder(name: str): - """Creates a new folder in a gui filemanager or inserts the command to do so for terminals""" - name = '"{}"'.format(name) - - actions.insert("mkdir " + name) - - def file_manager_open_file(path: str): - """opens the file""" - actions.insert(path) - actions.key("enter") - - def file_manager_select_file(path: str): - """selects the file""" - actions.insert(path) - - def terminal_list_directories(): - actions.insert("ls") - actions.key("enter") - - def terminal_list_all_directories(): - actions.insert("ls -a") - actions.key("enter") - - def terminal_change_directory(path: str): - actions.insert("cd {}".format(path)) - if path: - actions.key("enter") - - def terminal_change_directory_root(): - """Root of current drive""" - actions.insert("cd /") - actions.key("enter") - - def terminal_clear_screen(): - """Clear screen""" - actions.key("ctrl-l") - - def terminal_run_last(): - actions.key("up enter") - - def terminal_kill_all(): - actions.key("ctrl-c") - actions.insert("y") - actions.key("enter") - diff --git a/talon/community/community-cursorless-0.4.0/apps/mac/terminal/terminal.talon b/talon/community/community-cursorless-0.4.0/apps/mac/terminal/terminal.talon deleted file mode 100644 index 24a6409..0000000 --- a/talon/community/community-cursorless-0.4.0/apps/mac/terminal/terminal.talon +++ /dev/null @@ -1,35 +0,0 @@ -app: apple_terminal -- -#comment or remove tags for command sets you don't want -tag(): user.file_manager -tag(): user.generic_terminal -tag(): user.git -tag(): user.kubectl -tag(): user.tabs -tag(): terminal - -action(user.file_manager_open_parent): - insert("cd ..") - key(enter) -action(app.tab_open): - key(cmd-t) -action(app.tab_close): - key(cmd-w) -action(app.tab_next): - key(ctrl-tab) -action(app.tab_previous): - key(ctrl-shift-tab) -action(app.window_open): - key(cmd-n) -action(edit.page_down): - key(command-pagedown) -action(edit.page_up): - key(command-pageup) -rerun search: - key(ctrl-r) -suspend: - key(ctrl-z) -resume: - insert("fg") - key(enter) - diff --git a/talon/community/community-cursorless-0.4.0/apps/mac/things3.py b/talon/community/community-cursorless-0.4.0/apps/mac/things3.py deleted file mode 100644 index 7bf599c..0000000 --- a/talon/community/community-cursorless-0.4.0/apps/mac/things3.py +++ /dev/null @@ -1,143 +0,0 @@ -from typing import Dict, Optional -import webbrowser -from talon import ctrl, ui, Module, Context, actions, clip, app -from dataclasses import dataclass -from things3.things3 import Things3 -from ...code.create_spoken_forms import create_spoken_forms -import io -import csv - -ctx = Context() -mod = Module() -apps = mod.apps -apps.things3 = """ -app.name: Things -""" -ctx.matches = r""" -app: things3 -""" - -mod.list("things_tag", desc="Tags in Things") -mod.list("things_tag_with_shortcut", desc="Tags in Things within an assigned shortcut") -mod.list("things_project", desc="Areas and projects in Things") - -things = Things3() - - -@dataclass -class Tag: - uuid: str - title: str - shortcut: Optional[str] - - -@dataclass -class Project: - uuid: str - title: str - - -raw_areas = things.get_areas() -raw_projects = things.get_projects() -sql_query = f""" -SELECT TAG.title, TAG.shortcut, TAG.uuid -FROM {things.TABLE_TAG} AS TAG -""" -tags = [Tag(**raw_tag) for raw_tag in things.execute_query(sql_query)] -projects = [ - Project(uuid=raw_project["uuid"], title=raw_project["title"]) - for raw_project in raw_areas + raw_projects -] - -tag_map: Dict[str, Tag] = {tag.uuid: tag for tag in tags} -project_map = {project.uuid: project for project in projects} - -ctx.lists["self.things_tag"] = { - spoken_form: tag.uuid - for tag in tags - for spoken_form in create_spoken_forms(tag.title) -} -ctx.lists["self.things_tag_with_shortcut"] = { - spoken_form: tag.uuid - for tag in tags - if tag.shortcut is not None - for spoken_form in create_spoken_forms(tag.title) -} -things_projects = { - spoken_form: project.uuid - for project in projects - for spoken_form in create_spoken_forms(project.title) -} -print(things_projects) -ctx.lists["self.things_project"] = things_projects - - -@mod.action_class -class Actions: - def tag_todo(things_tags: str): - """Tag todo with a list of tags""" - tag_list = [tag_map[tag_uuid] for tag_uuid in things_tags.split(",")] - tags_with_shortcuts = [tag for tag in tag_list if tag.shortcut is not None] - tags_without_shortcuts = [tag for tag in tag_list if tag.shortcut is None] - - for tag in tags_with_shortcuts: - actions.key(f"ctrl-{tag.shortcut}") - - for tag in tags_without_shortcuts: - actions.key(f"cmd-shift-t") - actions.insert(tag.title) - actions.key("enter") - - def filter_by_tag(things_tags: str): - """Tag todo with a list of tags""" - tag_list = [tag_map[tag_uuid] for tag_uuid in things_tags.split(",")] - - for tag in tag_list: - if tag.shortcut is None: - raise Exception("Can only filter by tags with assigned shortcuts") - actions.key(f"ctrl-alt-{tag.shortcut}") - - def show_tag(things_tag: str): - """Show a particular tag in things""" - tag = tag_map[things_tag] - webbrowser.open(f"things:///show?id={tag.uuid}") - - def show_things_list(things_project: str): - """Show a list in things""" - project = project_map[things_project] - webbrowser.open(f"things:///show?id={project.uuid}") - - def move_todo(project: str): - """Move todo to a particular list""" - try: - project = project_map[project].title - except KeyError: - pass - actions.key("cmd-shift-m") - actions.insert(project) - actions.key("enter") - - -@mod.capture(rule="{self.things_tag}+") -def things_tags(m) -> str: - "One or more Things tags" - return ",".join(m.things_tag_list) - - -@mod.capture(rule="{self.things_tag_with_shortcut}+") -def things_tags_with_shortcut(m) -> str: - "One or more Things tags" - return ",".join(m.things_tag_with_shortcut_list) - - -@mod.capture(rule="{self.things_project}+") -def things_projects(m) -> str: - "One or more Things projects" - return to_csv_row_string(m.things_project_list) - - -def to_csv_row_string(row_elements: str) -> str: - output = io.StringIO() - writer = csv.writer(output, quoting=csv.QUOTE_MINIMAL) - writer.writerow(row_elements) - return output.getvalue() diff --git a/talon/community/community-cursorless-0.4.0/apps/mac/things3.talon b/talon/community/community-cursorless-0.4.0/apps/mac/things3.talon deleted file mode 100644 index 7f83ac7..0000000 --- a/talon/community/community-cursorless-0.4.0/apps/mac/things3.talon +++ /dev/null @@ -1,51 +0,0 @@ -app: things3 -- -tag(): user.todo_list - -new task: key(cmd-n) -action(user.mark_complete): key(cmd-.) -action(user.mark_cancelled): key(cmd-alt-.) - -action(user.show_inbox): key(cmd-1) -action(user.show_today): key(cmd-2) -action(user.show_upcoming): key(cmd-3) -action(user.show_anytime): key(cmd-4) -action(user.show_someday): key(cmd-5) -action(user.show_logbook): key(cmd-6) -show tag {user.things_tag}: user.show_tag(things_tag) -show list {user.things_project}: user.show_things_list(things_project) - -follow link: key(cmd-alt-enter) - -tag this : user.tag_todo(things_tags) -move this [to] {user.things_project}: user.move_todo(things_project) -move this [to] inbox: user.move_todo("Inbox") - -do this today: key(cmd-t) -do this evening: key(cmd-e) -do this (anytime | any time): key(cmd-r) -do this someday: key(cmd-o) -do this : - key(cmd-s) - insert(text) - key(enter) - -deadline : - key(cmd-shift-d) - insert(text) - key(enter) - -clear deadline: - key(cmd-shift-d backspace enter) - -filter [tag] : user.filter_by_tag(things_tags) -clear filter: key(ctrl-escape) - -action(user.dental_click): key(cmd-enter) - -add checklist: key(cmd-shift-c) - -drag [this] way up: key(cmd-alt-up) -drag [this] way down: key(cmd-alt-down) -drag [this] up: key(cmd-up) -drag [this] down: key(cmd-down) \ No newline at end of file diff --git a/talon/community/community-cursorless-0.4.0/apps/slack/slack.mac.talon b/talon/community/community-cursorless-0.4.0/apps/slack/slack.mac.talon deleted file mode 100644 index c994744..0000000 --- a/talon/community/community-cursorless-0.4.0/apps/slack/slack.mac.talon +++ /dev/null @@ -1,65 +0,0 @@ -os: mac -app: slack -- -tag(): user.messaging -# Workspace -workspace : key("cmd-{number}") -action(user.messaging_workspace_previous): key(cmd-shift-[) -action(user.messaging_workspace_next): key(cmd-shift-]) -# Channel -(slack | lack) [channel] info: key(cmd-shift-i) -action(user.messaging_open_channel_picker): key(cmd-k) -action(user.messaging_channel_previous): key(alt-up) -action(user.messaging_channel_next): key(alt-down) -action(user.messaging_unread_previous): key(alt-shift-up) -action(user.messaging_unread_next): key(alt-shift-down) - # Navigation -(move | next) focus: key(ctrl-`) -[next] (section | zone): key(f6) -(previous | last) (section | zone): key(shift-f6) -(slack | lack) [direct] messages: key(cmd-shift-k) -(slack | lack) threads: key(cmd-shift-t) -(slack | lack) (history [next] | back | backward): key(cmd-[) -(slack | lack) forward: key(cmd-]) -[next] (element | bit): key(tab) -(previous | last) (element | bit): key(shift-tab) -(slack | lack) (my stuff | activity): key(cmd-shift-m) -(slack | lack) directory: key(cmd-shift-e) -(slack | lack) (starred [items] | stars): key(cmd-shift-s) -(slack | lack) unread [messages]: key(cmd-j) -(go | undo | toggle) full: key(ctrl-cmd-f) -action(user.messaging_open_search): key(cmd-f) - # Messaging -grab left: key(shift-up) -grab right: key(shift-down) -add line: key(shift-enter) -(slack | lack) (slap | slaw | slapper): key(cmd-right shift-enter) -(slack | lack) (react | reaction): key(cmd-shift-\\) -(insert command | commandify): key(cmd-shift-c) -insert code: - insert("``````") - key(left left left) - key(shift-enter) - key(shift-enter) - key(up) -(slack | lack) (bull | bullet | bulleted) [list]: key(cmd-shift-8) -(slack | lack) (number | numbered) [list]: key(cmd-shift-7) -(slack | lack) (quotes | quotation): key(cmd-shift->) -bold: key(cmd-b) -(italic | italicize): key(cmd-i) -(strike | strikethrough): key(cmd-shift-x) -action(user.messaging_mark_workspace_read): key(shift-esc) -action(user.messaging_mark_channel_read): key(esc) -(clear | scrap | scratch): key(cmd-a backspace) - # Files and Snippets -action(user.messaging_upload_file): key(cmd-u) -(slack | lack) snippet: key(cmd-shift-enter) - # Calls -([toggle] mute | unmute): key(m) -(slack | lack) ([toggle] video): key(v) -(slack | lack) invite: key(a) - # Miscellaneous -(slack | lack) shortcuts: key(cmd-/) -emote : "{text}" -toggle left sidebar: key(cmd-shift-d) -toggle right sidebar: key(cmd-.) diff --git a/talon/community/community-cursorless-0.4.0/apps/slack/slack.py b/talon/community/community-cursorless-0.4.0/apps/slack/slack.py deleted file mode 100644 index 3254e86..0000000 --- a/talon/community/community-cursorless-0.4.0/apps/slack/slack.py +++ /dev/null @@ -1,15 +0,0 @@ -from talon import Module - -mod = Module() -apps = mod.apps -apps.slack = "app.name: Slack" -mod.apps.slack = """ -os: windows -and app.name: slack.exe -os: windows -and app.exe: slack.exe -""" -apps.slack = """ -os: mac -and app.bundle: com.tinyspeck.slackmacgap -""" diff --git a/talon/community/community-cursorless-0.4.0/apps/slack/slack.win.talon b/talon/community/community-cursorless-0.4.0/apps/slack/slack.win.talon deleted file mode 100644 index 897f1c2..0000000 --- a/talon/community/community-cursorless-0.4.0/apps/slack/slack.win.talon +++ /dev/null @@ -1,67 +0,0 @@ -os: windows -os: linux -app: slack -#todo: some sort of plugin, consolidate with teams or something? -- -tag(): user.messaging -# Workspaces -workspace : key("ctrl-{number}") -action(user.messaging_workspace_previous): key(ctrl-shift-tab) -action(user.messaging_workspace_next): key(ctrl-tab) -# Channel -(slack | lack) [channel] info: key(ctrl-shift-i) -action(user.messaging_open_channel_picker): key(ctrl-k) -action(user.messaging_channel_previous): key(alt-up) -action(user.messaging_channel_next): key(alt-down) -action(user.messaging_unread_previous): key(alt-shift-up) -action(user.messaging_unread_next): key(alt-shift-down) -# Navigation -(move | next) focus: key(ctrl-`) -[next] (section | zone): key(f6) -(previous | last) (section | zone): key(shift-f6) -(slack | lack) [direct] messages: key(ctrl-shift-k) -(slack | lack) threads: key(ctrl-shift-t) -(slack | lack) (history [next] | back | backward): key(alt-left) -(slack | lack) forward: key(alt-right) -[next] (element | bit): key(tab) -(previous | last) (element | bit): key(shift-tab) -(slack | lack) (my stuff | activity): key(ctrl-shift-m) -(slack | lack) directory: key(ctrl-shift-e) -(slack | lack) (starred [items] | stars): key(ctrl-shift-s) -(slack | lack) unread [messages]: key(ctrl-j) -#(go | undo | toggle) full: key(ctrl-cmd-f) -action(user.messaging_open_search): key(ctrl-f) -# Messaging -grab left: key(shift-up) -grab right: key(shift-down) -add line: key(shift-enter) -#"(slack | lack) (slap | slaw | slapper): [key(cmd-right) key(shift-enter")], -(slack | lack) (react | reaction): key(ctrl-shift-\\) -(insert command | commandify): key(ctrl-shift-c) -insert code: - insert("``````") - key(left left left) - key(shift-enter) - key(shift-enter) - key(up) -(slack | lack) (bull | bullet | bulleted) [list]: key(ctrl-shift-8) -(slack | lack) (number | numbered) [list]: key(ctrl-shift-7) -(slack | lack) (quotes | quotation): key(ctrl-shift-9) -bold: key(ctrl-b) -(italic | italicize): key(ctrl-i) -(strike | strikethrough): key(ctrl-shift-x) -action(user.messaging_mark_workspace_read): key(shift-esc) -action(user.messaging_mark_channel_read): key(esc) -(clear | scrap | scratch): key(ctrl-a backspace) - # Files and Snippets -action(user.messaging_upload_file): key(ctrl-u) -(slack | lack) snippet: key(ctrl-shift-enter) - # Calls -([toggle] mute | unmute): key(m) -(slack | lack) ([toggle] video): key(v) -(slack | lack) invite: key(a) - # Miscellaneous -(slack | lack) shortcuts: key(ctrl-/) -emote : "{text}" -toggle left sidebar: key(ctrl-shift-d) -toggle right sidebar: key(ctrl-.) diff --git a/talon/community/community-cursorless-0.4.0/apps/teams/teams.py b/talon/community/community-cursorless-0.4.0/apps/teams/teams.py deleted file mode 100644 index 55fcfc2..0000000 --- a/talon/community/community-cursorless-0.4.0/apps/teams/teams.py +++ /dev/null @@ -1,10 +0,0 @@ -from talon import Module - -mod = Module() -apps = mod.apps -apps.microsoft_teams = """ -os: linux -and app.name: /teams/ -os: linux -and app.name: /Teams/ -""" diff --git a/talon/community/community-cursorless-0.4.0/apps/teams/teams.talon b/talon/community/community-cursorless-0.4.0/apps/teams/teams.talon deleted file mode 100644 index 5301743..0000000 --- a/talon/community/community-cursorless-0.4.0/apps/teams/teams.talon +++ /dev/null @@ -1,70 +0,0 @@ -app: microsoft_teams -- - -# Shortcut reference -# https://support.office.com/en-us/article/keyboard-shortcuts-for-microsoft-teams-2e8e2a70-e8d8-4a19-949b-4c36dd5292d2 - -# generics -show shortcuts: key(ctrl-.) -[go] [to] search: key(ctrl-e) -show commands: key(ctrl-/) -open filter: key(ctrl-shift-f) -go to: key(ctrl-g) -open (apps|applications): key(ctrl-`) -[start] new chat: key(ctrl-n) -open settings: key(ctrl-,) -open help: key(f1) -close: key(escape) - -#zoom in: key(ctrl-=) -#zoom out: key(ctrl--) -#reset zoom: key(ctrl-0) -action(edit.zoom_in): key(ctrl-=) -action(edit.zoom_out): key(ctrl--) -action(edit.zoom_reset): key(ctrl-0) - -# navigations -open activity: key(ctrl-1) -open chat: key(ctrl-2) -open teams: key(ctrl-3) -open calendar: key(ctrl-4) -open planner: key(ctrl-5) -open calls: key(ctrl-6) -open files: key(ctrl-7) -[go] [to] (prev|previous) [list] item: key(alt-up) -[go] [to] next [list] item: key(alt-down) -move [selected] team up: key(ctrl-shift-up) -move [selected] team down: key(ctrl-shift-down) -[go] [to] (prev|previous) section: key(ctrl-shift-f6) -[go] [to] next section: key(ctrl-f6) - -# messaging -[go] [to] compose [box]: key(c) -[expand] compose [box]: key(ctrl-shift-x) -send: key(ctrl-enter) -attach file: key(ctrl-o) -[start] new line: key(shift-enter) -reply [to] [thread]: key(r) - -# Meetings, Calls and Calendar -accept video call: key(ctrl-shift-a) -accept audio call: key(ctrl-shift-s) -decline call: key(ctrl-shift-d) -start audio call: key(ctrl-shift-c) -start video call: key(ctrl-shift-u) -toggle mute: key(ctrl-shift-m) -starch screen share session: key(ctrl-shift-e) -toggle video: key(ctrl-shift-o) -[go] [to] sharing toolbar: key(ctrl-shift-space) -decline screen share: key(ctrl-shift-d) -accept screen share: key(ctrl-shift-a) -schedule [a] meeting: key(alt-shift-n) -go to current time: key(alt-.) -go to (prev|previous) (day|week): key(ctrl-alt-left) -go to next (day|week): key(ctrl-alt-right) -view day: key(ctrl-alt-1) -view work week: key(ctrl-alt-2) -view week: key(ctrl-alt-3) -(safe|send) meeting request: key(ctrl-s) -join [from] meeting [details]: key(alt-shift-j) -go to suggested time: key(alt-shift-s) diff --git a/talon/community/community-cursorless-0.4.0/apps/visualstudio/visual_studio.py b/talon/community/community-cursorless-0.4.0/apps/visualstudio/visual_studio.py deleted file mode 100644 index 4bab331..0000000 --- a/talon/community/community-cursorless-0.4.0/apps/visualstudio/visual_studio.py +++ /dev/null @@ -1,206 +0,0 @@ -# vs title tracking requires an extension -# https://marketplace.visualstudio.com/items?itemName=mayerwin.RenameVisualStudioWindowTitle -# I currently configure the extension as below -# Document (no solution) open: [documentName] - [ideName] -# No document or solution open: [idleName] -# Solution in break mode: [documentName] - [parentPath]\[solutionName] (Debugging) - [ideName] -# Solution in design mode: [documentName] - [parentPath]\[solutionName] - [ideName] -# Solution in running mode: [documentName] - [parentPath]\[solutionName] (Running) - [ideName] - -from talon import Context, actions, ui, Module, app, clip -from typing import List, Union - -# is_mac = app.platform == "mac" - -ctx = Context() -mod = Module() - -apps = mod.apps -apps.visual_studio = """ -os: windows -and app.name: Microsoft Visual Studio 2019 -os: windows -and app.name: devenv.exe -""" - - -ctx.matches = r""" -app: visual_studio -""" - - -@ctx.action_class("win") -class win_actions: - def filename(): - title = actions.win.title() - # this doesn't seem to be necessary on VSCode for Mac - # if title == "": - # title = ui.active_window().doc - - result = title.split("-")[0].rstrip() - - if "." in result: - # print(result) - return result - - return "" - - -@ctx.action_class("edit") -class edit_actions: - def find(text: str): - actions.key("ctrl-f") - actions.insert(text) - - def line_swap_up(): - actions.key("alt-up") - - def line_swap_down(): - actions.key("alt-down") - - def line_clone(): - actions.key("ctrl-d") - - def jump_line(n: int): - actions.key("ctrl-g") - actions.sleep("100ms") - actions.insert(str(n)) - actions.key("enter") - - -@ctx.action_class("user") -class user_actions: - # snippet.py support beginHelp close - def snippet_search(text: str): - """TEST""" - actions.key("ctrl-k ctrl-x") - - # def snippet_insert(text: str): - # """Inserts a snippet""" - - # def snippet_create(): - # """Triggers snippet creation""" - - # snippet.py support end - - # def select_word(verb: str): - # actions.key("ctrl-w") - # actions.user.perform_selection_action(verb) - - # def select_next_occurrence(verbs: str, text: str): - # actions.edit.find(text) - # actions.sleep("100ms") - - # actions.key("esc") - # if verbs is not None: - # actions.user.perform_selection_action(verbs) - - # def select_previous_occurrence(verbs: str, text: str): - # actions.edit.find(text) - # actions.key("shift-enter") - # actions.sleep("100ms") - # actions.key("esc") - # if verbs is not None: - # actions.user.perform_selection_action(verbs) - - # def go_to_line(verb: str, line: int): - # actions.key("ctrl-g") - # actions.insert(str(line)) - # actions.key("enter") - - # if verb is not None: - # actions.user.perform_movement_action(verb) - - # def tab_jump(number: int): - # if number < 10: - # if is_mac: - # actions.key("ctrl-{}".format(number)) - # else: - # actions.key("alt-{}".format(number)) - - # def tab_final(): - # if is_mac: - # actions.key("ctrl-0") - # else: - # actions.key("alt-0") - - # splits.py support begin - # def split_number(index: int): - # """Navigates to a the specified split""" - # if index < 9: - # if is_mac: - # actions.key("cmd-{}".format(index)) - # else: - # actions.key("ctrl-{}".format(index)) - - # splits.py support end - - # find_and_replace.py support begin - - def find(text: str): - """Triggers find in current editor""" - actions.key("ctrl-f") - - if text: - actions.insert(text) - - def find_next(): - actions.key("enter") - - def find_previous(): - actions.key("shift-enter") - - def find_everywhere(text: str): - """Triggers find across project""" - actions.key("ctrl-shift-f") - - if text: - actions.insert(text) - - def find_toggle_match_by_case(): - """Toggles find match by case sensitivity""" - actions.key("alt-c") - - def find_toggle_match_by_word(): - """Toggles find match by whole words""" - actions.key("alt-w") - - def find_toggle_match_by_regex(): - """Toggles find match by regex""" - actions.key("alt-r") - - def replace(text: str): - """Search and replaces in the active editor""" - actions.key("ctrl-h") - - if text: - actions.insert(text) - - def replace_everywhere(text: str): - """Search and replaces in the entire project""" - actions.key("ctrl-shift-h") - - if text: - actions.insert(text) - - def replace_confirm(): - """Confirm replace at current position""" - actions.key("alt-r") - - def replace_confirm_all(): - """Confirm replace all""" - actions.key("alt-a") - - def select_previous_occurrence(text: str): - actions.edit.find(text) - actions.key("shift-enter") - actions.sleep("100ms") - actions.key("esc") - - def select_next_occurrence(text: str): - actions.edit.find(text) - actions.sleep("100ms") - actions.key("esc") - - # find_and_replace.py support end - diff --git a/talon/community/community-cursorless-0.4.0/apps/visualstudio/visual_studio.talon b/talon/community/community-cursorless-0.4.0/apps/visualstudio/visual_studio.talon deleted file mode 100644 index 31ff1af..0000000 --- a/talon/community/community-cursorless-0.4.0/apps/visualstudio/visual_studio.talon +++ /dev/null @@ -1,122 +0,0 @@ -os: windows -app: Microsoft Visual Studio 2019 -app: devenv.exe -- -tag(): user.tabs -tag(): user.line_commands -tag(): user.find_and_replace -tag(): user.snippets -tag(): user.multiple_cursors - -#talon app actions -action(app.tab_close): key(ctrl-f4) -action(app.tab_next): key(ctrl-tab) -action(app.tab_previous): key(ctrl-shift-tab) -action(app.tab_reopen): key(ctrl-1 ctrl-r enter) - -#talon code actions -action(code.toggle_comment): key(ctrl-k ctrl-/) - -#talon edit actions -action(edit.indent_more): key(tab) -action(edit.indent_less): key(shift-tab) -action(edit.save_all): key(ctrl-shift-s) - -#multiple_cursor.py support begin -#note: visual studio has no explicit mode for multiple cursors; requires https://marketplace.visualstudio.com/items?itemName=VaclavNadrasky.MultiCaretBooster -action(user.multi_cursor_add_above): key(shift-alt-up) -action(user.multi_cursor_add_below): key(shift-alt-down) -#action(user.multi_cursor_add_to_line_ends): does not exist :( -action(user.multi_cursor_disable): key(escape) -action(user.multi_cursor_enable): skip() -action(user.multi_cursor_select_all_occurrences): key(shift-alt-;) -action(user.multi_cursor_select_fewer_occurrences): key(shift-alt-k) -action(user.multi_cursor_select_more_occurrences): key(shift-alt->) -#multiple_cursor.py support end - -# Panels -panel solution: key(ctrl-alt-l) -panel properties: key(f4) -panel output: key(ctrl-alt-o) -panel class: key(ctrl-shift-c) -panel errors: key(ctrl-\ ctrl-e) -panel design: key(shift-f7) -panel marks: key(ctrl-k ctrl-w) -panel breakpoints: key(ctrl-alt-b) - -# Settings -show settings: key(alt-t o) -#show shortcuts: -#show snippets: - -# Display -fullscreen switch: key(shift-alt-enter) -wrap switch: key(ctrl-e ctrl-w) - -# File Commands -file hunt []: - key(ctrl-shift-t) - insert(text or "") -file create: key(ctrl-n) -#file open folder: -file rename: key(ctrl-[ s f2) -file reveal: key(ctrl-[ s) - -# Language Features -hint show: key(ctrl-shift-space) -definition show: key(f12) -definition peek: key(alt-f12) -references find: key(shift-f12) -format that: key(ctrl-k ctrl-d) -format selection: key(ctrl-k ctrl-f) -imports fix: key(ctrl-r ctrl-g) - -# problem next: -# problem last: -# problem fix: -refactor field: key(ctrl-r ctrl-e) -refactor interface: key(ctrl-r ctrl-i) -refactor method: key(ctrl-r ctrl-m) -refactor reorder parameters: key(ctrl-r ctrl-o) -refactor remove parameters: key(ctrl-r ctrl-v) -refactor that: key(ctrl-r ctrl-r) - -#code navigation -(go declaration | follow): key(ctrl-f12) -go back: key(ctrl--) -go forward: key(ctrl-shift--) -go implementation: key(f12) -go recent []: - key(ctrl-1 ctrl-r) - sleep(100ms) - insert(text or "") -go type []: - key(ctrl-1 ctrl-t) - sleep(100ms) - insert(text or "") -go member []: - key(alt-\) - sleep(100ms) - insert(text or "") -go usage: key(shift-f12) - -# Bookmarks. -go marks: key(ctrl-k ctrl-w) -toggle mark: key(ctrl-k ctrl-k) -go next mark: key(ctrl-k ctrl-n) -go last mark: key(ctrl-k ctrl-p) - -# Folding -fold toggle: key(ctrl-m ctrl-m) -fold toggle all: key(ctrl-m ctrl-l) -fold definitions: key(ctrl-m ctrl-o) - -#Debugging -break point: key(f9) -step over: key(f10) -debug step into: key(f11) -debug step out [of]: key(f10) -debug start: key(f5) -debug stopper: key(shift-f5) -debug continue: key(f5) -#debug restart: \ No newline at end of file diff --git a/talon/community/community-cursorless-0.4.0/apps/vscode/README.md b/talon/community/community-cursorless-0.4.0/apps/vscode/README.md deleted file mode 100644 index 553f40a..0000000 --- a/talon/community/community-cursorless-0.4.0/apps/vscode/README.md +++ /dev/null @@ -1,5 +0,0 @@ -# VSCode support - -Assumes that you have the [Run Command by -Id](https://marketplace.visualstudio.com/items?itemName=pokey.run-command-by-id) -extension installed. diff --git a/talon/community/community-cursorless-0.4.0/apps/vscode/command_client.py b/talon/community/community-cursorless-0.4.0/apps/vscode/command_client.py deleted file mode 100644 index 3cf3c45..0000000 --- a/talon/community/community-cursorless-0.4.0/apps/vscode/command_client.py +++ /dev/null @@ -1,167 +0,0 @@ -import requests -import time -import json -from typing import Any -from talon import Module, actions, app -from pathlib import Path -from tempfile import gettempdir - -is_mac = app.platform == "mac" - -mod = Module() - - -class NotSet: - def __repr__(self): - return "" - - -def run_vscode_command( - command: str, - *args: str, - wait_for_finish: bool = False, - expect_response: bool = False, - decode_json_arguments: bool = False, -): - """Execute command via vscode command server.""" - # NB: This is a hack to work around the fact that talon doesn't support - # variable argument lists - args = list( - filter( - lambda x: x is not NotSet, - args, - ) - ) - if decode_json_arguments: - args = [json.loads(arg) for arg in args] - - port_file_path = Path(gettempdir()) / "vscode-port" - original_contents = port_file_path.read_text() - - # Issue command to VSCode telling it to update the port file. Because only - # the active VSCode instance will accept keypresses, we can be sure that - # the active VSCode instance will be the one to write the port. - if is_mac: - actions.key("cmd-shift-alt-p") - else: - actions.key("ctrl-shift-alt-p") - - # Wait for the VSCode instance to update the port file. This generally - # happens within the first millisecond, but we give it 3 seconds just in - # case. - start_time = time.monotonic() - new_contents = port_file_path.read_text() - sleep_time = 0.0005 - while True: - if new_contents != original_contents: - try: - decoded_contents = json.loads(new_contents) - # If we're successful, we break out of the loop - break - except ValueError: - # If we're not successful, we keep waiting; we assume it was a - # partial write from VSCode - pass - time.sleep(sleep_time) - sleep_time *= 2 - if time.monotonic() - start_time > 3.0: - raise Exception("Timed out waiting for VSCode to update port file") - new_contents = port_file_path.read_text() - - port = decoded_contents["port"] - - response = requests.post( - f"http://localhost:{port}/execute-command", - json={ - "commandId": command, - "args": args, - "waitForFinish": wait_for_finish, - "expectResponse": expect_response, - }, - timeout=(0.05, 3.05), - ) - response.raise_for_status() - - actions.sleep("25ms") - - if expect_response: - return response.json() - - -@mod.action_class -class Actions: - def vscode( - command: str, - arg1: Any = NotSet, - arg2: Any = NotSet, - arg3: Any = NotSet, - arg4: Any = NotSet, - arg5: Any = NotSet, - ): - """Execute command via vscode command server.""" - run_vscode_command( - command, - arg1, - arg2, - arg3, - arg4, - arg5, - ) - - def vscode_and_wait( - command: str, - arg1: Any = NotSet, - arg2: Any = NotSet, - arg3: Any = NotSet, - arg4: Any = NotSet, - arg5: Any = NotSet, - ): - """Execute command via vscode command server and wait for command to finish.""" - run_vscode_command( - command, - arg1, - arg2, - arg3, - arg4, - arg5, - wait_for_finish=True, - ) - - def vscode_json_and_wait( - command: str, - arg1: Any = NotSet, - arg2: Any = NotSet, - arg3: Any = NotSet, - arg4: Any = NotSet, - arg5: Any = NotSet, - ): - """Execute command via vscode command server and wait for command to finish.""" - run_vscode_command( - command, - arg1, - arg2, - arg3, - arg4, - arg5, - wait_for_finish=True, - decode_json_arguments=True, - ) - - def vscode_get( - command: str, - arg1: Any = NotSet, - arg2: Any = NotSet, - arg3: Any = NotSet, - arg4: Any = NotSet, - arg5: Any = NotSet, - ) -> Any: - """Execute command via vscode command server and return command output.""" - return run_vscode_command( - command, - arg1, - arg2, - arg3, - arg4, - arg5, - expect_response=True, - ) diff --git a/talon/community/community-cursorless-0.4.0/apps/vscode/cursorless/actions.py b/talon/community/community-cursorless-0.4.0/apps/vscode/cursorless/actions.py deleted file mode 100644 index 06f21ab..0000000 --- a/talon/community/community-cursorless-0.4.0/apps/vscode/cursorless/actions.py +++ /dev/null @@ -1,77 +0,0 @@ -from user.pokey_talon.code.terms import SELECT, TELEPORT, DELETE, FIND -from talon import Context, actions, ui, Module, app, clip - -mod = Module() - -ctx = Context() -ctx.matches = r""" -app: vscode -""" - -# TODO A lot of these could be supported by supporting a proper "pop back" -# Would basically use the same logic that is used for updating token ranges -mod.list("simple_cursorless_action", desc="Supported actions for cursorless navigation") -ctx.lists["self.simple_cursorless_action"] = { - # Accepts any single extent - "spring": "setSelection", - SELECT: "setSelection", - "pree": "setSelectionBefore", - "post": "setSelectionAfter", - DELETE: "delete", - "clear": "clear", - # "sort": "sortLines", - # "join": "joinLines", - # "float": "insertEmptyLineBelow", - # "drop": "insertEmptyLineBelow", - # Sort children?? (would need to sort only named ones to avoid commas) - # Reverse children - # "cut": "cut", - # "copy": "copy", - # FIND: "findInFile", - # f"{FIND} last": "findBackwardsInFile", - # f"{FIND} all": "findAll", - # "fold": "fold", - # "stack": "addCursorAt", - # "cursor all": "addCursorToAllLines", - # "remove cursor": "removeCursor", - # "tab": "indent", - # "retab": "dedent", - # "comment": "comment", - # "github open": "openInGithub", - # "smear": "cloneLineDown", - # # Accepts only single token - # "rename": "rename", - # "ref show": "showReferences", - # "def show": "showDefinition", - # "hover show": "showHover", - # "act up": "scrollToTop", - # "act eat": "scrollToMid", - # "act down": "scrollToBottom", - # "breakpoint": "addBreakPoint", - # # Accepts position - # "paste": "paste", -} - -{ - # Require 2 extents of any kind, but prob best to assume second extend is - # same type as first, and need to explicitly say "token" if you want to use - # a token for the second one if the first is not - # Note: these should actually be of the form "swap with" - "swap": "swap", - # Require 1 extent of any kind and 1 position, but prob best to assume - # the position is same type as extent, and need to explicitly say "token" - # if you want to use a token for the second one if the first is not - "use": "use", - # Require 1 extent of any kind, and 1 format string (eg "camel foo bar", - # "phrase hello world" etc, "spell air bat cap") - # Note: these should actually be of the form "replace with" - # Could also except a second extent, and that would replace it with that - # extent - "replace with": "replaceWith", - # Require 1 extent of any kind, and 1 format type (eg camel, uppercase, - # phrase etc) - # Note: these should actually be of the form "reformat as" - "reformat as": "reformatAs", -} -"" -"phones" \ No newline at end of file diff --git a/talon/community/community-cursorless-0.4.0/apps/vscode/cursorless/command.py b/talon/community/community-cursorless-0.4.0/apps/vscode/cursorless/command.py deleted file mode 100644 index 3955be6..0000000 --- a/talon/community/community-cursorless-0.4.0/apps/vscode/cursorless/command.py +++ /dev/null @@ -1,27 +0,0 @@ -from talon import Context, actions, ui, Module, app, clip -import json -from typing import Any -from ..command_client import NotSet - - -mod = Module() - - -@mod.action_class -class Actions: - def cursorless_single_target_command( - action: str, - target: str, - arg1: Any = NotSet, - arg2: Any = NotSet, - arg3: Any = NotSet, - ): - """Execute single-target cursorlses command""" - actions.user.vscode_and_wait( - "cursorless.command", - action, - [json.loads(target)], - arg1, - arg2, - arg3, - ) diff --git a/talon/community/community-cursorless-0.4.0/apps/vscode/cursorless/cursorless.talon b/talon/community/community-cursorless-0.4.0/apps/vscode/cursorless/cursorless.talon deleted file mode 100644 index 05cf49c..0000000 --- a/talon/community/community-cursorless-0.4.0/apps/vscode/cursorless/cursorless.talon +++ /dev/null @@ -1,35 +0,0 @@ -app: vscode -- -{self.simple_cursorless_action} : - user.cursorless_single_target_command(simple_cursorless_action, cursorless_arg) - -drink : - user.cursorless_single_target_command("setSelection", cursorless_arg) - user.new_line_above() - -pour : - user.cursorless_single_target_command("setSelection", cursorless_arg) - user.new_line_below() - -funk wrap with : - user.cursorless_single_target_command("wrap", cursorless_arg, "{code_functions}(", ")") - -square wrap : - user.cursorless_single_target_command("wrap", cursorless_arg, "[", "]") - -round wrap : - user.cursorless_single_target_command("wrap", cursorless_arg, "(", ")") - -curly wrap : - user.cursorless_single_target_command("wrap", cursorless_arg, "{", "}") - -(diamond | angle) wrap : - user.cursorless_single_target_command("wrap", cursorless_arg, "<", ">") - -quad wrap : - user.cursorless_single_target_command("wrap", cursorless_arg, "\"", "\"") - -twin wrap : - user.cursorless_single_target_command("wrap", cursorless_arg, "'", "'") - -action(user.dental_click): user.vscode("cursorless.toggleDecorations") \ No newline at end of file diff --git a/talon/community/community-cursorless-0.4.0/apps/vscode/cursorless/range.py b/talon/community/community-cursorless-0.4.0/apps/vscode/cursorless/range.py deleted file mode 100644 index b6d0ffe..0000000 --- a/talon/community/community-cursorless-0.4.0/apps/vscode/cursorless/range.py +++ /dev/null @@ -1,42 +0,0 @@ -import json -from .target import BASE_TARGET, cursor_mark -from talon import Context, actions, ui, Module, app, clip - -mod = Module() - - -@mod.capture( - rule=( - " | " - "through | " - "[range] through " - ) -) -def cursorless_range(m) -> str: - if "through" in m: - end = json.loads(m[-1]) - if m[0] == "through": - start = BASE_TARGET.copy() - else: - start = json.loads(m.cursorless_target_list[0]) - return json.dumps( - { - "type": "range", - "start": start, - "end": end, - } - ) - - return m[0] - - -@mod.capture(rule=(" (and )*")) -def cursorless_arg(m) -> str: - if len(m.cursorless_range_list) == 1: - return m.cursorless_range - return json.dumps( - { - "type": "list", - "elements": [json.loads(match) for match in m.cursorless_range_list], - } - ) diff --git a/talon/community/community-cursorless-0.4.0/apps/vscode/cursorless/target.py b/talon/community/community-cursorless-0.4.0/apps/vscode/cursorless/target.py deleted file mode 100644 index db6589f..0000000 --- a/talon/community/community-cursorless-0.4.0/apps/vscode/cursorless/target.py +++ /dev/null @@ -1,344 +0,0 @@ -from ....code.terms import SELECT, TELEPORT, DELETE, FIND - -from enum import Enum -from dataclasses import dataclass -from ....code.keys import symbol_key_words -import json - -from talon import Context, actions, ui, Module, app, clip - -ctx = Context() -mod = Module() - -ctx.matches = r""" -app: vscode -""" - -mod.list("symbol_color", desc="Supported symbol colors for token jumping") -ctx.lists["self.symbol_color"] = { - "gray": "default", - "blue": "blue", - "green": "green", - "rose": "red", - "squash": "yellow", - "plum": "mauve", -} - - -CONNECTIVES = {"at", "of", "in", "containing"} - -BASE_TARGET = {"type": "primitive"} - - -@mod.capture( - rule=( - "[{user.cursorless_position}] " - "[{user.cursorless_pair_surround_type}] " - "[{user.cursorless_selection_type} [of | in | containing]] " - "[] " - "[ [at]]" - "( | {user.cursorless_mark} | {user.unmarked_core} | | | )" - "[ | {user.cursorless_matching}]" - ) -) -def cursorless_target(m) -> str: - """Supported extents for cursorless navigation""" - object = BASE_TARGET.copy() - for capture in m: - if capture in CONNECTIVES: - continue - for key, value in json.loads(capture).items(): - if ( - key in object - and key == SELECTION_TYPE_KEY - and ranked_selection_types[value] < ranked_selection_types[object[key]] - ): - continue - object[key] = value - - return json.dumps(object) - - -@dataclass -class ModifierTerm: - term: str - info: dict - - @property - def value(self): - return json.dumps(self.info) - - -def make_simple_transformation(type: str): - return {"transformation": {"type": type}} - - -matching_transformation = ModifierTerm( - "matching", make_simple_transformation("matchingPairSymbol") -) - -mod.list("cursorless_matching", desc="Supported symbol extent types") -ctx.lists["self.cursorless_matching"] = { - matching_transformation.term: matching_transformation.value -} - -containing_scope_type_map = { - "arg": "argumentOrParameter", - "arrow": "arrowFunction", - "class": "class", - "funk": "namedFunction", - "if": "ifStatement", - "lambda": "arrowFunction", - "map": "dictionary", - "pair": "pair", - "value": "pairValue", - "key": "pairKey", -} - -containing_scope_types = { - term: { - "transformation": { - "type": "containingScope", - "scopeType": containing_scope_type, - } - } - for term, containing_scope_type in containing_scope_type_map.items() -} - -mod.list("containing_scope_type", desc="Supported symbol extent types") -ctx.lists["self.containing_scope_type"] = { - key: json.dumps(value) for key, value in containing_scope_types.items() -} - -SELECTION_TYPE_KEY = "selectionType" - - -@dataclass -class SelectionType: - singular: str - plural: str - json_name: str - rank: int - - @property - def json_repr(self): - return {SELECTION_TYPE_KEY: self.json_name} - - -TOKEN = SelectionType("token", "tokens", "token", 0) -LINE = SelectionType("line", "lines", "line", 1) -BLOCK = SelectionType("block", "blocks", "block", 2) - -SELECTION_TYPES = [ - TOKEN, - LINE, - BLOCK, -] - -ranked_selection_types = { - selection_type.json_name: selection_type.rank for selection_type in SELECTION_TYPES -} - -cursor_mark = {"mark": {"type": "cursor"}} - -marks = { - "here": cursor_mark, - "this": cursor_mark, - **{ - f"this {selection_type.singular}": {**selection_type.json_repr, **cursor_mark} - for selection_type in SELECTION_TYPES - }, - **{ - f"these {selection_type.plural}": {**selection_type.json_repr, **cursor_mark} - for selection_type in SELECTION_TYPES - }, - "change": {"mark": {"type": "lastEditRange"}}, - "last cursor": {"mark": {"type": "lastCursorPosition"}}, - **{ - f"this {containing_scope_type}": {**cursor_mark, **value} - for containing_scope_type, value in containing_scope_types.items() - }, -} - -mod.list("cursorless_mark", desc="Types of marks") -ctx.lists["self.cursorless_mark"] = { - key: json.dumps(value) for key, value in marks.items() -} - -unmarked_cores = { - **containing_scope_types, - **{ - selection_type.singular: selection_type.json_repr - for selection_type in SELECTION_TYPES - }, - matching_transformation.term: matching_transformation.info, -} - -mod.list("unmarked_core", desc="Core terms whose mark must be inferred") -ctx.lists["self.unmarked_core"] = { - key: json.dumps(value) for key, value in unmarked_cores.items() -} - - -positions = { - "after": {"position": "after"}, - "before": {"position": "before"}, - "start of": {"position": "before", "insideOutsideType": "inside"}, - "end of": {"position": "after", "insideOutsideType": "inside"}, - "above": {"position": "before", **LINE.json_repr}, - "below": {"position": "after", **LINE.json_repr}, -} - -mod.list("cursorless_position", desc="Types of positions") -ctx.lists["self.cursorless_position"] = { - key: json.dumps(value) for key, value in positions.items() -} - -selection_type_map = {} - -for selection_type in SELECTION_TYPES: - selection_type_map[selection_type.singular] = selection_type.json_repr - selection_type_map[selection_type.plural] = selection_type.json_repr - -mod.list("cursorless_selection_type", desc="Types of selection_types") -ctx.lists["self.cursorless_selection_type"] = { - key: json.dumps(value) for key, value in selection_type_map.items() -} - - -@mod.capture(rule="[at] [{user.symbol_color}] ") -def decorated_symbol(m) -> str: - """A decorated symbol""" - try: - symbol_color = m.symbol_color - except AttributeError: - symbol_color = "default" - - character = m.any_alphanumeric_key - - return json.dumps( - { - "mark": { - "type": "decoratedSymbol", - "symbolColor": symbol_color, - "character": character, - } - } - ) - - -mod.list("cursorless_sub_component_type", desc="Supported subcomponent types") -ctx.lists["self.cursorless_sub_component_type"] = { - "small": "subtoken", - "subtoken": "subtoken", - "subtokens": "subtoken", - "subword": "subtoken", - "subwords": "subtoken", - "car": "character", - "cars": "character", - "character": "character", - "characters": "character", - "letter": "character", - "letters": "character", -} - - -@mod.capture( - rule=( - " [through ] {user.cursorless_sub_component_type}" - ) -) -def cursorless_indexer(m) -> str: - """Supported extents for cursorless navigation""" - return json.dumps( - { - "transformation": { - "type": "subpiece", - "pieceType": m.cursorless_sub_component_type, - "startIndex": m.ordinals_list[0], - "endIndex": m.ordinals_list[-1] + 1, - } - } - ) - - -pair_symbols = { - "[": "squareBrackets", - "]": "squareBrackets", - "{": "curlyBrackets", - "}": "curlyBrackets", - "<": "angleBrackets", - ">": "angleBrackets", - "(": "parentheses", - ")": "parentheses", - '"': "doubleQuotes", - "'": "singleQuotes", -} - -mod.list("pair_symbol", desc="A pair symbol") -ctx.lists["self.pair_symbol"] = { - phrase: pair_symbols[character] - for phrase, character in symbol_key_words.items() - if character in pair_symbols -} - -cursorless_pair_surround_types = { - "out": {"insideOutsideType": "outside"}, - "outer": {"insideOutsideType": "outside"}, - "outside": {"insideOutsideType": "outside"}, - "in": {"insideOutsideType": "inside"}, - "inner": {"insideOutsideType": "inside"}, - "inside": {"insideOutsideType": "inside"}, -} - -mod.list("cursorless_pair_surround_type", desc="Supported pair surround types") -ctx.lists["self.cursorless_pair_surround_type"] = { - key: json.dumps(value) for key, value in cursorless_pair_surround_types.items() -} - - -@mod.capture(rule=("{user.cursorless_pair_surround_type} {user.pair_symbol}")) -def cursorless_surrounding_pair(m) -> str: - """Supported extents for cursorless navigation""" - return json.dumps( - { - "transformation": { - "type": "surroundingPair", - "delimiter": m.pair_symbol, - } - ** json.loads(m.cursorless_pair_surround_type), - } - ) - - -simple_transformations = [ - matching_transformation, -] - -mod.list("cursorless_simple_transformations", desc="simple transformations") -ctx.lists["self.cursorless_simple_transformations"] = { - transformation.term: transformation.value - for transformation in simple_transformations -} - - -@mod.capture(rule=("[every] {user.containing_scope_type} [containing]")) -def cursorless_containing_scope(m) -> str: - """Supported extents for cursorless navigation""" - if m[0] in ["every"]: - current_target = json.loads(m.containing_scope_type) - current_target["transformation"]["includeSiblings"] = True - return json.dumps(current_target) - return m.containing_scope_type - - -@mod.capture( - rule=( - " |" - "{user.cursorless_simple_transformations} |" - "" - ) -) -def cursorless_range_transformation(m) -> str: - """Supported positions for cursorless navigation""" - return str(m) \ No newline at end of file diff --git a/talon/community/community-cursorless-0.4.0/apps/vscode/decorative_navigation.talon b/talon/community/community-cursorless-0.4.0/apps/vscode/decorative_navigation.talon deleted file mode 100644 index da1859d..0000000 --- a/talon/community/community-cursorless-0.4.0/apps/vscode/decorative_navigation.talon +++ /dev/null @@ -1,19 +0,0 @@ -app: vscode -- -# ( | spring) [{user.symbol_color}] : -# user.vscode_and_wait("decorative-navigation.selectToken", symbol_color or "default", any_alphanumeric_key) -# sleep(50ms) - -# pree [{user.symbol_color}] : -# user.vscode("decorative-navigation.selectToken", symbol_color or "default", any_alphanumeric_key) -# key(left) - -# post [{user.symbol_color}] : -# user.vscode("decorative-navigation.selectToken", symbol_color or "default", any_alphanumeric_key) -# key(right) - -# def show [{user.symbol_color}] : -# user.vscode("decorative-navigation.selectToken", symbol_color or "default", any_alphanumeric_key) -# user.vscode("editor.action.revealDefinition") - -# action(user.dental_click): user.vscode("decorative-navigation.toggleDecorations") \ No newline at end of file diff --git a/talon/community/community-cursorless-0.4.0/apps/vscode/metago.talon b/talon/community/community-cursorless-0.4.0/apps/vscode/metago.talon deleted file mode 100644 index 5613442..0000000 --- a/talon/community/community-cursorless-0.4.0/apps/vscode/metago.talon +++ /dev/null @@ -1,49 +0,0 @@ -app: vscode -- - -# line up: user.vscode("metaGo.selectLineUp") -# line: user.vscode("metaGo.selectLineDown") - -bracket switch: user.vscode("metaGo.changeSurroundingPair") - -# to: user.vscode("metaGo.gotoSmart") -# word : user.jump("metaGo.gotoSmart", word) -# before: user.vscode("metaGo.gotoBefore") -# after: user.vscode("metaGo.gotoAfter") -razor: user.vscode("metaGo.gotoEmptyLineUp") -dropper: user.vscode("metaGo.gotoEmptyLineDown") -# bracket: user.vscode("metaGo.jumpToBracket") -# very: -# key(cmd-shift-. enter) - -# to: user.vscode("metaGo.selectSmart") -# tasty: user.vscode("metaGo.selectBefore") -# toasty: user.vscode("metaGo.selectAfter") - upper: user.vscode("metaGo.selectEmptyLineUp") - downer: user.vscode("metaGo.selectEmptyLineDown") - downer: - user.vscode("metaGo.selectEmptyLineDown") - key(backspace) - upper: - user.vscode("metaGo.selectEmptyLineUp") - key(backspace) -# outside: user.vscode("metaGo.inSurroundingPairSelectionWithPairs") -# inside : -# user.vscode("metaGo.inSurroundingPairSelection") -# key(symbol_key) -# sleep(25ms) - -# cursor add: user.vscode("metaGo.addCursorSmart") -# cursor add before: user.vscode("metaGo.addCursorBefore") -# cursor add after: user.vscode("metaGo.addCursorAfter") - -act up: user.vscode("metaGo.scrollCurrentLineToTop") -act eat: user.vscode("metaGo.scrollCurrentLineToMiddle") -act down: user.vscode("metaGo.scrollCurrentLineToBottom") - - right big: user.vscode("metaGo.cursorSpaceWordRightSelect") - left big: user.vscode("metaGo.cursorSpaceWordLeftSelect") -tug big: user.vscode("metaGo.cursorSpaceWordLeft") -push big: user.vscode("metaGo.cursorSpaceWordRight") - -swap anchor: user.vscode("metaGo.selectionSwitchActiveWithAnchor") \ No newline at end of file diff --git a/talon/community/community-cursorless-0.4.0/apps/vscode/snippets/csharp_snippets.py b/talon/community/community-cursorless-0.4.0/apps/vscode/snippets/csharp_snippets.py deleted file mode 100644 index ed50447..0000000 --- a/talon/community/community-cursorless-0.4.0/apps/vscode/snippets/csharp_snippets.py +++ /dev/null @@ -1,43 +0,0 @@ -from talon import Context, actions, ui, Module, app - -# from user.knausj_talon.code.snippet_watcher import snippet_watcher -import os - -ctx = Context() -ctx.matches = r""" -app: vscode -mode: user.csharp -mode: command -and code.language: csharp -""" -# short name -> ide clip name -ctx.lists["user.snippets"] = { - "class": "class", - "else": "else", - "for each": "foreach", - "if": "if", - "try except": "try", - "try finally": "tryf", - "while": "while", - # "class funky": "def(class method)", - # "class static funky": "def(class static method)", - # "for": "for", - # "funky": "def", -} - - -# def update_list(watch_list): -# ctx.lists["user.snippets"] = watch_list - - -# # there's probably a way to do this without -# snippet_path = None -# if app.platform == "windows": -# snippet_path = os.path.expandvars(r"%AppData%\Code\User\snippets") -# elif app.platform == "mac": -# snippet_path = os.path.expanduser( -# "~/Library/Application Support/Code/User/snippets" -# ) -# if snippet_path: -# watcher2 = snippet_watcher({snippet_path: ["csharp.json",],}, update_list,) -# print("reloaded!") diff --git a/talon/community/community-cursorless-0.4.0/apps/vscode/snippets/python_snippets.py b/talon/community/community-cursorless-0.4.0/apps/vscode/snippets/python_snippets.py deleted file mode 100644 index af84d70..0000000 --- a/talon/community/community-cursorless-0.4.0/apps/vscode/snippets/python_snippets.py +++ /dev/null @@ -1,44 +0,0 @@ -from talon import Context, actions, ui, Module, app - -# from user.knausj_talon.code.snippet_watcher import snippet_watcher -import os - -ctx = Context() -ctx.matches = r""" -app: vscode -mode: user.python -mode: command -and code.language: python -""" -# short name -> ide clip name -ctx.lists["user.snippets"] = { - "class funky": "def(class method)", - "class static funky": "def(class static method)", - "class": "class", - "else if": "elif", - "for": "for", - "funky": "def", - "if else": "if/else", - "if": "if", - "lambda": "lambda", - "try except": "try/except", - "while": "while", - "with": "with", -} - - -# def update_list(watch_list): -# ctx.lists["user.snippets"] = watch_list - - -# # there's probably a way to do this without -# snippet_path = None -# if app.platform == "windows": -# snippet_path = os.path.expandvars(r"%AppData%\Code\User\snippets") -# elif app.platform == "mac": -# snippet_path = os.path.expanduser( -# "~/Library/Application Support/Code/User/snippets" -# ) -# if snippet_path: -# watcher = snippet_watcher({snippet_path: ["python.json",],}, update_list,) - diff --git a/talon/community/community-cursorless-0.4.0/apps/vscode/vscode.py b/talon/community/community-cursorless-0.4.0/apps/vscode/vscode.py deleted file mode 100644 index e150321..0000000 --- a/talon/community/community-cursorless-0.4.0/apps/vscode/vscode.py +++ /dev/null @@ -1,223 +0,0 @@ -from talon import Context, actions, ui, Module, app, clip - -is_mac = app.platform == "mac" - -ctx = Context() -mod = Module() -mod.apps.vscode = """ -os: mac -and app.bundle: com.microsoft.VSCode -""" -mod.apps.vscode = """ -os: linux -and app.name: Code -os: linux -and app.name: code-oss -""" -mod.apps.vscode = """ -os: windows -and app.name: Visual Studio Code -os: windows -and app.exe: Code.exe -""" - -ctx.matches = r""" -app: vscode -""" - - -@ctx.action_class("win") -class win_actions: - def filename(): - title = actions.win.title() - # this doesn't seem to be necessary on VSCode for Mac - # if title == "": - # title = ui.active_window().doc - - if is_mac: - result = title.split(" — ")[0] - else: - result = title.split(" - ")[0] - - if "." in result: - return result - - return "" - - -@ctx.action_class("edit") -class edit_actions: - def find(text: str): - if is_mac: - actions.key("cmd-f") - else: - actions.key("ctrl-f") - - actions.insert(text) - - def line_swap_up(): - actions.key("alt-up") - - def line_swap_down(): - actions.key("alt-down") - - def line_clone(): - actions.key("shift-alt-down") - - def jump_line(n: int): - actions.user.vscode("workbench.action.gotoLine") - actions.insert(str(n)) - actions.key("enter") - actions.edit.line_start() - - -@mod.action_class -class Actions: - def vscode_terminal(number: int): - """Activate a terminal by number""" - actions.user.vscode(f"workbench.action.terminal.focusAtIndex{number}") - - -@ctx.action_class("user") -class user_actions: - # snippet.py support beginHelp close - def snippet_search(text: str): - actions.user.vscode("editor.action.insertSnippet") - actions.insert(text) - - def snippet_insert(text: str): - """Inserts a snippet""" - actions.user.vscode("editor.action.insertSnippet") - actions.insert(text) - actions.key("enter") - - def snippet_create(): - """Triggers snippet creation""" - actions.user.vscode("workbench.action.openSnippets") - - # snippet.py support end - - def tab_jump(number: int): - if number < 10: - if is_mac: - actions.key("ctrl-{}".format(number)) - else: - actions.key("alt-{}".format(number)) - - def tab_final(): - if is_mac: - actions.key("ctrl-0") - else: - actions.key("alt-0") - - # splits.py support begin - def split_number(index: int): - """Navigates to a the specified split""" - if index < 9: - if is_mac: - actions.key("cmd-{}".format(index)) - else: - actions.key("ctrl-{}".format(index)) - - # splits.py support end - - # find_and_replace.py support begin - - def find(text: str): - """Triggers find in current editor""" - if is_mac: - actions.key("cmd-f") - else: - actions.key("ctrl-f") - - if text: - actions.insert(text) - - def find_next(): - actions.user.vscode("editor.action.nextMatchFindAction") - - def find_previous(): - actions.user.vscode("editor.action.previousMatchFindAction") - - def find_everywhere(text: str): - """Triggers find across project""" - if is_mac: - actions.key("cmd-shift-f") - else: - actions.key("ctrl-shift-f") - - if text: - actions.insert(text) - - def find_toggle_match_by_case(): - """Toggles find match by case sensitivity""" - if is_mac: - actions.key("alt-cmd-c") - else: - actions.key("alt-c") - - def find_toggle_match_by_word(): - """Toggles find match by whole words""" - if is_mac: - actions.key("cmd-alt-w") - else: - actions.key("alt-w") - - def find_toggle_match_by_regex(): - """Toggles find match by regex""" - if is_mac: - actions.key("cmd-alt-r") - else: - actions.key("alt-r") - - def replace(text: str): - """Search and replaces in the active editor""" - if is_mac: - actions.key("alt-cmd-f") - else: - actions.key("ctrl-h") - - if text: - actions.insert(text) - - def replace_everywhere(text: str): - """Search and replaces in the entire project""" - if is_mac: - actions.key("cmd-shift-h") - else: - actions.key("ctrl-shift-h") - - if text: - actions.insert(text) - - def replace_confirm(): - """Confirm replace at current position""" - if is_mac: - actions.key("shift-cmd-1") - else: - actions.key("ctrl-shift-1") - - def replace_confirm_all(): - """Confirm replace all""" - if is_mac: - actions.key("cmd-enter") - else: - actions.key("ctrl-alt-enter") - - def select_previous_occurrence(text: str): - actions.edit.find(text) - actions.sleep("100ms") - actions.key("shift-enter esc") - - def select_next_occurrence(text: str): - actions.edit.find(text) - actions.sleep("100ms") - actions.key("esc") - - def select_next_token(): - actions.edit.find("") - actions.key("enter") - actions.key("enter") - actions.key("esc") - - # find_and_replace.py support end diff --git a/talon/community/community-cursorless-0.4.0/apps/vscode/vscode.talon b/talon/community/community-cursorless-0.4.0/apps/vscode/vscode.talon deleted file mode 100644 index d06a151..0000000 --- a/talon/community/community-cursorless-0.4.0/apps/vscode/vscode.talon +++ /dev/null @@ -1,387 +0,0 @@ -#custom vscode commands go here -app: vscode -- -tag(): user.find_and_replace -tag(): user.line_commands -tag(): user.multiple_cursors -tag(): user.snippets -tag(): user.splits -tag(): user.tabs - -# TODO remove this once implemented in cursorless -cut line: - key(cmd-x) - -action(edit.select_line): - key(ctrl-e cmd-shift-left) - - line: - user.vscode_and_wait("editor.action.deleteLines") - -action(user.new_line_below): - user.vscode_and_wait("editor.action.insertLineAfter") - -action(user.new_line_above): - user.vscode_and_wait("editor.action.insertLineBefore") - -settings(): - key_wait = 1 - -#talon app actions -action(app.tab_close): user.vscode("workbench.action.closeActiveEditor") -action(app.tab_next): user.vscode("workbench.action.nextEditorInGroup") -action(app.tab_previous): user.vscode("workbench.action.previousEditorInGroup") -action(app.tab_reopen): user.vscode("workbench.action.reopenClosedEditor") -action(app.window_close): user.vscode("workbench.action.closeWindow") -action(app.window_open): user.vscode("workbench.action.newWindow") - last: user.vscode("workbench.action.openPreviousRecentlyUsedEditorInGroup") - next: user.vscode("workbench.action.openNextRecentlyUsedEditorInGroup") - -#talon code actions -action(code.toggle_comment): user.vscode("editor.action.commentLine") - -#talon edit actions -action(edit.indent_more): user.vscode("editor.action.indentLines") -action(edit.indent_less): user.vscode("editor.action.outdentLines") -action(edit.save_all): user.vscode("workbench.action.files.saveAll") - -# splits.py support begin -action(user.split_clear_all): - user.vscode("workbench.action.editorLayoutSingle") -action(user.split_clear): - user.vscode("workbench.action.joinTwoGroups") -action(user.split_flip): - user.vscode("workbench.action.toggleEditorGroupLayout") -action(user.split_last): - user.vscode("workbench.action.focusLeftGroup") -action(user.split_next): - user.vscode_and_wait("workbench.action.focusRightGroup") -action(user.split_window_down): - user.vscode("workbench.action.moveEditorToBelowGroup") -action(user.split_window_horizontally): - user.vscode("workbench.action.splitEditorOrthogonal") -action(user.split_window_left): - user.vscode("workbench.action.moveEditorToLeftGroup") -action(user.split_window_right): - user.vscode("workbench.action.moveEditorToRightGroup") -action(user.split_window_up): - user.vscode("workbench.action.moveEditorToAboveGroup") -action(user.split_window_vertically): - user.vscode("workbench.action.splitEditor") -action(user.split_window): - user.vscode("workbench.action.splitEditor") -cross: - # user.vscode("vscode-neovim.escape") - # sleep(25ms) - user.split_next() - # key(a) -# splits.py support end - -#multiple_cursor.py support begin -#note: vscode has no explicit mode for multiple cursors -action(user.multi_cursor_add_above): - user.vscode("editor.action.insertCursorAbove") -action(user.multi_cursor_add_below): - user.vscode("editor.action.insertCursorBelow") -action(user.multi_cursor_add_to_line_ends): - user.vscode("editor.action.insertCursorAtEndOfEachLineSelected") -action(user.multi_cursor_disable): key(escape) -action(user.multi_cursor_enable): skip() -action(user.multi_cursor_select_all_occurrences): - user.vscode("editor.action.selectHighlights") -action(user.multi_cursor_select_fewer_occurrences): - user.vscode("cursorUndo") -action(user.multi_cursor_select_more_occurrences): - user.vscode("editor.action.addSelectionToNextFindMatch") -#multiple_cursor.py support end - -please []: - user.vscode("workbench.action.showCommands") - insert(user.text or "") - -# Sidebar -bar explore: user.vscode("workbench.view.explorer") -bar extensions: user.vscode("workbench.view.extensions") -bar outline: user.vscode("outline.focus") -bar run: user.vscode("workbench.view.debug") -bar source: user.vscode("workbench.view.scm") -side dog: user.vscode("workbench.action.toggleSidebarVisibility") -search next: user.vscode("search.action.focusNextSearchResult") -search last: user.vscode("search.action.focusPreviousSearchResult") - -symbol hunt []: - user.vscode("workbench.action.gotoSymbol") - sleep(50ms) - insert(text or "") - -symbol last: user.vscode("gotoNextPreviousMember.previousMember") -symbol next: user.vscode("gotoNextPreviousMember.nextMember") -# symbol: user.vscode_and_wait("semantic-movement.jumpToContainingSymbol") -# funk: user.vscode_and_wait("semantic-movement.jumpToContainingFunction") -# named funk: user.vscode_and_wait("semantic-movement.jumpToContainingNamedFunction") -# class: user.vscode_and_wait("semantic-movement.jumpToContainingClass") -# symbol: user.vscode_and_wait("semantic-movement.selectContainingSymbol") -# funk: user.vscode_and_wait("semantic-movement.selectContainingFunction") -# named funk: user.vscode_and_wait("semantic-movement.selectContainingNamedFunction") -# class: user.vscode_and_wait("semantic-movement.selectContainingClass") - -# Panels -panel control: user.vscode("workbench.panel.repl.view.focus") -panel output: user.vscode("workbench.panel.output.focus") -panel problems: user.vscode("workbench.panel.markers.view.focus") -low dog: user.vscode("workbench.action.togglePanel") -panel terminal: user.vscode("workbench.panel.terminal.focus") -pan edit: user.vscode("workbench.action.focusActiveEditorGroup") - -# Settings -show settings: user.vscode("workbench.action.openGlobalSettings") -show shortcuts: user.vscode("workbench.action.openGlobalKeybindings") -show snippets: user.vscode("workbench.action.openSnippets") - -# Display -centered switch: user.vscode("workbench.action.toggleCenteredLayout") -fullscreen switch: user.vscode("workbench.action.toggleFullScreen") -theme switch: user.vscode("workbench.action.selectTheme") -wrap switch: user.vscode("editor.action.toggleWordWrap") -zen switch: user.vscode("workbench.action.toggleZenMode") - -# File Commands - dock [] [{user.file_extension}]: - user.vscode("workbench.action.quickOpen") - sleep(50ms) - insert(text or "") - insert(file_extension or "") - sleep(300ms) - dock [] [{user.file_extension}]: - user.vscode("workbench.action.quickOpen") - sleep(50ms) - insert(text or "") - insert(file_extension or "") - sleep(300ms) - key(enter) -file copy path: - user.vscode("copyFilePath") -file create sibling * [] [{user.file_extension}]: - user.vscode_and_wait("explorer.newFile") - sleep(500ms) - user.insert_many(format_text_list or "") - user.insert_formatted(user.word or "", "NOOP") - insert(file_extension or "") -file create: user.vscode("workbench.action.files.newUntitledFile") -file rename: - user.vscode("fileutils.renameFile") - sleep(150ms) -file move: - user.vscode("fileutils.moveFile") - sleep(150ms) -file open folder: - user.vscode("revealFileInOS") -file reveal: user.vscode("workbench.files.action.showActiveFileInExplorer") -save ugly: - user.vscode("workbench.action.files.saveWithoutFormatting") -file clone: - user.vscode("fileutils.duplicateFile") - sleep(150ms) -action(edit.save): - key(cmd-s) - sleep(50ms) - -# Language Features -suggest show: user.vscode("editor.action.triggerSuggest") -hint show: user.vscode("editor.action.triggerParameterHints") -def show: user.vscode("editor.action.revealDefinition") -definition peek: user.vscode("editor.action.peekDefinition") -definition side: user.vscode("editor.action.revealDefinitionAside") -references show: user.vscode("editor.action.goToReferences") -ref show: user.vscode("references-view.find") -format that: user.vscode("editor.action.formatDocument") -format selection: user.vscode("editor.action.formatSelection") -imports fix: user.vscode("editor.action.organizeImports") -problem next: user.vscode("editor.action.marker.nextInFiles") -problem last: user.vscode("editor.action.marker.prevInFiles") -problem fix: user.vscode("problems.action.showQuickFixes") -rename that: user.vscode("editor.action.rename") -refactor that: user.vscode("editor.action.refactor") -whitespace trim: user.vscode("editor.action.trimTrailingWhitespace") -language switch: user.vscode("workbench.action.editor.changeLanguageMode") -refactor rename: user.vscode("editor.action.rename") -refactor this: user.vscode("editor.action.refactor") -ref next: - user.vscode("references-view.tree.focus") - key(down enter) -ref last: - user.vscode("references-view.tree.focus") - key(up enter) - -#code navigation -( declaration | follow): - user.vscode("editor.action.revealDefinition") -spring back: - user.vscode("workbench.action.navigateBack") -spring forward: user.vscode("workbench.action.navigateForward") - implementation: - user.vscode("editor.action.goToImplementation") - type: - user.vscode("editor.action.goToTypeDefinition") - usage: - user.vscode("references-view.find") - -# Bookmarks. Requires Bookmarks plugin - sesh []: - user.vscode("workbench.action.openRecent") - sleep(50ms) - insert(text or "") - sleep(250ms) - sesh []: - user.vscode("workbench.action.openRecent") - sleep(50ms) - insert(text or "") - key(enter) - sleep(250ms) - - marks: user.vscode("workbench.view.extension.bookmarks") -toggle mark: user.vscode("bookmarks.toggle") - next mark: user.vscode("bookmarks.jumpToNext") - last mark: user.vscode("bookmarks.jumpToPrevious") - -# Folding -fold that: user.vscode("editor.fold") -unfold that: user.vscode("editor.unfold") -fold those: user.vscode("editor.foldAllMarkerRegions") -unfold those: user.vscode("editor.unfoldRecursively") -fold all: user.vscode("editor.foldAll") -unfold all: user.vscode("editor.unfoldAll") -fold comments: user.vscode("editor.foldAllBlockComments") - -# Git / Github (not using verb-noun-adjective pattern, mirroring terminal commands.) -git branch: user.vscode("git.branchFrom") -git branch this: user.vscode("git.branch") -git checkout []: - user.vscode("git.checkout") - sleep(50ms) - insert(text or "") -git commit []: - user.vscode("git.commitStaged") - sleep(100ms) - user.insert_formatted(text or "", "CAPITALIZE_FIRST_WORD") -git commit undo: user.vscode("git.undoCommit") -git commit ammend: user.vscode("git.commitStagedAmend") -git diff: user.vscode("git.openChange") -git ignore: user.vscode("git.ignore") -git merge: user.vscode("git.merge") -git output: user.vscode("git.showOutput") -git pull: user.vscode("git.pullRebase") -git push: user.vscode("git.push") -git push focus: user.vscode("git.pushForce") -git rebase abort: user.vscode("git.rebaseAbort") -git reveal: user.vscode("git.revealInExplorer") -git revert: user.vscode("git.revertChange") -git stash: user.vscode("git.stash") -git stash pop: user.vscode("git.stashPop") -git status: user.vscode("workbench.scm.focus") -git stage: user.vscode("git.stage") -git stage all: user.vscode("git.stageAll") -git unstage: user.vscode("git.unstage") -git unstage all: user.vscode("git.unstageAll") -pull request: user.vscode("pr.create") -change next: key(alt-f5) -change last: key(shift-alt-f5) - -#Debugging -break point: user.vscode("editor.debug.action.toggleBreakpoint") -step over: user.vscode("workbench.action.debug.stepOver") -debug step into: user.vscode("workbench.action.debug.stepInto") -debug step out [of]: user.vscode("workbench.action.debug.stepOut") -debug start: user.vscode("workbench.action.debug.start") -debug pause: user.vscode("workbench.action.debug.pause") -debug stopper: user.vscode("workbench.action.debug.stop") -debug continue: user.vscode("workbench.action.debug.continue") -debug restart: user.vscode("workbench.action.debug.restart") -debug console: user.vscode("workbench.debug.action.toggleRepl") - -# Terminal -term external: user.vscode("workbench.action.terminal.openNativeConsole") -term new: user.vscode("workbench.action.terminal.new") -term next: user.vscode("workbench.action.terminal.focusNext") -term last:user.vscode("workbench.action.terminal.focusPrevious") -term split: user.vscode("workbench.action.terminal.split") -term zoom: user.vscode("workbench.action.toggleMaximizedPanel") -term trash: user.vscode("workbench.action.terminal.kill") -term dog: user.vscode_and_wait("workbench.action.terminal.toggleTerminal") -term scroll up: user.vscode("workbench.action.terminal.scrollUp") -term scroll down: user.vscode("workbench.action.terminal.scrollDown") -term : user.vscode_terminal(number_small) - -#TODO: should this be added to linecommands? -copy line down: user.vscode("editor.action.copyLinesDownAction") -copy line up: user.vscode("editor.action.copyLinesUpAction") - -#Expand/Shrink AST Selection - less: user.vscode("editor.action.smartSelect.shrink") - (more|this): user.vscode("editor.action.smartSelect.expand") - -minimap: user.vscode("editor.action.toggleMinimap") -maximize: user.vscode("workbench.action.minimizeOtherEditors") -restore: user.vscode("workbench.action.evenEditorWidths") - -replace here: - user.replace("") - key(cmd-alt-l) - -hover show: user.vscode("editor.action.showHover") - -edit last: user.vscode("editsHistory.moveCursorToPreviousEdit") -edit next: user.vscode("editsHistory.moveCursorToNextEdit") -edit add: user.vscode("editsHistory.createEditAtCursor") -edit last here: user.vscode("editsHistory.moveCursorToPreviousEditInSameFile") -edit next here: user.vscode("editsHistory.moveCursorToNextEditInSameFile") - -join lines: user.vscode("editor.action.joinLines") - -commode: - user.vscode("vscode-neovim.escape") - sleep(25ms) - -insert: - key(i) - sleep(25ms) - -replace smart: - key(:) - sleep(50ms) - key(S) - key(/) - -swap this: user.vscode("extension.swap") - -full screen: user.vscode("workbench.action.toggleFullScreen") -reload window: user.vscode("workbench.action.reloadWindow") -close window: user.vscode("workbench.action.closeWindow") - -curse undo: user.vscode("cursorUndo") - - word: user.vscode("editor.action.addSelectionToNextFindMatch") -skip word: user.vscode("editor.action.moveSelectionToNextFindMatch") - -Github open: user.vscode("openInGithub.openInGitHubFile") - -stage on: - user.vscode_and_wait("git.stage") - key(cmd-w) - user.vscode_and_wait("workbench.scm.focus") - key(down:100) - sleep(100ms) - key(enter) - -# jupyter -cell next: user.vscode("jupyter.gotoNextCellInFile") -cell last: user.vscode("jupyter.gotoPrevCellInFile") -cell run above: user.vscode("jupyter.runallcellsabove.palette") -cell run: user.vscode("jupyter.runcurrentcell") - -jest: key(ctrl-space) -yes: - sleep(100ms) - key(tab) - -install local: user.vscode("workbench.extensions.action.installVSIX") \ No newline at end of file diff --git a/talon/community/community-cursorless-0.4.0/apps/web/github.talon b/talon/community/community-cursorless-0.4.0/apps/web/github.talon deleted file mode 100644 index e254513..0000000 --- a/talon/community/community-cursorless-0.4.0/apps/web/github.talon +++ /dev/null @@ -1,57 +0,0 @@ -# https://help.github.com/en/github/getting-started-with-github/keyboard-shortcuts -tag: browser -win.title: /github.com/ -- - -# site wide shortcuts -focus search: key(s) -go to notifications: insert("gn") -go to dashboard: insert("gd") -show keyboard shortcuts: key(?) -move selection down: key(j) -move selection up: key(k) -toggle selection: key(x) -open selection: key(o) - -# repositories -go to code: insert("gc") -go to issues: insert("gi") -go to pull requests: insert("gp") -go to wiki: insert("gw") - -# network graph - -# source code browsing -find file: key(t) -jump to line: key(l) -switch (branch|tag): key(w) -expand url: key(y) -(show|hide) [all] in line notes: key(i) - -# issues -create [an] issue: key(c) -search (issues|[pull] requests): key(/) -(filter by|edit) labels: key(l) -(filter by|edit) milestones: key(m) -(filter by|edit) assignee: key(a) -reply: key(r) -submit comment: key(ctrl-enter) -preview comment: key(ctrl-shift-p) -#go fullscreen: key(ctrl-shift-l) -git hub full screen: key(ctrl-shift-l) - -# browsing commit -#submit comment: key(ctrl-enter) -close form: key(escape) -parent commit: key(p) -other parent commit: key(o) - -# commit list -#expand url: key(y) - -# notifications -mark as read: key(y) -mute thread: key(shift-m) - -# pull request list -open issue: key(o) diff --git a/talon/community/community-cursorless-0.4.0/apps/web/gitlab.talon b/talon/community/community-cursorless-0.4.0/apps/web/gitlab.talon deleted file mode 100644 index 950f05f..0000000 --- a/talon/community/community-cursorless-0.4.0/apps/web/gitlab.talon +++ /dev/null @@ -1,61 +0,0 @@ -# Shortcuts taken from: https://docs.gitlab.com/ee/user/shortcuts.html -# - -tag: browser -win.title: /gitlab.com/ -#win.title: /GitLab/ -- - -# global shortcuts -show shortcuts: key(?) -go to projects [page]: key(shift-p) -go to groups [page]: key(shift-g) -go to activity [page]: key(shift-a) -go to milestones [page]: key(shift-l) -go to snippets [page]: key(shift-s) -search page: key(s) -go to issues [page]: key(shift-i) -go to merge requests [page]: key(shift-m) -go to to do [list] [page]: key(shift-t) -(show|hide) performance bar: key(p) - -edit last comment: key(1) -toggle mark down [preview]: key(ctrl-shift-p) - -# projects -go [to] project home [page]: insert("gp") -go [to] project activity [feed]: insert("gv") -go [to] project releases [list]: insert("gr") -go [to] project files [list]: insert("gf") -go [to] project file search [page]: key(t) -go [to] project (commit|commits) [list]: insert("gc") -go [to] (repository|repo) graph [page]: insert("gn") -go [to] (repository|repo) charts: insert("gd") -go [to] project issues [list]: insert("gi") -go [to] new issues [list]: insert("i") -go [to] project issues boards [list]: insert("gb") -go [to] project merge requests [list]: insert("gm") -go [to] jobs [list]: insert("gj") -go [to] project metrics: insert("gl") -go [to] project environments: insert("ge") -go [to] project cubes: insert("gk") -go [to] project snippets [list]: insert("gs") -go [to] project wiki: insert("gw") - -# issues and merge requests -edit description: key(e) -change assignee: key(a) -change milestone: key(m) -change label: key(l) -right comment: key(r) -next [unresolved] discussion: key(n) -previous [unresolved] discussion: key(p) -next file: key(]) -previous file: key([) - -# project files -back to files: key(escape) -open permalink: key(y) - -# wiki pages -edit page: key(e) diff --git a/talon/community/community-cursorless-0.4.0/apps/web/gmail.talon b/talon/community/community-cursorless-0.4.0/apps/web/gmail.talon deleted file mode 100644 index 983ffca..0000000 --- a/talon/community/community-cursorless-0.4.0/apps/web/gmail.talon +++ /dev/null @@ -1,12 +0,0 @@ -tag: browser -win.title: /gmail.com/ -- - -show inbox: key(escape i g i escape) -email sign off: - edit.line_end() - key(enter:2) - insert("Best,") - key(enter) - insert("Pokey") -forward this: key(escape i f) \ No newline at end of file diff --git a/talon/community/community-cursorless-0.4.0/apps/web/outlook.talon b/talon/community/community-cursorless-0.4.0/apps/web/outlook.talon deleted file mode 100644 index 92bf15d..0000000 --- a/talon/community/community-cursorless-0.4.0/apps/web/outlook.talon +++ /dev/null @@ -1,65 +0,0 @@ -# https://support.office.com/en-us/article/keyboard-shortcuts-for-outlook-3cdeb221-7ae5-4c1d-8c1d-9e63216c1efd#PickTab=Web -# the shortcuts below our based half of the bill in short cut menu, but the -# link above has significantly more that could so be added - -os: linux -tag: browser -win.title: /Outlook/ -- - -# write email -new message: key(n) -send [this] message: key(alt-s) -reply [to] [this] message: key(r) -reply all [to] [this] message: key(ctrl-shift-r) -forward [this] message: key(ctrl-shift-f) -save [draft]: key(ctrl-s) -discard [draft]: key(esc) -insert [a] [hyper] link: key(ctrl-k) - -# email list -(select|unselect) [this] message: key(ctrl-space) -select all [messages]: key(ctrl-a) -clear all [messages]: key(esc) -select first [message]: key(home) -select last [message]: key(and) - -# read email -open [this] message: key(o) -open [this] message [in] [a] new window: key(shift-enter) -close [this] message: key(esc) -[open] [the] next (item|message): key(ctrl-.) -[open] [the] (prev|previous) item: key(ctrl-,) -next reading [pane] (item|message): key(.) -(prev|previous) [pane] (item|message): key(,) -(expand|collapse) [conversation]: key(x) - -# go to -go [to] mail: key(ctrl-shift-1) -go [to] calendar: key(ctrl-shift-2) -go [to] people: key(ctrl-shift-3) -go [to] to do: key(ctrl-shift-4) -go [to] inbox: - key(g) - key(i) -go to drafts: - key(g) - key(d) -go to sent: - key(g) - key(s) -search [email]: key(alt-q) -show help: key(?) - -# email actions -undo [last] [action]: key(ctrl-z) -delete [this] [message]: key(delete) -(perm|permanently) delete [this] [message]: key(shift+delete) -new folder: key(shift-e) -mark [this] [(item|message)] as read: key(q) -mark [this] [(item|message)] as unread: key(u) -flag [this] [(item|message)]: key(insert) -archive: key(e) -mark [this] [message] [as] junk: key(j) -moved to [a] folder: key(v) -categorize [this] message: key(c) diff --git a/talon/community/community-cursorless-0.4.0/apps/web/protonmail.talon b/talon/community/community-cursorless-0.4.0/apps/web/protonmail.talon deleted file mode 100644 index e106ae1..0000000 --- a/talon/community/community-cursorless-0.4.0/apps/web/protonmail.talon +++ /dev/null @@ -1,81 +0,0 @@ -tag: browser -win.title: /ProtonMail/ -- -# General -## Application -open help: key(?) -[focus] search: key(/) -confirm active: key(enter) -close active: key(escape) -open command [palette]: key(shift-space) - -## Composer -new message: key(c) -send message: key(ctrl-enter) -save message: key(ctrl-s) - -# Mail -## Jumping -(go|jump) [to] inbox: - key(g) - key(i) -(go|jump) [to] draft: - key(g) - key(d) -(go|jump) [to] sent: - key(g) - key(s) -(go|jump) [to] starred: - key(g) - key(.) -(go|jump) [to] archive: - key(g) - key(a) -(go|jump) [to] spam: - key(g) - key(x) -(go|jump) [to] trash: - key(g) - key(t) - -## Navigation -(prev|previous) message: key(up) -next message: key(down) -exit message: key(left) -enter message: key(right) -(show|display) newer [message]: key(k) -(show|display) older [message]: key(j) -open message: key(enter) -go back: key(escape) - -## Threadlist -select all: - key(*) - key(a) -(deselect|unselect) all: - key(*) - key(n) -select [the] (message|conversation): key(x) -mark [as] read: key(r) -mark [as] unread: key(u) -star (message|conversation): key(.) -move to inbox: key(i) -move to trash: key(t) -move to archive: key(a) -move to spam: key(s) - -## Actions -reply to (message|conversation): key(shift-r) -reply all [to] (message|conversation): key(shift-a) -forward (message|conversation): key(shift-f) - -# Contacts -## Contact List -(prev|previous) contact: key(up) -next contact: key(down) -enter contact: key(right) -delete contact: key(t) - -## Contact Details -exit contact: key(left) -save contact: key(ctrl-s) diff --git a/talon/community/community-cursorless-0.4.0/apps/web/twitter.talon b/talon/community/community-cursorless-0.4.0/apps/web/twitter.talon deleted file mode 100644 index 2bae5b6..0000000 --- a/talon/community/community-cursorless-0.4.0/apps/web/twitter.talon +++ /dev/null @@ -1,37 +0,0 @@ -tag: browser -win.title: /twitter.com/ -#win.title: /Twitter/ -- - -# navigation -(show shortcuts|shortcuts help): key(?) -next tweet: key(j) -previous tweet: key(k) -page down: key(space) -load new tweet: key(.) -go home: insert("gh") -go explore: insert("ge") -go notifications: insert("gn") -go mentions: insert("gr") -go profile: insert("gp") -go likes: insert("gl") -go lists: insert("gi") -go direct messages: insert("gm") -go settings: insert("gs") -go book marks: insert("gb") -go to user: insert("gu") -display settings: insert("gd") -# actions -new tweet: key(n) -send tweet: key(ctrl-enter) -new direct message: key(m) -search: key(/) -like message: key(l) -reply message: key(r) -re tweet [message]: key(t) -share tweet: key(s) -bookmark: key(b) -mute account: key(urge) -block account: key(x) -open details: key(enter) -expand photo: key(o) diff --git a/talon/community/community-cursorless-0.4.0/apps/web/window_titles.md b/talon/community/community-cursorless-0.4.0/apps/web/window_titles.md deleted file mode 100644 index c1e8cdb..0000000 --- a/talon/community/community-cursorless-0.4.0/apps/web/window_titles.md +++ /dev/null @@ -1,9 +0,0 @@ -These talon files mostly match based on the url of the target site, however by -default talon cannot find these URLs. To get the URL listed in the tab name, -and thus the win.title, you need to use a plug in: -Firefox: https://addons.mozilla.org/en-US/firefox/addon/domain-in-title/ -Chrome: https://chrome.google.com/webstore/detail/url-in-title/ignpacbgnbnkaiooknalneoeladjnfgb?hl=en - -Alternatively if you are comfortable with using a name that's possibly more -prone to false positives, you can optionally use the commented out name-based -match that is present in many of the files. diff --git a/talon/community/community-cursorless-0.4.0/apps/win/app.talon b/talon/community/community-cursorless-0.4.0/apps/win/app.talon deleted file mode 100644 index 564736e..0000000 --- a/talon/community/community-cursorless-0.4.0/apps/win/app.talon +++ /dev/null @@ -1,42 +0,0 @@ -os: windows -os: linux -- -#app.preferences() - -action(app.tab_close): - key(ctrl-w) - -#action(app.tab_detach): -# Move the current tab to a new window - -action(app.tab_next): - key(ctrl-tab) - -action(app.tab_open): - key(ctrl-t) - -action(app.tab_previous): - key(ctrl-shift-tab) - -action(app.tab_reopen): - key(ctrl-shift-t) - -action(app.window_close): - key(alt-f4) - -action(app.window_hide): - key(alt-space n) - -action(app.window_hide_others): - key(win-d alt-tab) - -#requires easy window switcher or equivalent (built into most Linux) -action(app.window_next): - key(alt-`) - -action(app.window_open): - key(ctrl-n) - -#requires easy window switcher or equivalent (built into most Linux) -action(app.window_previous): - key(alt-shift-`) diff --git a/talon/community/community-cursorless-0.4.0/apps/win/command_processor/command_processor.py b/talon/community/community-cursorless-0.4.0/apps/win/command_processor/command_processor.py deleted file mode 100644 index 383217c..0000000 --- a/talon/community/community-cursorless-0.4.0/apps/win/command_processor/command_processor.py +++ /dev/null @@ -1,95 +0,0 @@ -from talon import Context, Module, actions, imgui, settings, ui, app - -import os - -ctx = Context() -ctx.matches = r""" -app: windows_command_processor -app: windows_terminal -and win.title: /Command Prompt/ -""" - -user_path = os.path.expanduser("~") -directories_to_remap = {} -directories_to_exclude = {} - - -@ctx.action_class("user") -class user_actions: - def file_manager_current_path(): - path = ui.active_window().title - path = path.replace("Administrator: ", "").replace("Command Prompt: ", "") - if path in directories_to_remap: - path = directories_to_remap[path] - - if path in directories_to_exclude: - path = "" - return path - - # def file_manager_terminal_here(): - # actions.key("ctrl-l") - # actions.insert("cmd.exe") - # actions.key("enter") - - # def file_manager_show_properties(): - # """Shows the properties for the file""" - # actions.key("alt-enter") - - def file_manager_open_directory(path: str): - """opens the directory that's already visible in the view""" - actions.insert('cd "{}"'.format(path)) - actions.key("enter") - actions.user.file_manager_refresh_title() - - def file_manager_select_directory(path: str): - """selects the directory""" - actions.insert('"{}"'.format(path)) - - def file_manager_new_folder(name: str): - """Creates a new folder in a gui filemanager or inserts the command to do so for terminals""" - actions.insert('mkdir "{}"'.format(name)) - - def file_manager_open_file(path: str): - """opens the file""" - actions.insert(path) - # actions.key("enter") - - def file_manager_select_file(path: str): - """selects the file""" - actions.insert(path) - - def file_manager_open_volume(volume: str): - """file_manager_open_volume""" - actions.user.file_manager_open_directory(volume) - - def terminal_list_directories(): - """Lists directories""" - actions.insert("dir") - actions.key("enter") - - def terminal_list_all_directories(): - actions.insert("dir /a") - actions.key("enter") - - def terminal_change_directory(path: str): - actions.insert("cd {}".format(path)) - # if path: - # actions.key("enter") - - def terminal_change_directory_root(): - """Root of current drive""" - actions.insert("cd /") - actions.key("enter") - - def terminal_clear_screen(): - """Clear screen""" - actions.insert("cls") - actions.key("enter") - - def terminal_run_last(): - actions.key("up enter") - - def terminal_kill_all(): - actions.key("ctrl-c") - actions.insert("y") - actions.key("enter") diff --git a/talon/community/community-cursorless-0.4.0/apps/win/command_processor/command_processor.talon b/talon/community/community-cursorless-0.4.0/apps/win/command_processor/command_processor.talon deleted file mode 100644 index 95c63e9..0000000 --- a/talon/community/community-cursorless-0.4.0/apps/win/command_processor/command_processor.talon +++ /dev/null @@ -1,27 +0,0 @@ -app: windows_command_processor -app: windows_terminal -and win.title: /Command Prompt/ -- -# comment or remove tags for command sets you don't want -tag(): user.file_manager -tag(): user.generic_terminal -tag(): user.git -tag(): user.kubectl -tag(): terminal - -action(user.file_manager_refresh_title): - insert("title Command Prompt: %CD%") - key(enter) - -#action(user.file_manager_go_back): -# key("alt-left") - -#action(user.file_manager_go_forward): -# key("alt-right") - -action(user.file_manager_open_parent): - insert("cd ..") - key(enter) - user.file_manager_refresh_title() - -action(edit.delete_line): key(esc) \ No newline at end of file diff --git a/talon/community/community-cursorless-0.4.0/apps/win/edit.talon b/talon/community/community-cursorless-0.4.0/apps/win/edit.talon deleted file mode 100644 index fe341ef..0000000 --- a/talon/community/community-cursorless-0.4.0/apps/win/edit.talon +++ /dev/null @@ -1,205 +0,0 @@ -os: windows -os: linux -- -action(edit.copy): - key(ctrl-c) - -action(edit.cut): - key(ctrl-x) - -action(edit.delete): - key(backspace) - -action(edit.delete_line): - edit.select_line() - edit.delete() - -#action(edit.delete_paragraph): - -#action(edit.delete_sentence): - -action(edit.delete_word): - edit.select_word() - edit.delete() - -action(edit.down): - key(down) - -#action(edit.extend_again): - -#action(edit.extend_column): - -action(edit.extend_down): - key(shift-down) - -action(edit.extend_file_end): - key(shift-ctrl-end) - -action(edit.extend_file_start): - key(shift-ctrl-home) - -action(edit.extend_left): - key(shift-left) - -#action(edit.extend_line): - -action(edit.extend_line_down): - key(shift-down) - -action(edit.extend_line_end): - key(shift-end) - -action(edit.extend_line_start): - key(shift-home) - -action(edit.extend_line_up): - key(shift-up) - -action(edit.extend_page_down): - key(shift-pagedown) - -action(edit.extend_page_up): - key(shift-pageup) - -#action(edit.extend_paragraph_end): -#action(edit.extend_paragraph_next()): -#action(edit.extend_paragraph_previous()): -#action(edit.extend_paragraph_start()): - -action(edit.extend_right): - key(shift-right) - -#action(edit.extend_sentence_end): -#action(edit.extend_sentence_next): -#action(edit.extend_sentence_previous): -#action(edit.extend_sentence_start): - -action(edit.extend_up): - key(shift-up) - -action(edit.extend_word_left): - key(ctrl-shift-left) - -action(edit.extend_word_right): - key(ctrl-shift-right) - -action(edit.file_end): - key(ctrl-end) - -action(edit.file_start): - key(ctrl-home) - -action(edit.find): - key(ctrl-f) - actions.insert(text) - -action(edit.find_next): - key(f3) -#action(edit.find_previous): - -action(edit.indent_less): - key(home delete) - -action(edit.indent_more): - key(home tab) - -#action(edit.jump_column(n: int) -#action(edit.jump_line(n: int) - -action(edit.left): - key(left) - -action(edit.line_down): - key(down home) - -action(edit.line_end): - key(end) - -action(edit.line_insert_down): - key(end enter) - -action(edit.line_insert_up): - key(home enter up) - -action(edit.line_start): - key(home) - -action(edit.line_up): - key(up home) - -#action(edit.move_again): - -action(edit.page_down): - key(pagedown) - -action(edit.page_up): - key(pageup) - -#action(edit.paragraph_end): -#action(edit.paragraph_next): -#action(edit.paragraph_previous): -#action(edit.paragraph_start): - -action(edit.paste): - key(ctrl-v) - -#action(paste_match_style): - -action(edit.print): - key(ctrl-p) - -action(edit.redo): - key(ctrl-y) - -action(edit.right): - key(right) - -action(edit.save): - key(ctrl-s) - -action(edit.save_all): - key(ctrl-shift-s) - -action(edit.select_all): - key(ctrl-a) - -action(edit.select_line): - key(end shift-home) - -#action(edit.select_lines(a: int, b: int)): - -action(edit.select_none): - key(right) - -#action(edit.select_paragraph): -#action(edit.select_sentence): - -action(edit.select_word): - key(ctrl-left ctrl-shift-right) - -#action(edit.selected_text): -> str -#action(edit.sentence_end): -#action(edit.sentence_next): -#action(edit.sentence_previous): -#action(edit.sentence_start): - -action(edit.undo): - key(ctrl-z) - -action(edit.up): - key(up) - -action(edit.word_left): - key(ctrl-left) - -action(edit.word_right): - key(ctrl-right) - -action(edit.zoom_in): - key(ctrl-+) - -action(edit.zoom_out): - key(ctrl--) - -action(edit.zoom_reset): - key(ctrl-0) diff --git a/talon/community/community-cursorless-0.4.0/apps/win/explorer/explorer.py b/talon/community/community-cursorless-0.4.0/apps/win/explorer/explorer.py deleted file mode 100644 index 2d75b50..0000000 --- a/talon/community/community-cursorless-0.4.0/apps/win/explorer/explorer.py +++ /dev/null @@ -1,139 +0,0 @@ -from talon import Context, Module, actions, imgui, settings, ui, app - -import os - -mod = Module() -apps = mod.apps - -apps.windows_explorer = """ -os: windows -and app.name: Windows Explorer -os: windows -and app.exe: explorer.exe -""" - -# many commands should work in most save/open dialog. -# note the "show options" stuff won't work unless work -# unless the path is displayed in the title, which is rare for those -apps.windows_file_browser = """ -os: windows -and app.name: /.*/ -and title: /(Save|Open|Browse|Select)/ -""" - -ctx = Context() -ctx.matches = r""" -app: windows_explorer -app: windows_file_browser -""" - -user_path = os.path.expanduser("~") -directories_to_remap = {} -directories_to_exclude = {} - -if app.platform == "windows": - is_windows = True - import ctypes - - GetUserNameEx = ctypes.windll.secur32.GetUserNameExW - NameDisplay = 3 - - size = ctypes.pointer(ctypes.c_ulong(0)) - GetUserNameEx(NameDisplay, None, size) - - nameBuffer = ctypes.create_unicode_buffer(size.contents.value) - GetUserNameEx(NameDisplay, nameBuffer, size) - one_drive_path = os.path.expanduser(os.path.join("~", "OneDrive")) - - # this is probably not the correct way to check for onedrive, quick and dirty - if os.path.isdir(os.path.expanduser(os.path.join("~", r"OneDrive\Desktop"))): - default_folder = os.path.join("~", "Desktop") - - directories_to_remap = { - "Desktop": os.path.join(one_drive_path, "Desktop"), - "Documents": os.path.join(one_drive_path, "Documents"), - "Downloads": os.path.join(user_path, "Downloads"), - "Music": os.path.join(user_path, "Music"), - "OneDrive": one_drive_path, - "Pictures": os.path.join(one_drive_path, "Pictures"), - "Videos": os.path.join(user_path, "Videos"), - } - else: - # todo use expanduser for cross platform support - directories_to_remap = { - "Desktop": os.path.join(user_path, "Desktop"), - "Documents": os.path.join(user_path, "Documents"), - "Downloads": os.path.join(user_path, "Downloads"), - "Music": os.path.join(user_path, "Music"), - "OneDrive": one_drive_path, - "Pictures": os.path.join(user_path, "Pictures"), - "Videos": os.path.join(user_path, "Videos"), - } - - if nameBuffer.value: - directories_to_remap[nameBuffer.value] = user_path - - directories_to_exclude = [ - "", - "Run", - "Task Switching", - "Task View", - "This PC", - "File Explorer", - "Program Manager", - ] - - -@ctx.action_class("user") -class user_actions: - def file_manager_current_path(): - path = ui.active_window().title - - if path in directories_to_remap: - path = directories_to_remap[path] - - if path in directories_to_exclude: - actions.user.file_manager_hide_pickers() - path = "" - - return path - - def file_manager_terminal_here(): - actions.key("ctrl-l") - actions.insert("cmd.exe") - actions.key("enter") - - def file_manager_show_properties(): - """Shows the properties for the file""" - actions.key("alt-enter") - - def file_manager_open_directory(path: str): - """opens the directory that's already visible in the view""" - actions.key("ctrl-l") - actions.insert(path) - actions.key("enter") - - def file_manager_select_directory(path: str): - """selects the directory""" - actions.insert(path) - - def file_manager_new_folder(name: str): - """Creates a new folder in a gui filemanager or inserts the command to do so for terminals""" - actions.key("home") - actions.key("ctrl-shift-n") - actions.insert(name) - - def file_manager_open_file(path: str): - """opens the file""" - actions.key("home") - actions.insert(path) - actions.key("enter") - - def file_manager_select_file(path: str): - """selects the file""" - actions.key("home") - actions.insert(path) - - def file_manager_open_volume(volume: str): - """file_manager_open_volume""" - actions.user.file_manager_open_directory(volume) diff --git a/talon/community/community-cursorless-0.4.0/apps/win/explorer/explorer.talon b/talon/community/community-cursorless-0.4.0/apps/win/explorer/explorer.talon deleted file mode 100644 index 37e3ff7..0000000 --- a/talon/community/community-cursorless-0.4.0/apps/win/explorer/explorer.talon +++ /dev/null @@ -1,14 +0,0 @@ -app: windows_explorer -app: windows_file_browser -- -tag(): user.file_manager -action(user.file_manager_go_back): - key("alt-left") -action(user.file_manager_go_forward): - key("alt-right") -action(user.file_manager_open_parent): - key("alt-up") - -^go $: user.file_manager_open_volume("{letter}:") -go app data: user.file_manager_open_directory("%AppData%") -go program files: user.file_manager_open_directory("%programfiles%") diff --git a/talon/community/community-cursorless-0.4.0/apps/win/mintty/mintty.py b/talon/community/community-cursorless-0.4.0/apps/win/mintty/mintty.py deleted file mode 100644 index 8ac393a..0000000 --- a/talon/community/community-cursorless-0.4.0/apps/win/mintty/mintty.py +++ /dev/null @@ -1,115 +0,0 @@ -from talon import Context, Module, actions, imgui, settings, ui -import os -import subprocess - -mod = Module() -mod.apps.mintty = """ -os: windows -and app.name: Terminal -os: windows -and app.name: mintty.exe -""" - -ctx = Context() -ctx.matches = r""" -app: mintty -""" -directories_to_remap = {} -directories_to_exclude = {} - -setting_cyg_path = mod.setting( - "cygpath", - type=str, - default="C:\\cygwin64\\bin\\cygpath.exe", - desc="Path to cygpath.exe", -) - - -def get_win_path(cyg_path): - path = "" - try: - path = ( - subprocess.check_output([setting_cyg_path.get(), "-w", cyg_path]) - .strip(b"\n") - .decode() - ) - except: - path = "" - return path - - -@ctx.action_class("user") -class user_actions: - def file_manager_current_path(): - path = ui.active_window().title - path = get_win_path(path) - - if path in directories_to_remap: - path = directories_to_remap[title] - - if path in directories_to_exclude: - path = "" - return path - - def file_manager_show_properties(): - """Shows the properties for the file""" - - def file_manager_open_directory(path: str): - """opens the directory that's already visible in the view""" - actions.insert("cd ") - path = '"{}"'.format(path) - actions.insert(path) - actions.key("enter") - - def file_manager_select_directory(path: str): - """selects the directory""" - actions.insert(path) - - def file_manager_new_folder(name: str): - """Creates a new folder in a gui filemanager or inserts the command to do so for terminals""" - name = '"{}"'.format(name) - - actions.insert("mkdir " + name) - - def file_manager_open_file(path: str): - """opens the file""" - actions.insert(path) - actions.key("enter") - - def file_manager_select_file(path: str): - """selects the file""" - actions.insert(path) - - def file_manager_open_volume(volume: str): - """file_manager_open_volume""" - actions.user.file_manager_open_directory(volume) - - def terminal_list_directories(): - actions.insert("ls") - actions.key("enter") - - def terminal_list_all_directories(): - actions.insert("ls -a") - actions.key("enter") - - def terminal_change_directory(path: str): - actions.insert("cd {}".format(path)) - if path: - actions.key("enter") - - def terminal_change_directory_root(): - """Root of current drive""" - actions.insert("cd /") - actions.key("enter") - - def terminal_clear_screen(): - """Clear screen""" - actions.key("ctrl-l") - - def terminal_run_last(): - actions.key("up enter") - - def terminal_kill_all(): - actions.key("ctrl-c") - actions.insert("y") - actions.key("enter") diff --git a/talon/community/community-cursorless-0.4.0/apps/win/mintty/mintty.talon b/talon/community/community-cursorless-0.4.0/apps/win/mintty/mintty.talon deleted file mode 100644 index 3ce1e31..0000000 --- a/talon/community/community-cursorless-0.4.0/apps/win/mintty/mintty.talon +++ /dev/null @@ -1,17 +0,0 @@ -app: mintty -- -tag(): terminal -tag(): user.file_manager -tag(): user.generic_terminal -tag(): user.git -tag(): user.kubectl - -action(user.file_manager_open_parent): - insert("cd ..") - key(enter) - -action(edit.paste): key(shift-insert) -action(edit.copy): key(ctrl-insert) - -action(edit.delete_line): key(ctrl-u) - diff --git a/talon/community/community-cursorless-0.4.0/apps/win/notepad++/notepad++.py b/talon/community/community-cursorless-0.4.0/apps/win/notepad++/notepad++.py deleted file mode 100644 index 10a3aaa..0000000 --- a/talon/community/community-cursorless-0.4.0/apps/win/notepad++/notepad++.py +++ /dev/null @@ -1,123 +0,0 @@ -from talon import Context, actions, ui, Module - -mod = Module() -ctx = Context() - -apps = mod.apps -apps.notepad_plus_plus = """ -os: windows -and app.name: Notepad++ : a free (GNU) source code editor -os: windows -and app.name: notepad++.exe -""" - -ctx.matches = r""" -app: notepad_plus_plus -""" - - -@ctx.action_class("win") -class win_actions: - def filename(): - title = actions.win.title() - result = title.split(" - ")[0] - if "." in result: - # print(result.split("\\")[-1]) - return result.split("\\")[-1] - return "" - - -@ctx.action_class("edit") -class edit_actions: - def jump_line(n: int): - actions.key("ctrl-g") - actions.insert(str(n)) - actions.key("enter") - - def find(text: str): - actions.key("ctrl-f") - actions.insert(text) - - -@ctx.action_class("user") -class user_actions: - def select_next_occurrence(text: str): - actions.edit.find(text) - actions.sleep("100ms") - actions.key("enter esc") - actions.sleep("100ms") - - def select_previous_occurrence(text: str): - actions.edit.find(text) - actions.sleep("100ms") - actions.key("shift-enter esc") - actions.sleep("100ms") - - def tab_jump(number: int): - if number < 10: - actions.key("ctrl-keypad_{}".format(number)) - - def tab_final(): - """Jumps to the final tab""" - print("Notepad doesn't support this...") - # actions.key("ctrl-numpad_0") - - # find_and_replace.py support begin - - def find(text: str): - """Triggers find in current editor""" - actions.key("ctrl-f") - - if text: - actions.insert(text) - - def find_next(): - actions.key("enter") - - def find_previous(): - actions.key("shift-enter") - - def find_everywhere(text: str): - """Triggers find across project""" - - actions.key("ctrl-shift-f") - - if text: - actions.insert(text) - - def find_toggle_match_by_case(): - """Toggles find match by case sensitivity""" - actions.key("alt-c") - - def find_toggle_match_by_word(): - """Toggles find match by whole words""" - actions.key("alt-w") - - def find_toggle_match_by_regex(): - """Toggles find match by regex""" - actions.key("alt-g") - - def replace(text: str): - """Search and replaces in the active editor""" - actions.key("esc ctrl-h") - - if text: - actions.insert(text) - - def replace_everywhere(text: str): - """Search and replaces in the entire project""" - actions.key("esc ctrl-shift-f") - - if text: - actions.insert(text) - - def replace_confirm(): - """Confirm replace at current position""" - actions.key("alt-r") - - def replace_confirm_all(): - """Confirm replace all""" - actions.key("alt-a") - - # find_and_replace.py support end - diff --git a/talon/community/community-cursorless-0.4.0/apps/win/notepad++/notepad++.talon b/talon/community/community-cursorless-0.4.0/apps/win/notepad++/notepad++.talon deleted file mode 100644 index f12ab63..0000000 --- a/talon/community/community-cursorless-0.4.0/apps/win/notepad++/notepad++.talon +++ /dev/null @@ -1,19 +0,0 @@ -app: notepad_plus_plus -- -tag(): user.find_and_replace -tag(): user.line_commands -tag(): user.tabs -action(app.tab_previous): - key(ctrl-pageup) -action(app.tab_next): - key(ctrl-pagedown) -action(code.toggle_comment): - key(ctrl-q) -action(edit.line_clone): - key(ctrl-d) -action(edit.line_swap_up): - key(ctrl-shift-up) -action(edit.line_swap_down): - key(ctrl-shift-down) -action(edit.indent_more): key(tab) -action(edit.indent_less): key(shift-tab) \ No newline at end of file diff --git a/talon/community/community-cursorless-0.4.0/apps/win/outlook/outlook.talon b/talon/community/community-cursorless-0.4.0/apps/win/outlook/outlook.talon deleted file mode 100644 index 746e60c..0000000 --- a/talon/community/community-cursorless-0.4.0/apps/win/outlook/outlook.talon +++ /dev/null @@ -1,11 +0,0 @@ -os: windows -and app: Outlook -- -archive: key(alt h o 1) -new e-mail: key(ctrl-n) -calendar: key(ctrl-2) -inbox: key(ctrl-1) -Reply: key(ctrl-r) -Reply all: key(ctrl-shift-r) -Forward: key(ctrl-f) -accept: key(shift-f10 c c enter) \ No newline at end of file diff --git a/talon/community/community-cursorless-0.4.0/apps/win/powershell/power_shell.py b/talon/community/community-cursorless-0.4.0/apps/win/powershell/power_shell.py deleted file mode 100644 index cbd17e4..0000000 --- a/talon/community/community-cursorless-0.4.0/apps/win/powershell/power_shell.py +++ /dev/null @@ -1,87 +0,0 @@ -from talon import Context, Module, actions, imgui, settings, ui, app - -import os - -ctx = Context() -mod = Module() -ctx.matches = r""" -app: windows_power_shell -app: windows_terminal -and win.title: /PowerShell/ -""" - -user_path = os.path.expanduser("~") -directories_to_remap = {} -directories_to_exclude = {} - - -@ctx.action_class("user") -class user_actions: - def file_manager_current_path(): - path = ui.active_window().title - path = path.replace("Administrator: ", "").replace("Windows PowerShell: ", "") - - if path in directories_to_remap: - path = directories_to_remap[path] - - if path in directories_to_exclude: - path = "" - return path - - def file_manager_open_directory(path: str): - """opens the directory that's already visible in the view""" - actions.insert('cd "{}"'.format(path)) - actions.key("enter") - actions.user.file_manager_refresh_title() - - def file_manager_select_directory(path: str): - """selects the directory""" - actions.insert('"{}"'.format(path)) - - def file_manager_new_folder(name: str): - """Creates a new folder in a gui filemanager or inserts the command to do so for terminals""" - actions.insert('mkdir "{}"'.format(name)) - - def file_manager_open_file(path: str): - """opens the file""" - actions.insert(path) - # actions.key("enter") - - def file_manager_select_file(path: str): - """selects the file""" - actions.insert(path) - - def file_manager_open_volume(volume: str): - """file_manager_open_volume""" - actions.user.file_manager_open_directory(volume) - - def terminal_list_directories(): - actions.insert("ls") - actions.key("enter") - - def terminal_list_all_directories(): - actions.insert("ls -force") - actions.key("enter") - - def terminal_change_directory(path: str): - actions.insert("cd {}".format(path)) - if path: - actions.key("enter") - - def terminal_change_directory_root(): - """Root of current drive""" - actions.insert("cd /") - actions.key("enter") - - def terminal_clear_screen(): - """Clear screen""" - actions.insert("cls") - actions.key("enter") - - def terminal_run_last(): - actions.key("up enter") - - def terminal_kill_all(): - actions.key("ctrl-c") - actions.insert("y") - actions.key("enter") diff --git a/talon/community/community-cursorless-0.4.0/apps/win/powershell/power_shell.talon b/talon/community/community-cursorless-0.4.0/apps/win/powershell/power_shell.talon deleted file mode 100644 index b9f3e72..0000000 --- a/talon/community/community-cursorless-0.4.0/apps/win/powershell/power_shell.talon +++ /dev/null @@ -1,26 +0,0 @@ -app: windows_power_shell -app: windows_terminal -and win.title: /PowerShell/ -- -tag(): user.file_manager -tag(): user.git -tag(): user.generic_terminal -tag(): user.kubectl -tag(): terminal - -action(user.file_manager_refresh_title): - insert("$Host.UI.RawUI.WindowTitle = 'Windows PowerShell: ' + $(get-location)") - key(enter) - -#action(user.file_manager_go_back): -# key("alt-left") - -#action(user.file_manager_go_forward): -# key("alt-right") - -action(user.file_manager_open_parent): - insert("cd ..") - key(enter) - user.file_manager_refresh_title() - -action(edit.delete_line): key(esc) \ No newline at end of file diff --git a/talon/community/community-cursorless-0.4.0/apps/win/windows_terminal/windows_terminal.py b/talon/community/community-cursorless-0.4.0/apps/win/windows_terminal/windows_terminal.py deleted file mode 100644 index 93b9698..0000000 --- a/talon/community/community-cursorless-0.4.0/apps/win/windows_terminal/windows_terminal.py +++ /dev/null @@ -1,72 +0,0 @@ -from talon import Context, Module, actions, imgui, settings, ui, app - -import os - -ctx = Context() -mod = Module() -ctx.matches = r""" -app: windows_terminal -""" - -user_path = os.path.expanduser("~") -directories_to_remap = {} -directories_to_exclude = {} - - -@ctx.action_class("user") -class user_actions: - def file_manager_current_path(): - path = ui.active_window().title - path = ( - path.replace("Administrator: ", "") - .replace("Windows PowerShell: ", "") - .replace("Command Prompt: ", "") - ) - - if path in directories_to_remap: - path = directories_to_remap[path] - - if path in directories_to_exclude: - path = "" - return path - - # def file_manager_terminal_here(): - # actions.key("ctrl-l") - # actions.insert("cmd.exe") - # actions.key("enter") - - # def file_manager_show_properties(): - # """Shows the properties for the file""" - # actions.key("alt-enter") - - def file_manager_open_directory(path: str): - """opens the directory that's already visible in the view""" - actions.insert('cd "{}"'.format(path)) - actions.key("enter") - actions.user.file_manager_refresh_title() - - def file_manager_select_directory(path: str): - """selects the directory""" - actions.insert('"{}"'.format(path)) - - def file_manager_new_folder(name: str): - """Creates a new folder in a gui filemanager or inserts the command to do so for terminals""" - actions.insert('mkdir "{}"'.format(name)) - - def file_manager_open_file(path: str): - """opens the file""" - actions.insert(path) - # actions.key("enter") - - def file_manager_select_file(path: str): - """selects the file""" - actions.insert(path) - - def file_manager_open_volume(volume: str): - """file_manager_open_volume""" - actions.user.file_manager_open_directory(volume) - actions.user.file_manager_refresh_title() - - def tab_jump(number: int): - actions.key("ctrl-alt-{}".format(number)) - diff --git a/talon/community/community-cursorless-0.4.0/apps/win/windows_terminal/windows_terminal.talon b/talon/community/community-cursorless-0.4.0/apps/win/windows_terminal/windows_terminal.talon deleted file mode 100644 index 19aefe1..0000000 --- a/talon/community/community-cursorless-0.4.0/apps/win/windows_terminal/windows_terminal.talon +++ /dev/null @@ -1,30 +0,0 @@ -app: windows_terminal -- -tag(): user.tabs -tag(): terminal - -# commands that work regardless of active terminal should go here. - -# windows terminal config based on mrob95's -# https://github.com/mrob95/WindowsTerminal-config/blob/master/settings.json - -action(edit.paste): key(ctrl-shift-v) -action(edit.copy): key(ctrl-shift-c) -action(app.tab_close): key(ctrl-shift-w) -action(app.tab_open): key(ctrl-shift-t) - -settings open : key(ctrl-,) -focus left: key(ctrl-alt-shift-left) -focus right: key(ctrl-alt-shift-right) -focus up: key(ctrl-alt-shift-up) -focus down: key(ctrl-alt-shift-down) -split right: key(ctrl-shift-h) -split down: key(ctrl-h) -term menu: key(ctrl-shift-f1) - -run last: key(up enter) -kill all: - key(ctrl-c) - insert("y") - key(enter) - diff --git a/talon/community/community-cursorless-0.4.0/apps/win/wsl/ubuntu.talon b/talon/community/community-cursorless-0.4.0/apps/win/wsl/ubuntu.talon deleted file mode 100644 index 2405d6d..0000000 --- a/talon/community/community-cursorless-0.4.0/apps/win/wsl/ubuntu.talon +++ /dev/null @@ -1,16 +0,0 @@ -app: ubuntu -app: windows_terminal -and win.title: /Ubuntu/ -- -tag(): user.file_manager -tag(): user.generic_terminal -tag(): user.git -tag(): user.kubectl -tag(): terminal - -action(user.file_manager_refresh_title): skip() -action(user.file_manager_open_parent): - insert("cd ..") - key(enter) - -^go $: user.file_manager_open_volume("/mnt/{letter}") diff --git a/talon/community/community-cursorless-0.4.0/apps/win/wsl/wsl.py b/talon/community/community-cursorless-0.4.0/apps/win/wsl/wsl.py deleted file mode 100644 index fc83011..0000000 --- a/talon/community/community-cursorless-0.4.0/apps/win/wsl/wsl.py +++ /dev/null @@ -1,205 +0,0 @@ -from talon import Context, Module, actions, imgui, settings, ui, app -import os -import subprocess - -mod = Module() -mod.apps.ubuntu = """ -os: windows -and app.name: ubuntu.exe -""" - -ctx = Context() -ctx.matches = r""" -app: ubuntu -app: windows_terminal -and win.title: /Ubuntu/ -""" -directories_to_remap = {} -directories_to_exclude = {} - -user_path = os.path.expanduser("~") -if app.platform == "windows": - is_windows = True - import ctypes - - GetUserNameEx = ctypes.windll.secur32.GetUserNameExW - NameDisplay = 3 - - size = ctypes.pointer(ctypes.c_ulong(0)) - GetUserNameEx(NameDisplay, None, size) - - nameBuffer = ctypes.create_unicode_buffer(size.contents.value) - GetUserNameEx(NameDisplay, nameBuffer, size) - one_drive_path = os.path.expanduser(os.path.join("~", "OneDrive")) - - # this is probably not the correct way to check for onedrive, quick and dirty - if os.path.isdir(os.path.expanduser(os.path.join("~", r"OneDrive\Desktop"))): - default_folder = os.path.join("~", "Desktop") - - directories_to_remap = { - "Desktop": os.path.join(one_drive_path, "Desktop"), - "Documents": os.path.join(one_drive_path, "Documents"), - "Downloads": os.path.join(user_path, "Downloads"), - "Music": os.path.join(user_path, "Music"), - "OneDrive": one_drive_path, - "Pictures": os.path.join(one_drive_path, "Pictures"), - "Videos": os.path.join(user_path, "Videos"), - } - else: - # todo use expanduser for cross platform support - directories_to_remap = { - "Desktop": os.path.join(user_path, "Desktop"), - "Documents": os.path.join(user_path, "Documents"), - "Downloads": os.path.join(user_path, "Downloads"), - "Music": os.path.join(user_path, "Music"), - "OneDrive": one_drive_path, - "Pictures": os.path.join(user_path, "Pictures"), - "Videos": os.path.join(user_path, "Videos"), - } - - -def get_win_path(wsl_path): - path = "" - try: - path = ( - subprocess.check_output(["wsl", "wslpath", "-w", wsl_path]) - .strip(b"\n") - .decode() - ) - except: - path = "" - - return path - - -def get_usr_path(): - path = "" - try: - path = ( - subprocess.check_output(["wsl", "wslpath", "-a", "~"]).strip(b"\n").decode() - ) - except: - path = "" - - return path - - -def get_wsl_path(win_path): - path = "" - try: - path = ( - subprocess.check_output(["wsl", "wslpath", "-u", "'{}'".format(win_path)]) - .strip(b"\n") - .decode() - ) - except: - path = "" - - return path - - -@ctx.action_class("user") -class user_actions: - def file_manager_refresh_title(): - actions.skip() - - def file_manager_current_path(): - path = ui.active_window().title - try: - path = path.split(":")[1].lstrip() - except: - path = "" - - # print("current: " + path) - if "~" in path: - # the only way I could find to correctly support the user folder: - # get absolute path of ~, and strip /mnt/x from the string - abs_usr_path = get_usr_path() - abs_usr_path = abs_usr_path[abs_usr_path.find("/home") : len(abs_usr_path)] - path = path.replace("~", abs_usr_path) - - path = get_win_path(path) - - if path in directories_to_remap: - path = directories_to_remap[path] - - if path in directories_to_exclude: - path = "" - - return path - - # def file_manager_terminal_here(): - # actions.key("ctrl-l") - # actions.insert("cmd.exe") - # actions.key("enter") - - # def file_manager_show_properties(): - # """Shows the properties for the file""" - # actions.key("alt-enter") - def file_manager_open_user_directory(path: str): - """expands and opens the user directory""" - if path in directories_to_remap: - path = directories_to_remap[path] - - path = os.path.expanduser(os.path.join("~", path)) - if ":" in path: - path = get_wsl_path(path) - - actions.user.file_manager_open_directory(path) - - def file_manager_open_directory(path: str): - """opens the directory that's already visible in the view""" - if ":" in str(path): - path = get_wsl_path(path) - - actions.insert('cd "{}"'.format(path)) - actions.key("enter") - actions.user.file_manager_refresh_title() - - def file_manager_select_directory(path: str): - """selects the directory""" - actions.insert('"{}"'.format(path)) - - def file_manager_new_folder(name: str): - """Creates a new folder in a gui filemanager or inserts the command to do so for terminals""" - actions.insert('mkdir "{}"'.format(name)) - - def file_manager_open_file(path: str): - actions.insert(path) - # actions.key("enter") - - def file_manager_select_file(path: str): - actions.insert(path) - - def file_manager_open_volume(volume: str): - actions.user.file_manager_open_directory(volume) - - def terminal_list_directories(): - actions.insert("ls") - actions.key("enter") - - def terminal_list_all_directories(): - actions.insert("ls -a") - actions.key("enter") - - def terminal_change_directory(path: str): - actions.insert("cd {}".format(path)) - if path: - actions.key("enter") - - def terminal_change_directory_root(): - """Root of current drive""" - actions.insert("cd /") - actions.key("enter") - - def terminal_clear_screen(): - """Clear screen""" - actions.key("ctrl-l") - - def terminal_run_last(): - actions.key("up enter") - - def terminal_kill_all(): - actions.key("ctrl-c") - actions.insert("y") - actions.key("enter") diff --git a/talon/community/community-cursorless-0.4.0/apps/windbg/windbg.py b/talon/community/community-cursorless-0.4.0/apps/windbg/windbg.py deleted file mode 100644 index 9ac44ed..0000000 --- a/talon/community/community-cursorless-0.4.0/apps/windbg/windbg.py +++ /dev/null @@ -1,32 +0,0 @@ -from talon import Context, Module, actions, ui - -mod = Module() -ctx = Context() - -ctx.matches = r""" -mode: user.windbg -""" - -ctx.lists["self.windows_dlls"] = { - "core": "ntdll", - "en tea": "ntdll", - "user": "user32", -} - - -@mod.capture(rule="{self.windows_dlls}") -def windows_dlls(m) -> str: - "Return an register" - return m.windows_dlls - - -@ctx.action_class("user") -class user_actions: - def debugger_clear_breakpoint_id(number_small: int): - actions.insert(f"bc {number_small}\n") - - def debugger_disable_breakpoint_id(number_small: int): - actions.insert(f"bd {number_small}\n") - - def debugger_enable_breakpoint_id(number_small: int): - actions.insert(f"be {number_small}\n") diff --git a/talon/community/community-cursorless-0.4.0/apps/windbg/windbg.talon b/talon/community/community-cursorless-0.4.0/apps/windbg/windbg.talon deleted file mode 100644 index 2c1eaec..0000000 --- a/talon/community/community-cursorless-0.4.0/apps/windbg/windbg.talon +++ /dev/null @@ -1,157 +0,0 @@ -# XXX - trigger alt-1 to hit command window for necessary commands? -# ex: user.windbg_insert_in_cmd() -# edit.left() - -mode: user.windbg -- -tag(): user.debugger -tag(): user.windbg - -## -# Generic debugger actions -## - -# Code execution -action(user.debugger_step_into): - key(f8) -action(user.debugger_step_over): - key(f10) -# XXX - -action(user.debugger_step_line): "" -action(user.debugger_step_over_line): "" - -action(user.debugger_step_out): - key(shift-f11) -action(user.debugger_continue): - key(f5) -action(user.debugger_stop): - key(shift-f5) -action(user.debugger_restart): - key(ctrl-shift-f5) -action(user.debugger_detach): - insert(".detach") - -# Registers -action(user.debugger_show_registers): - key(r enter) -action(user.debugger_get_register): - insert("r @") -action(user.debugger_set_register): - insert("set $@=") - edit.left() - -# Breakpoints -action(user.debugger_show_breakpoints): - insert("bl\n") -action(user.debugger_add_sw_breakpoint): - insert("bp ") -action(user.debugger_add_hw_breakpoint): - insert("ba e 1 ") -action(user.debugger_break_now): - key(ctrl-break) -action(user.debugger_clear_all_breakpoints): - insert("bc *\n") -action(user.debugger_clear_breakpoint): - insert("bc ") -action(user.debugger_enable_all_breakpoints): - insert("be *\n") -action(user.debugger_enable_breakpoint): - insert("be ") -action(user.debugger_disable_all_breakpoints): - insert("bd *\n") -action(user.debugger_disable_breakpoint): - insert("bd ") - -# Navigation -action(user.debugger_goto_address): - insert("ctrl-g") -action(user.debugger_goto_clipboard): - insert("ctrl-g") - edit.paste() - key(enter) -action(user.debugger_goto_highlighted): - insert("ctrl-g") - edit.copy() - edit.paste() - key(enter) - - -# Memory inspection -action(user.debugger_backtrace): - key(k enter) -action(user.debugger_disassemble): - key(u space) -action(user.debugger_disassemble_here): - key(u enter) -action(user.debugger_disassemble_clipboard): - key(u space) - edit.paste() - key(enter) -action(user.debugger_dump_ascii_string): - insert("da ") -action(user.debugger_dump_unicode_string): - insert("du ") -action(user.debugger_dump_pointers): - insert("dps ") - -action(user.debugger_list_modules): - insert("lm\n") - - -# Registers XXX -register : - key(@) - insert("{registers}") - -# Type inspection -action(user.debugger_inspect_type): - insert("dt ") - -# Convenience -action(user.debugger_clear_line): - key("ctrl-a backspace") -## -# Windbg specific functionality -## - -open help: insert(".hh\n") - -# xxx - add window switching - -add microsoft symbols: - insert("srv*C:\\symbols*http://msdl.microsoft.com/download/symbols;\n") -force reload symbols: - insert(".reload /f\n") -reload symbols: - insert(".reload\n") -loaded modules: - insert("lm l\n") - -display pointers: - insert("dps ") - -# XXX - should be generic -dereference pointer: - insert("poi()") - edit.left() - -show version: key(ctrl-alt-w) - -## -# Windows -## - -view command: key(alt-1) -view watch: key(alt-2) -view locals: key(alt-3) -view registers: key(alt-4) -view memory: key(alt-5) -view call stack: key(alt-6) -view disassembly: key(alt-7) -view scratch pad: key(alt-8) -view (processes|threads): key(alt-9) - -# XXX - temp -dump function params: "r @rcx,@rdx,@r8,@r9\n" - -(lib|library) : "{windows_dlls}" diff --git a/talon/community/community-cursorless-0.4.0/code/Resources/HiddenCursor.cur b/talon/community/community-cursorless-0.4.0/code/Resources/HiddenCursor.cur deleted file mode 100644 index 048f06b..0000000 Binary files a/talon/community/community-cursorless-0.4.0/code/Resources/HiddenCursor.cur and /dev/null differ diff --git a/talon/community/community-cursorless-0.4.0/code/abbreviate.py b/talon/community/community-cursorless-0.4.0/code/abbreviate.py deleted file mode 100644 index 844251d..0000000 --- a/talon/community/community-cursorless-0.4.0/code/abbreviate.py +++ /dev/null @@ -1,218 +0,0 @@ -# XXX - would be nice to be able pipe these through formatters - -from talon import Context, Module - -mod = Module() -mod.list("abbreviation", desc="Common abbreviation") - -abbreviations = { - "address": "addr", - "administrator": "admin", - "administrators": "admins", - "advance": "adv", - "advanced": "adv", - "alberta": "ab", - "alternative": "alt", - "application": "app", - "applications": "apps", - "argument": "arg", - "arguments": "args", - "as far as i can tell": "afaict", - "as far as i know": "afaik", - "assembly": "asm", - "at the moment": "atm", - "attribute": "attr", - "attributes": "attrs", - "authenticate": "auth", - "authentication": "auth", - "away from keyboard": "afk", - "binary": "bin", - "boolean": "bool", - "british columbia": "bc", - "button": "btn", - "canada": "ca", - "centimeter": "cm", - "char": "chr", - "character": "char", - "class": "cls", - "client": "cli", - "command": "cmd", - "comment": "cmt", - "compare": "cmp", - "conference": "conf", - "config": "cfg", - "configuration": "cfg", - "context": "ctx", - "control": "ctrl", - "constant": "const", - "coordinate": "coord", - "coordinates": "coords", - "copy": "cpy", - "count": "cnt", - "counter": "ctr", - "database": "db", - "declare": "decl", - "declaration": "decl", - "decode": "dec", - "decrement": "dec", - "debug": "dbg", - "define": "def", - "definition": "def", - "description": "desc", - "develop": "dev", - "development": "dev", - "device": "dev", - "dictation": "dict", - "dictionary": "dict", - "direction": "dir", - "directory": "dir", - "distribution": "dist", - "document": "doc", - "documents": "docs", - "double": "dbl", - "dupe": "dup", - "duplicate": "dup", - "dynamic": "dyn", - "encode": "enc", - "entry": "ent", - "enumerate": "enum", - "environment": "env", - "escape": "esc", - "etcetera": "etc", - "example": "ex", - "exception": "exc", - "execute": "exec", - "expression": "exp", - "extend": "ext", - "extension": "ext", - "file system": "fs", - "framework": "fw", - "function": "func", - "funny": "lol", - "generic": "gen", - "generate": "gen", - "hypertext": "http", - "history": "hist", - "image": "img", - "import table": "iat", - "import address table": "iat", - "increment": "inc", - "information": "info", - "initialize": "init", - "initializer": "init", - "in real life": "irl", - "instance": "inst", - "integer": "int", - "interrupt": "int", - "iterate": "iter", - "java archive": "jar", - "javascript": "js", - "jason": "json", - "jump": "jmp", - "keyboard": "kbd", - "keyword arguments": "kwargs", - "keyword": "kw", - "kilogram": "kg", - "kilometer": "km", - "language": "lng", - "length": "len", - "library": "lib", - "manitoba": "mb", - "markdown": "md", - "message": "msg", - "meta sploit": "msf", - "meta sploit framework": "msf", - "microphone": "mic", - "milligram": "mg", - "millisecond": "ms", - "miscellaneous": "misc", - "module": "mod", - "mount": "mnt", - "nano second": "ns", - "neo vim": "nvim", - "new brunswick": "nb", - "nova scotia": "ns", - "number": "num", - "object": "obj", - "okay": "ok", - "ontario": "on", - "option": "opt", - "operating system": "os", - "original": "orig", - "package": "pkg", - "parameter": "param", - "parameters": "params", - "pico second": "ps", - "pixel": "px", - "point": "pt", - "pointer": "ptr", - "position": "pos", - "position independent code": "pic", - "position independent executable": "pie", - "previous": "prev", - "property": "prop", - "public": "pub", - "python": "py", - "quebec": "qc", - "query string": "qs", - "random": "rnd", - "receipt": "rcpt", - "reference": "ref", - "references": "refs", - "register": "reg", - "registery": "reg", - "regular expression": "regex", - "regular expressions": "regex", - "repel": "repl", - "represent": "repr", - "representation": "repr", - "request": "req", - "return": "ret", - "revision": "rev", - "ruby": "rb", - "saskatchewan": "sk", - "service pack": "sp", - "session id": "sid", - "shell": "sh", - "shellcode": "sc", - "source": "src", - "special": "spec", - "specific": "spec", - "specification": "spec", - "specify": "spec", - "standard in": "stdin", - "standard out": "stdout", - "standard": "std", - "string": "str", - "structure": "struct", - "synchronize": "sync", - "synchronous": "sync", - "system": "sys", - "table of contents": "toc", - "table": "tbl", - "taiwan": "tw", - "technology": "tech", - "temperature": "temp", - "temporary": "tmp", - "temp": "tmp", - "text": "txt", - "time of check time of use": "toctou", - "token": "tok", - "ultimate": "ulti", - "unique id": "uuid", - "user": "usr", - "utilities": "utils", - "utility": "util", - "value": "val", - "variable": "var", - "verify": "vrfy", - "versus": "vs", - "visual": "vis", - "visual studio": "msvc", - "web": "www", - "what the fuck": "wtf", - "window": "win", -} - -ctx = Context() -ctx.lists["user.abbreviation"] = abbreviations diff --git a/talon/community/community-cursorless-0.4.0/code/app_names/app_name_overrides.linux.csv b/talon/community/community-cursorless-0.4.0/code/app_names/app_name_overrides.linux.csv deleted file mode 100644 index 2f58165..0000000 --- a/talon/community/community-cursorless-0.4.0/code/app_names/app_name_overrides.linux.csv +++ /dev/null @@ -1,2 +0,0 @@ -grip, DataGrip -py, jetbrains-pycharm-ce \ No newline at end of file diff --git a/talon/community/community-cursorless-0.4.0/code/app_names/app_name_overrides.mac.csv b/talon/community/community-cursorless-0.4.0/code/app_names/app_name_overrides.mac.csv deleted file mode 100644 index e0125a9..0000000 --- a/talon/community/community-cursorless-0.4.0/code/app_names/app_name_overrides.mac.csv +++ /dev/null @@ -1,3 +0,0 @@ -grip, DataGrip -term, iTerm2 -one note, ONENOTE \ No newline at end of file diff --git a/talon/community/community-cursorless-0.4.0/code/app_names/app_name_overrides.windows.csv b/talon/community/community-cursorless-0.4.0/code/app_names/app_name_overrides.windows.csv deleted file mode 100644 index 72b45b3..0000000 --- a/talon/community/community-cursorless-0.4.0/code/app_names/app_name_overrides.windows.csv +++ /dev/null @@ -1,8 +0,0 @@ -grip, DataGrip -term, iTerm2 -one note, ONENOTE -lock, slack.exe -app, slack.exe -lockapp, slack.exe -pycharm, pycharm64.exe -webstorm, webstorm64.exe \ No newline at end of file diff --git a/talon/community/community-cursorless-0.4.0/code/app_running.py b/talon/community/community-cursorless-0.4.0/code/app_running.py deleted file mode 100644 index de2b4e7..0000000 --- a/talon/community/community-cursorless-0.4.0/code/app_running.py +++ /dev/null @@ -1,12 +0,0 @@ -from talon import Module, ui - -mod = Module() - - -@mod.scope -def scope(): - return {"running": {app.name.lower() for app in ui.apps()}} - - -ui.register("app_launch", scope.update) -ui.register("app_close", scope.update) diff --git a/talon/community/community-cursorless-0.4.0/code/application_matches.py b/talon/community/community-cursorless-0.4.0/code/application_matches.py deleted file mode 100644 index e207ad0..0000000 --- a/talon/community/community-cursorless-0.4.0/code/application_matches.py +++ /dev/null @@ -1,78 +0,0 @@ -from talon import Context, Module - -mod = Module() - - -apps = mod.apps - -# apple specific apps -apps.datagrip = """ -os: mac -and app.name: DataGrip -""" - -apps.finder = """ -os: mac -and app.bundle: com.apple.finder -""" - -apps.rstudio = """ -os: mac -and app.name: RStudio -""" - -apps.apple_terminal = """ -os: mac -and app.bundle: com.apple.Terminal -""" - -apps.iterm2 = """ -os: mac -and app.bundle: com.googlecode.iterm2 -""" - -# linux specific apps -apps.keepass = """ -os: linux -and app.name: KeePassX2 -os: linux -and app.name: KeePassXC -os: linux -and app.name: KeepassX2 -os: linux -and app.name: keepassx2 -os: linux -and app.name: keepassxc -os: linux -and app.name: Keepassxc""" - -apps.signal = """ -os: linux -and app.name: Signal - -os: linux -and app.name: signal -""" - -apps.termite = """ -os: linux -and app.name: /termite/ -""" - -apps.windows_command_processor = """ -os: windows -and app.name: Windows Command Processor -os: windows -and app.exe: cmd.exe -""" - -apps.windows_terminal = """ -os: windows -and app.exe: WindowsTerminal.exe -""" - -mod.apps.windows_power_shell = """ -os: windows -and app.exe: powershell.exe -""" - diff --git a/talon/community/community-cursorless-0.4.0/code/code.py b/talon/community/community-cursorless-0.4.0/code/code.py deleted file mode 100644 index f4cca36..0000000 --- a/talon/community/community-cursorless-0.4.0/code/code.py +++ /dev/null @@ -1,511 +0,0 @@ -from talon import Context, Module, actions, app, imgui, registry, settings - -ctx = Context() -mod = Module() -mod.list("code_functions", desc="List of functions for active language") -mod.list("code_types", desc="List of types for active language") -mod.list("code_libraries", desc="List of libraries for active language") - -setting_private_function_formatter = mod.setting("code_private_function_formatter", str) -setting_protected_function_formatter = mod.setting( - "code_protected_function_formatter", str -) -setting_public_function_formatter = mod.setting("code_public_function_formatter", str) -setting_private_variable_formatter = mod.setting("code_private_variable_formatter", str) -setting_protected_variable_formatter = mod.setting( - "code_protected_variable_formatter", str -) -setting_public_variable_formatter = mod.setting("code_public_variable_formatter", str) - -mod.tag("code_comment", desc="Tag for enabling generic comment commands") -mod.tag("code_block_comment", desc="Tag for enabling generic block comment commands") -mod.tag("code_operators", desc="Tag for enabling generic operator commands") -mod.tag( - "code_generic", - desc="Tag for enabling other basic programming commands (loops, functions, etc)", -) - -key = actions.key -function_list = [] -library_list = [] -extension_lang_map = { - ".elm": "elm", - ".asm": "assembly", - ".bat": "batch", - ".c": "c", - ".cmake": "cmake", - ".cpp": "cplusplus", - ".cs": "csharp", - ".gdb": "gdb", - ".go": "go", - ".h": "c", - ".hpp": "cplusplus", - ".java": "java", - ".js": "javascript", - ".jsx": "javascript", - ".json": "json", - ".lua": "lua", - ".md": "markdown", - ".pl": "perl", - ".ps1": "powershell", - ".py": "python", - ".r": "r", - ".rb": "ruby", - ".s": "assembly", - ".sh": "bash", - ".snippets": "snippets", - ".talon": "talon", - ".ts": "typescript", - ".tsx": "typescript", - ".vba": "vba", - ".vim": "vimscript", - ".vimrc": "vimscript", -} - -# flag indicates whether or not the title tracking is enabled -forced_language = False - - -@mod.capture(rule="{user.code_functions}") -def code_functions(m) -> str: - """Returns a function name""" - return m.code_functions - - -@mod.capture(rule="{user.code_types}") -def code_types(m) -> str: - """Returns a type""" - return m.code_types - - -@mod.capture(rule="{user.code_libraries}") -def code_libraries(m) -> str: - """Returns a type""" - return m.code_libraries - - -@ctx.action_class("code") -class code_actions: - def language(): - result = "" - if not forced_language: - file_extension = actions.win.file_ext() - - if file_extension and file_extension in extension_lang_map: - result = extension_lang_map[file_extension] - - # print("code.language: " + result) - return result - - -# create a mode for each defined language -for __, lang in extension_lang_map.items(): - mod.mode(lang) - - -@mod.action_class -class Actions: - def code_set_language_mode(language: str): - """Sets the active language mode, and disables extension matching""" - global forced_language - actions.user.code_clear_language_mode() - actions.mode.enable("user.{}".format(language)) - # app.notify("Enabled {} mode".format(language)) - forced_language = True - - def code_clear_language_mode(): - """Clears the active language mode, and re-enables code.language: extension matching""" - global forced_language - forced_language = False - - for __, lang in extension_lang_map.items(): - actions.mode.disable("user.{}".format(lang)) - # app.notify("Cleared language modes") - - def code_operator_indirection(): - """code_operator_indirection""" - - def code_operator_address_of(): - """code_operator_address_of (e.g., C++ & op)""" - - def code_operator_structure_dereference(): - """code_operator_structure_dereference (e.g., C++ -> op)""" - - def code_operator_lambda(): - """code_operator_lambda""" - - def code_operator_subscript(): - """code_operator_subscript (e.g., C++ [])""" - - def code_operator_assignment(): - """code_operator_assignment""" - - def code_operator_subtraction(): - """code_operator_subtraction""" - - def code_operator_subtraction_assignment(): - """code_operator_subtraction_equals""" - - def code_operator_addition(): - """code_operator_addition""" - - def code_operator_addition_assignment(): - """code_operator_addition_assignment""" - - def code_operator_multiplication(): - """code_operator_multiplication""" - - def code_operator_multiplication_assignment(): - """code_operator_multiplication_assignment""" - - def code_operator_exponent(): - """code_operator_exponent""" - - def code_operator_division(): - """code_operator_division""" - - def code_operator_division_assignment(): - """code_operator_division_assignment""" - - def code_operator_modulo(): - """code_operator_modulo""" - - def code_operator_modulo_assignment(): - """code_operator_modulo_assignment""" - - def code_operator_equal(): - """code_operator_equal""" - - def code_operator_not_equal(): - """code_operator_not_equal""" - - def code_operator_greater_than(): - """code_operator_greater_than""" - - def code_operator_greater_than_or_equal_to(): - """code_operator_greater_than_or_equal_to""" - - def code_operator_less_than(): - """code_operator_less_than""" - - def code_operator_less_than_or_equal_to(): - """code_operator_less_than_or_equal_to""" - - def code_operator_in(): - """code_operator_less_than_or_equal_to""" - - def code_operator_and(): - """codee_operator_and""" - - def code_operator_or(): - """code_operator_or""" - - def code_operator_bitwise_and(): - """code_operator_bitwise_and""" - - def code_operator_bitwise_and_assignment(): - """code_operator_and""" - - def code_operator_bitwise_or(): - """code_operator_bitwise_or""" - - def code_operator_bitwise_or_assignment(): - """code_operator_or_assignment""" - - def code_operator_bitwise_exclusive_or(): - """code_operator_bitwise_exclusive_or""" - - def code_operator_bitwise_exclusive_or_assignment(): - """code_operator_bitwise_exclusive_or_assignment""" - - def code_operator_bitwise_left_shift(): - """code_operator_bitwise_left_shift""" - - def code_operator_bitwise_left_shift_assignment(): - """code_operator_bitwise_left_shift_assigment""" - - def code_operator_bitwise_right_shift(): - """code_operator_bitwise_right_shift""" - - def code_operator_bitwise_right_shift_assignment(): - """code_operator_bitwise_right_shift_assignment""" - - def code_block(): - """Inserts equivalent of {\n} for the active language, and places the cursor appropriately""" - - def code_self(): - """Inserts the equivalent of "this" in C++ or self in python""" - - def code_null(): - """inserts null equivalent""" - - def code_is_null(): - """inserts check for == null""" - - def code_is_not_null(): - """inserts check for == null""" - - def code_state_in(): - """Inserts python "in" equivalent""" - - def code_state_if(): - """Inserts if statement""" - - def code_state_else_if(): - """Inserts else if statement""" - - def code_state_else(): - """Inserts else statement""" - - def code_state_do(): - """Inserts do statement""" - - def code_state_switch(): - """Inserts switch statement""" - - def code_state_case(): - """Inserts case statement""" - - def code_state_for(): - """Inserts for statement""" - - def code_state_for_each(): - """Inserts for each equivalent statement""" - - def code_state_go_to(): - """inserts go-to statement""" - - def code_state_while(): - """Inserts while statement""" - - def code_state_return(): - """Inserts return statement""" - - def code_break(): - """Inserts break statement""" - - def code_next(): - """Inserts next statement""" - - def code_true(): - """Insert True value""" - - def code_false(): - """Insert False value""" - - def code_try_catch(): - """Inserts try/catch. If selection is true, does so around the selecion""" - - def code_default_function(text: str): - """Inserts function declaration""" - actions.user.code_private_function(text) - - def code_private_function(text: str): - """Inserts private function declaration""" - - def code_private_static_function(text: str): - """Inserts private static function""" - - def code_protected_function(text: str): - """Inserts protected function declaration""" - - def code_protected_static_function(text: str): - """Inserts public function""" - - def code_public_function(text: str): - """Inserts public function""" - - def code_public_static_function(text: str): - """Inserts public function""" - - def code_private_function_formatter(name: str): - """Inserts private function name with formatter""" - actions.insert( - actions.user.formatted_text( - name, settings.get("user.code_private_function_formatter") - ) - ) - - def code_protected_function_formatter(name: str): - """inserts properly formatted private function name""" - actions.insert( - actions.user.formatted_text( - name, settings.get("user.code_protected_function_formatter") - ) - ) - - def code_public_function_formatter(name: str): - """inserts properly formatted private function name""" - actions.insert( - actions.user.formatted_text( - name, settings.get("user.code_public_function_formatter") - ) - ) - - def code_private_variable_formatter(name: str): - """inserts properly formatted private function name""" - actions.insert( - actions.user.formatted_text( - name, settings.get("user.code_private_variable_formatter") - ) - ) - - def code_protected_variable_formatter(name: str): - """inserts properly formatted private function name""" - actions.insert( - actions.user.formatted_text( - name, settings.get("user.code_protected_variable_formatter") - ) - ) - - def code_public_variable_formatter(name: str): - """inserts properly formatted private function name""" - actions.insert( - actions.user.formatted_text( - name, settings.get("user.code_public_variable_formatter") - ) - ) - - def code_comment(): - """Inserts comment at current cursor location""" - - def code_block_comment(): - """Block comment""" - - def code_block_comment_prefix(): - """Block comment start syntax""" - - def code_block_comment_suffix(): - """Block comment end syntax""" - - def code_type_definition(): - """code_type_definition (typedef)""" - - def code_typedef_struct(): - """code_typedef_struct (typedef)""" - - def code_type_class(): - """code_type_class""" - - def code_type_struct(): - """code_type_struct""" - - def code_include(): - """code_include""" - - def code_include_system(): - """code_include_system""" - - def code_include_local(): - """code_include_local""" - - def code_import(): - """import/using equivalent""" - - def code_from_import(): - """from import python equivalent""" - - def code_toggle_functions(): - """GUI: List functions for active language""" - global function_list - if gui_libraries.showing: - gui_libraries.hide() - if gui_functions.showing: - function_list = [] - gui_functions.hide() - else: - update_function_list_and_freeze() - - def code_select_function(number: int, selection: str): - """Inserts the selected function when the imgui is open""" - if gui_functions.showing and number < len(function_list): - actions.user.code_insert_function( - registry.lists["user.code_functions"][0][function_list[number]], - selection, - ) - - def code_insert_function(text: str, selection: str): - """Inserts a function and positions the cursor appropriately""" - - def code_toggle_libraries(): - """GUI: List libraries for active language""" - global library_list - if gui_functions.showing: - gui_functions.hide() - if gui_libraries.showing: - library_list = [] - gui_libraries.hide() - else: - update_library_list_and_freeze() - - def code_select_library(number: int, selection: str): - """Inserts the selected library when the imgui is open""" - if gui_libraries.showing and number < len(library_list): - actions.user.code_insert_library( - registry.lists["user.code_libraries"][0][library_list[number]], - selection, - ) - - def code_insert_library(text: str, selection: str): - """Inserts a library and positions the cursor appropriately""" - - def code_document_string(): - """Inserts a document string and positions the cursor appropriately""" - - -def update_library_list_and_freeze(): - global library_list - if "user.code_libraries" in registry.lists: - library_list = sorted(registry.lists["user.code_libraries"][0].keys()) - else: - library_list = [] - - gui_libraries.show() - - -def update_function_list_and_freeze(): - global function_list - if "user.code_functions" in registry.lists: - function_list = sorted(registry.lists["user.code_functions"][0].keys()) - else: - function_list = [] - - gui_functions.show() - - -@imgui.open() -def gui_functions(gui: imgui.GUI): - gui.text("Functions") - gui.line() - - # print(str(registry.lists["user.code_functions"])) - for i, entry in enumerate(function_list, 1): - if entry in registry.lists["user.code_functions"][0]: - gui.text( - "{}. {}: {}".format( - i, entry, registry.lists["user.code_functions"][0][entry] - ) - ) - - -@imgui.open() -def gui_libraries(gui: imgui.GUI): - gui.text("Libraries") - gui.line() - - for i, entry in enumerate(library_list, 1): - gui.text( - "{}. {}: {}".format( - i, entry, registry.lists["user.code_libraries"][0][entry] - ) - ) - - -def commands_updated(_): - if gui_functions.showing: - update_function_list_and_freeze() - if gui_libraries.showing: - update_library_list_and_freeze() - - -registry.register("update_commands", commands_updated) diff --git a/talon/community/community-cursorless-0.4.0/code/create_spoken_forms.py b/talon/community/community-cursorless-0.4.0/code/create_spoken_forms.py deleted file mode 100644 index fdeba88..0000000 --- a/talon/community/community-cursorless-0.4.0/code/create_spoken_forms.py +++ /dev/null @@ -1,86 +0,0 @@ -from typing import List, Optional -import itertools -from talon import registry -import re - -from .extensions import file_extensions -from .numbers import digits_map -from .abbreviate import abbreviations - -# TODO: 'Whats application': 'WhatsApp' (Should keep "whats app" as well?) -# TODO: 'V O X': 'VOX' (should keep "VOX" as well?) -# Could handle by handling all alternatives for these, or by having hardcoded list of things that we want to handle specially - -DEFAULT_MINIMUM_TERM_LENGTH = 3 - -SMALL_WORD = r"[A-Z]?[a-z]+" -# TODO: We want "AXEvery" to be ["AX", "Every"] -UPPERCASE_WORD = r"[A-Z]+" -FILE_EXTENSIONS_REGEX = "|".join( - re.escape(file_extension) for file_extension in file_extensions.values() -) -DIGITS_REGEX = r"\d" -FULL_REGEX = re.compile( - "|".join( - [ - DIGITS_REGEX, - FILE_EXTENSIONS_REGEX, - SMALL_WORD, - UPPERCASE_WORD, - ] - ) -) - -REVERSE_PRONUNCIATION_MAP = { - **{value: key for key, value in abbreviations.items()}, - **{value: key for key, value in file_extensions.items()}, - **{str(value): key for key, value in digits_map.items()}, -} - - -def create_single_spoken_form(source: str): - normalized_source = source.lower() - try: - mapped_source = REVERSE_PRONUNCIATION_MAP[normalized_source] - except KeyError: - mapped_source = source - if mapped_source.isupper(): - mapped_source = " ".join(mapped_source) - return mapped_source - - -def create_spoken_forms( - source: str, - words_to_exclude: Optional[List[str]] = None, - minimum_term_length=DEFAULT_MINIMUM_TERM_LENGTH, -) -> List[str]: - if words_to_exclude is None: - words_to_exclude = [] - - pieces = list(FULL_REGEX.finditer(source)) - # print([piece.group(0) for piece in pieces]) - - term_sequence = " ".join( - [create_single_spoken_form(piece.group(0)) for piece in pieces] - ).split(" ") - # print(term_sequence) - - terms = list( - { - term.strip() - for term in ( - term_sequence - + list(itertools.accumulate([f"{term} " for term in term_sequence])) - + [source] - ) - } - ) - - terms = [ - term - for term in terms - if term not in words_to_exclude and len(term) >= minimum_term_length - ] - # print(terms) - - return terms \ No newline at end of file diff --git a/talon/community/community-cursorless-0.4.0/code/debugger.py b/talon/community/community-cursorless-0.4.0/code/debugger.py deleted file mode 100644 index ea53c7e..0000000 --- a/talon/community/community-cursorless-0.4.0/code/debugger.py +++ /dev/null @@ -1,198 +0,0 @@ -# XXX - execute until line number/cursor -# XXX - more memory printing he thumping - -from talon import Context, Module - -mod = Module() -mod.tag("debugger", desc="Tag for enabling generic debugger commands") - -ctx = Context() -ctx.matches = r""" -tag: debugger -""" - -x86_registers = { - "air": "eax", - "bat": "ebx", - "cap": "ecx", - "drum": "edx", - "source": "esi", - "dest": "edi", - "stack": "esp", - "frame": "ebp", - "instruction": "eip", -} - -x64_registers = { - # general purpose - "air": "rax", - "racks": "rax", - "bat": "rbx", - "cap": "rcx", - "drum": "rdx", - "source": "rsi", - "dest": "rdi", - "stack": "rsp", - "stack pointer": "rsp", - "frame": "rbp", - "frame pointer": "rbp", - "base": "rbp", - "base pointer": "rbp", - "eight": "r8", - "nine": "r9", - "ten": "r10", - "eleven": "r11", - "twelve": "r12", - "thirteen": "r13", - "fourteen": "r14", - "fifteen": "r15", - # pointers - "instruction": "rip", - "rip": "rip", - # segment -} - -# XXX - pass by windbg to dump -windows_x64_register_parameters = ["rcx", "rdx", "r8", "r9"] - -# XXX - make this dynamic -ctx.lists["self.registers"] = x64_registers - -# assembly_languages = { -# "x86": x86_registers, -# "x64": x64_registers, -# } - -mod.list("registers", desc="Main architecture register set") - - -@mod.capture(rule="{self.registers}") -def registers(m) -> str: - "Returns a register" - return m.registers - - -@mod.action_class -class Actions: - def debugger_step_into(): - """Step into an instruction in the debugger""" - - def debugger_step_over(): - """Step over an instruction in the debugger""" - - def debugger_step_line(): - """Step into a source line in the debugger""" - - def debugger_step_over_line(): - """Step over a source line in the debugger""" - - def debugger_step_out(): - """Step until function exit in the debugger""" - - def debugger_continue(): - """Continue execution in the debugger""" - - def debugger_restart(): - """Restart execution in the debugger""" - - def debugger_start(): - """Start debugging""" - - def debugger_stop(): - """Stop the debugger""" - - def debugger_exit(): - """Exit the debugger""" - - def debugger_detach(): - """Detach the debugger""" - - def debugger_backtrace(): - """Print a back trace in the debugger""" - - def debugger_get_register(): - """Print specific register in the debugger""" - - def debugger_set_register(): - """Set specific register in the debugger""" - - def debugger_show_registers(): - """Print the current registers in the debugger""" - - def debugger_break_now(): - """Break into the debugger""" - - def debugger_break_here(): - """Set a break on the current line""" - - def debugger_show_breakpoints(): - """Print the current breakpoints in the debugger""" - - def debugger_add_sw_breakpoint(): - """Add one software breakpoint in the debugger""" - - def debugger_add_hw_breakpoint(): - """Add one hardware breakpoint in the debugger""" - - def debugger_clear_all_breakpoints(): - """Clear all breakpoints in the debugger""" - - def debugger_clear_breakpoint(): - """Clear one breakpoint in the debugger""" - - def debugger_clear_breakpoint_id(number_small: int): - """Clear one breakpoint id in the debugger""" - - def debugger_disable_breakpoint_id(number_small: int): - """Disable one breakpoint id in the debugger""" - - def debugger_disable_breakpoint(): - """Disable one breakpoint in the debugger""" - - def debugger_disable_all_breakpoints(): - """Disable all breakpoints in the debugger""" - - def debugger_enable_breakpoint(): - """Enable one breakpoint in the debugger""" - - def debugger_enable_breakpoint_id(number_small: int): - """Enable one breakpoint id in the debugger""" - - def debugger_enable_all_breakpoints(): - """Enable all breakpoints in the debugger""" - - def debugger_disassemble(): - """Preps the disassemble command in the debugger""" - - def debugger_disassemble_here(): - """Disassembles instructions at the current instruction pointer""" - - def debugger_disassemble_clipboard(): - """Disassemble instructions at an address in the clipboard""" - - def debugger_goto_address(): - """Jump to a specific address in the debugger""" - - def debugger_goto_clipboard(): - """Jump to a specific address stored in the clipboard""" - - def debugger_goto_highlighted(): - """Jump to a specific highlighted address in the debugger""" - - def debugger_dump_ascii_string(): - """Display as specific address as an ascii string in the debugger""" - - def debugger_dump_unicode_string(): - """Display as specific address as an unicode string in the debugger""" - - def debugger_dump_pointers(): - """Display as specific address as a list of pointers in the debugger""" - - def debugger_inspect_type(): - """Inspect a specific data type in the debugger""" - - def debugger_clear_line(): - """Clear unwanted data from the command line""" - - def debugger_list_modules(): - """List the loaded modules in the debuggee memory space""" diff --git a/talon/community/community-cursorless-0.4.0/code/delayed_speech_off.py b/talon/community/community-cursorless-0.4.0/code/delayed_speech_off.py deleted file mode 100644 index 2ea916c..0000000 --- a/talon/community/community-cursorless-0.4.0/code/delayed_speech_off.py +++ /dev/null @@ -1,30 +0,0 @@ -from talon import Context, Module, actions, app, speech_system - -delay_mod = Module() - -delayed_enabled = False - - -def do_disable(e): - speech_system.unregister("post:phrase", do_disable) - actions.speech.disable() - - -@delay_mod.action_class -class DelayedSpeechOffActions: - def delayed_speech_on(): - """Activates a "temporary speech" mode that can be disabled lazily, - so that the actual disable command happens after whatever phrase - finishes next.""" - global delayed_enabled - if not actions.speech.enabled(): - delayed_enabled = True - actions.speech.enable() - - def delayed_speech_off(): - """Disables "temporary speech" mode lazily, meaning that the next - phrase that finishes will turn speech off.""" - global delayed_enabled - if delayed_enabled: - delayed_enabled = False - speech_system.register("post:phrase", do_disable) diff --git a/talon/community/community-cursorless-0.4.0/code/dictation.py b/talon/community/community-cursorless-0.4.0/code/dictation.py deleted file mode 100644 index cffb63f..0000000 --- a/talon/community/community-cursorless-0.4.0/code/dictation.py +++ /dev/null @@ -1,229 +0,0 @@ -# Descended from https://github.com/dwiel/talon_community/blob/master/misc/dictation.py -from talon import Module, Context, ui, actions, clip, app, grammar -from typing import Optional, Tuple, Literal - -mod = Module() - -setting_context_sensitive_dictation = mod.setting( - "context_sensitive_dictation", - type=bool, - default=False, - desc="Look at surrounding text to improve auto-capitalization/spacing in dictation mode. By default, this works by selecting that text & copying it to the clipboard, so it may be slow or fail in some applications.", -) - -@mod.capture(rule="({user.vocabulary} | )") -def word(m) -> str: - """A single word, including user-defined vocabulary.""" - try: - return m.vocabulary - except AttributeError: - return " ".join(actions.dictate.replace_words(actions.dictate.parse_words(m.word))) - -@mod.capture(rule="({user.vocabulary} | )+") -def text(m) -> str: - """A sequence of words, including user-defined vocabulary.""" - return format_phrase(m) - -@mod.capture(rule="({user.vocabulary} | {user.punctuation} | )+") -def prose(m) -> str: - """Mixed words and punctuation, auto-spaced & capitalized.""" - text, _state = auto_capitalize(format_phrase(m)) - return text - - -# ---------- FORMATTING ---------- # -def format_phrase(m): - words = capture_to_words(m) - result = "" - for i, word in enumerate(words): - if i > 0 and needs_space_between(words[i-1], word): - result += " " - result += word - return result - -def capture_to_words(m): - words = [] - for item in m: - words.extend( - actions.dictate.replace_words(actions.dictate.parse_words(item)) - if isinstance(item, grammar.vm.Phrase) else - item.split(" ")) - return words - -no_space_before = set("\n .,!?;:-/%)]}\"") -no_space_after = set("\n -/#@([{$£€¥₩₽₹\"") -def needs_space_between(before: str, after: str) -> bool: - return (before != "" and after != "" - and before[-1] not in no_space_after - and after[0] not in no_space_before) - -def auto_capitalize(text, state = None): - """ - Auto-capitalizes text. `state` argument means: - - - None: Don't capitalize initial word. - - "sentence start": Capitalize initial word. - - "after newline": Don't capitalize initial word, but we're after a newline. - Used for double-newline detection. - - Returns (capitalized text, updated state). - """ - output = "" - # Imagine a metaphorical "capitalization charge" travelling through the - # string left-to-right. - charge = state == "sentence start" - newline = state == "after newline" - for c in text: - # Sentence endings & double newlines create a charge. - if c in ".!?" or (newline and c == "\n"): - charge = True - # Alphanumeric characters and commas/colons absorb charge & try to - # capitalize (for numbers & punctuation this does nothing, which is what - # we want). - elif charge and (c.isalnum() or c in ",:"): - charge = False - c = c.capitalize() - # Otherwise the charge just passes through. - output += c - newline = c == "\n" - return output, ("sentence start" if charge else - "after newline" if newline else None) - - -# ---------- DICTATION AUTO FORMATTING ---------- # -class DictationFormat: - def __init__(self): - self.reset() - - def reset(self): - self.before = "" - self.state = "sentence start" - - def update_context(self, before): - if before is None: return - self.reset() - self.pass_through(before) - - def pass_through(self, text): - _, self.state = auto_capitalize(text, self.state) - self.before = text or self.before - - def format(self, text): - if needs_space_between(self.before, text): - text = " " + text - text, self.state = auto_capitalize(text, self.state) - self.before = text or self.before - return text - -dictation_formatter = DictationFormat() -ui.register("app_deactivate", lambda app: dictation_formatter.reset()) -ui.register("win_focus", lambda win: dictation_formatter.reset()) - -@mod.action_class -class Actions: - def dictation_format_reset(): - """Resets the dictation formatter""" - return dictation_formatter.reset() - - def dictation_insert_raw(text: str): - """Inserts text as-is, without invoking the dictation formatter.""" - dictation_formatter.pass_through(text) - actions.insert(text) - - def dictation_insert(text: str) -> str: - """Inserts dictated text, formatted appropriately.""" - # do_the_dance = whether we should try to be context-sensitive. Since - # whitespace is not affected by formatter state, if text.isspace() is - # True we don't need context-sensitivity. - do_the_dance = (setting_context_sensitive_dictation.get() - and not text.isspace()) - if do_the_dance: - dictation_formatter.update_context( - actions.user.dictation_peek_left(clobber=True)) - text = dictation_formatter.format(text) - actions.user.add_phrase_to_history(text) - actions.insert(text) - # Add a space after cursor if necessary. - if not do_the_dance or not text or text[-1] in no_space_after: - return - char = actions.user.dictation_peek_right() - if char is not None and needs_space_between(text, char): - actions.insert(" ") - actions.edit.left() - - def dictation_peek_left(clobber: bool = False) -> Optional[str]: - """ - Tries to get some text before the cursor, ideally a word or two, for the - purpose of auto-spacing & -capitalization. Results are not guaranteed; - dictation_peek_left() may return None to indicate no information. (Note - that returning the empty string "" indicates there is nothing before - cursor, ie. we are at the beginning of the document.) - - If there is currently a selection, dictation_peek_left() must leave it - unchanged unless `clobber` is true, in which case it may clobber it. - """ - # Get rid of the selection if it exists. - if clobber: actions.user.clobber_selection_if_exists() - # Otherwise, if there's a selection, fail. - elif "" != actions.edit.selected_text(): return None - - # In principle the previous word should suffice, but some applications - # have a funny concept of what the previous word is (for example, they - # may only take the "`" at the end of "`foo`"). To be double sure we - # take two words left. I also tried taking a line up + a word left, but - # edit.extend_up() = key(shift-up) doesn't work consistently in the - # Slack webapp (sometimes escapes the text box). - actions.edit.extend_word_left() - actions.edit.extend_word_left() - text = actions.edit.selected_text() - # if we're at the beginning of the document/text box, we may not have - # selected any text, in which case we shouldn't move the cursor. - if text: - # Unfortunately, in web Slack, if our selection ends at newline, - # this will go right over the newline. Argh. - actions.edit.right() - return text - - def clobber_selection_if_exists(): - """Deletes the currently selected text if it exists; otherwise does nothing.""" - actions.key("space backspace") - # This space-backspace trick is fast and reliable but has the - # side-effect of cluttering the undo history. Other options: - # - # 1. Call edit.cut() inside a clip.revert() block. This assumes - # edit.cut() is supported AND will be a no-op if there's no - # selection. Unfortunately, sometimes one or both of these is false, - # eg. the notion webapp makes ctrl-x cut the current block by default - # if nothing is selected. - # - # 2. Test whether a selection exists by asking whether - # edit.selected_text() is empty; if it does, use edit.delete(). This - # usually uses the clipboard, which can be quite slow. Also, not sure - # how this would interact with switching edit.selected_text() to use - # the selection clipboard on linux, which can be nonempty even if no - # text is selected in the current application. - # - # Perhaps this ought to be configurable by a setting. - - def dictation_peek_right() -> Optional[str]: - """ - Tries to get the character after the cursor for auto-spacing purposes. - Results are not guaranteed; dictation_peek_right() may return None to - indicate no information. (Note that returning the empty string "" - indicates there is nothing after cursor, ie. we are at the end of the - document.) - """ - actions.edit.extend_right() - char = actions.edit.selected_text() - if char: actions.edit.left() - return char - -# Use the dictation formatter in dictation mode. -dictation_ctx = Context() -dictation_ctx.matches = r""" -mode: dictation -""" - -@dictation_ctx.action_class("main") -class main_action: - def auto_insert(text): actions.user.dictation_insert(text) diff --git a/talon/community/community-cursorless-0.4.0/code/edit.py b/talon/community/community-cursorless-0.4.0/code/edit.py deleted file mode 100644 index 485e945..0000000 --- a/talon/community/community-cursorless-0.4.0/code/edit.py +++ /dev/null @@ -1,91 +0,0 @@ -import time -from talon import Context, Module, actions, clip, ui - -ctx = Context() -mod = Module() - - -@ctx.action_class("edit") -class edit_actions: - def selected_text() -> str: - with clip.capture() as s: - actions.edit.copy() - try: - return s.get() - except clip.NoChange: - return "" - - -@mod.action_class -class Actions: - def paste(text: str): - """Pastes text and preserves clipboard""" - - with clip.revert(): - clip.set_text(text) - actions.edit.paste() - # sleep here so that clip.revert doesn't revert the clipboard too soon - actions.sleep("150ms") - - def new_line_below(): - """Create new line below current line""" - actions.edit.line_end() - actions.key("enter") - - def new_line_above(): - """Create new line above current line""" - actions.edit.line_start() - actions.key("left") - actions.key("enter") - - def down_n(n: int): - """Goes down n lines""" - for _ in range(n): - actions.edit.down() - actions.sleep("10ms") - - def up_n(n: int): - """Goes up n lines""" - for _ in range(n): - actions.edit.up() - actions.sleep("10ms") - - def left_n(n: int): - """Goes left n lines""" - for _ in range(n): - actions.edit.left() - - def delete_left_n(n: int): - """Goes left n lines""" - actions.key(f"backspace:{n}") - - def delete_right_n(n: int): - """Goes left n lines""" - actions.key(f"delete:{n}") - - def right_n(n: int): - """Goes right n lines""" - for _ in range(n): - actions.edit.right() - - def word_right_n(n: int): - """Goes right n words""" - for _ in range(n): - actions.edit.word_right() - - def word_left_n(n: int): - """Goes left n words""" - for _ in range(n): - actions.edit.word_left() - - def delete_word_right_n(n: int): - """Delete right n words""" - for _ in range(n): - actions.edit.extend_word_right() - actions.edit.delete() - - def delete_word_left_n(n: int): - """Delete left n words""" - for _ in range(n): - actions.edit.extend_word_left() - actions.edit.delete() \ No newline at end of file diff --git a/talon/community/community-cursorless-0.4.0/code/engine.py b/talon/community/community-cursorless-0.4.0/code/engine.py deleted file mode 100644 index 66d7a29..0000000 --- a/talon/community/community-cursorless-0.4.0/code/engine.py +++ /dev/null @@ -1,19 +0,0 @@ -from talon import Context, Module -from talon import speech_system - -mod = Module() - - -@mod.action_class -class Actions: - def engine_sleep(): - """Sleep the engine""" - speech_system.engine_mimic("go to sleep"), - - def engine_wake(): - """Wake the engine""" - speech_system.engine_mimic("wake up"), - - def engine_mimic(cmd: str): - """Sends phrase to engine""" - speech_system.engine_mimic(cmd) diff --git a/talon/community/community-cursorless-0.4.0/code/exec.py b/talon/community/community-cursorless-0.4.0/code/exec.py deleted file mode 100644 index cb80098..0000000 --- a/talon/community/community-cursorless-0.4.0/code/exec.py +++ /dev/null @@ -1,17 +0,0 @@ -import os -import subprocess - -from talon import Module - -mod = Module() - - -@mod.action_class -class Actions: - def system_command(cmd: str): - """execute a command on the system""" - os.system(cmd) - - def system_command_nb(cmd: str): - """execute a command on the system without blocking""" - subprocess.Popen(cmd, shell=True) diff --git a/talon/community/community-cursorless-0.4.0/code/extensions.py b/talon/community/community-cursorless-0.4.0/code/extensions.py deleted file mode 100644 index 0b0ad06..0000000 --- a/talon/community/community-cursorless-0.4.0/code/extensions.py +++ /dev/null @@ -1,43 +0,0 @@ -from .user_settings import get_list_from_csv -from talon import Module, Context, actions, app - -mod = Module() -mod.list("file_extension", desc="A file extension, such as .py") - -_file_extensions_defaults = { - "dot pie": ".py", - "dot talon": ".talon", - "dot mark down": ".md", - "dot shell": ".sh", - "dot vim": ".vim", - "dot see": ".c", - "dot see sharp": ".cs", - "dot com": ".com", - "dot net": ".net", - "dot org": ".org", - "dot us": ".us", - "dot U S": ".us", - "dot exe": ".exe", - "dot bin": ".bin", - "dot bend": ".bin", - "dot jason": ".json", - "dot jay son": ".json", - "dot J S": ".js", - "dot java script": ".js", - "dot TS": ".ts", - "dot type script": ".ts", - "dot csv": ".csv", - "totssv": ".csv", - "tot csv": ".csv", - "dot cassie": ".csv", - "dot text": ".txt", -} - -file_extensions = get_list_from_csv( - "file_extensions.csv", - headers=("File extension", "Name"), - default=_file_extensions_defaults, -) - -ctx = Context() -ctx.lists["self.file_extension"] = file_extensions \ No newline at end of file diff --git a/talon/community/community-cursorless-0.4.0/code/file_manager.py b/talon/community/community-cursorless-0.4.0/code/file_manager.py deleted file mode 100644 index 6d46b66..0000000 --- a/talon/community/community-cursorless-0.4.0/code/file_manager.py +++ /dev/null @@ -1,427 +0,0 @@ -from talon import app, Module, Context, actions, ui, imgui, settings, app, registry -from os.path import expanduser -from subprocess import Popen -from pathlib import Path -from typing import List, Union -import os -import math -import re -from itertools import islice - -mod = Module() -ctx = Context() - -mod.tag("file_manager", desc="Tag for enabling generic file management commands") -mod.list("file_manager_directories", desc="List of subdirectories for the current path") -mod.list("file_manager_files", desc="List of files at the root of the current path") - - -setting_auto_show_pickers = mod.setting( - "file_manager_auto_show_pickers", - type=int, - default=0, - desc="Enable to show the file/directories pickers automatically", -) -setting_folder_limit = mod.setting( - "file_manager_folder_limit", - type=int, - default=1000, - desc="Maximum number of files/folders to iterate", -) -setting_file_limit = mod.setting( - "file_manager_file_limit", - type=int, - default=1000, - desc="Maximum number of files to iterate", -) -setting_imgui_limit = mod.setting( - "file_manager_imgui_limit", - type=int, - default=20, - desc="Maximum number of files/folders to display in the imgui", -) -setting_imgui_string_limit = mod.setting( - "file_manager_string_limit", - type=int, - default=20, - desc="Maximum like of string to display in the imgui", -) -cached_path = None -file_selections = folder_selections = [] -current_file_page = current_folder_page = 1 - -ctx.lists["self.file_manager_directories"] = [] -ctx.lists["self.file_manager_files"] = [] - -directories_to_remap = {} -user_path = os.path.expanduser("~") -if app.platform == "windows": - is_windows = True - import ctypes - - GetUserNameEx = ctypes.windll.secur32.GetUserNameExW - NameDisplay = 3 - - size = ctypes.pointer(ctypes.c_ulong(0)) - GetUserNameEx(NameDisplay, None, size) - - nameBuffer = ctypes.create_unicode_buffer(size.contents.value) - GetUserNameEx(NameDisplay, nameBuffer, size) - one_drive_path = os.path.expanduser(os.path.join("~", "OneDrive")) - - # this is probably not the correct way to check for onedrive, quick and dirty - if os.path.isdir(os.path.expanduser(os.path.join("~", r"OneDrive\Desktop"))): - default_folder = os.path.join("~", "Desktop") - - directories_to_remap = { - "Desktop": os.path.join(one_drive_path, "Desktop"), - "Documents": os.path.join(one_drive_path, "Documents"), - "Downloads": os.path.join(user_path, "Downloads"), - "Music": os.path.join(user_path, "Music"), - "OneDrive": one_drive_path, - "Pictures": os.path.join(one_drive_path, "Pictures"), - "Videos": os.path.join(user_path, "Videos"), - } - else: - # todo use expanduser for cross platform support - directories_to_remap = { - "Desktop": os.path.join(user_path, "Desktop"), - "Documents": os.path.join(user_path, "Documents"), - "Downloads": os.path.join(user_path, "Downloads"), - "Music": os.path.join(user_path, "Music"), - "OneDrive": one_drive_path, - "Pictures": os.path.join(user_path, "Pictures"), - "Videos": os.path.join(user_path, "Videos"), - } - - -@mod.action_class -class Actions: - def file_manager_current_path() -> str: - """Returns the current path for the active file manager.""" - return "" - - def file_manager_open_parent(): - """file_manager_open_parent""" - return - - def file_manager_go_forward(): - """file_manager_go_forward_directory""" - - def file_manager_go_back(): - """file_manager_go_forward_directory""" - - def file_manager_open_volume(volume: str): - """file_manager_open_volume""" - - def file_manager_open_directory(path: str): - """opens the directory that's already visible in the view""" - - def file_manager_select_directory(path: str): - """selects the directory""" - - def file_manager_new_folder(name: str): - """Creates a new folder in a gui filemanager or inserts the command to do so for terminals""" - - def file_manager_show_properties(): - """Shows the properties for the file""" - - def file_manager_terminal_here(): - """Opens terminal at current location""" - - def file_manager_open_file(path: str): - """opens the file""" - - def file_manager_select_file(path: str): - """selects the file""" - - def file_manager_refresh_title(): - """Refreshes the title to match current directory. this is for e.g. windows command prompt that will need to do some magic. """ - return - - def file_manager_update_lists(): - """Forces an update of the lists (e.g., when file or folder created)""" - update_lists() - - def file_manager_toggle_pickers(): - """Shows the pickers""" - if gui_files.showing: - gui_files.hide() - gui_folders.hide() - else: - gui_files.show() - gui_folders.show() - - def file_manager_hide_pickers(): - """Hides the pickers""" - if gui_files.showing: - gui_files.hide() - gui_folders.hide() - - def file_manager_open_user_directory(path: str): - """expands and opens the user directory""" - # this functionality exists mostly for windows. - # since OneDrive does strange stuff... - if path in directories_to_remap: - path = directories_to_remap[path] - - path = os.path.expanduser(os.path.join("~", path)) - actions.user.file_manager_open_directory(path) - - def file_manager_get_directory_by_index(index: int) -> str: - """Returns the requested directory for the imgui display by index""" - index = (current_folder_page - 1) * setting_imgui_limit.get() + index - assert index < len(folder_selections) - return folder_selections[index] - - def file_manager_get_file_by_index(index: int) -> str: - """Returns the requested directory for the imgui display by index""" - index = (current_file_page - 1) * setting_imgui_limit.get() + index - assert index < len(file_selections) - return file_selections[index] - - def file_manager_next_file_page(): - """next_file_page""" - global current_file_page - if gui_files.showing: - if current_file_page != total_file_pages: - current_file_page += 1 - else: - current_file_page = 1 - gui_files.show() - - def file_manager_previous_file_page(): - """previous_file_page""" - global current_file_page - if gui_files.showing: - if current_file_page != 1: - current_file_page -= 1 - else: - current_file_page = total_file_pages - - gui_files.show() - - def file_manager_next_folder_page(): - """next_folder_page""" - global current_folder_page - if gui_folders.showing: - if current_folder_page != total_folder_pages: - current_folder_page += 1 - else: - current_folder_page = 1 - - gui_folders.show() - - def file_manager_previous_folder_page(): - """previous_folder_page""" - global current_folder_page - if gui_folders.showing: - if current_folder_page != 1: - current_folder_page -= 1 - else: - current_folder_page = total_folder_pages - - gui_folders.show() - - -pattern = re.compile(r"[A-Z][a-z]*|[a-z]+|\d") - - -def create_spoken_forms(symbols, max_len=30): - return [" ".join(list(islice(pattern.findall(s), max_len))) for s in symbols] - - -def is_dir(f): - try: - return f.is_dir() - except: - return False - - -def is_file(f): - try: - return f.is_file() - except: - return False - - -def get_directory_map(current_path): - directories = [ - f.name - for f in islice( - current_path.iterdir(), settings.get("user.file_manager_folder_limit", 1000) - ) - if is_dir(f) - ] - # print(len(directories)) - spoken_forms = create_spoken_forms(directories) - return dict(zip(spoken_forms, directories)) - - -def get_file_map(current_path): - files = [ - f.name - for f in islice( - current_path.iterdir(), settings.get("user.file_manager_file_limit", 1000) - ) - if is_file(f) - ] - # print(str(files)) - spoken_forms = create_spoken_forms([p for p in files]) - return dict(zip(spoken_forms, [f for f in files])) - - -@imgui.open(y=10, x=900) -def gui_folders(gui: imgui.GUI): - global current_folder_page, total_folder_pages - total_folder_pages = math.ceil( - len(ctx.lists["self.file_manager_directories"]) / setting_imgui_limit.get() - ) - gui.text( - "Select a directory ({}/{})".format(current_folder_page, total_folder_pages) - ) - gui.line() - - index = 1 - current_index = (current_folder_page - 1) * setting_imgui_limit.get() - - while index <= setting_imgui_limit.get() and current_index < len(folder_selections): - name = ( - ( - folder_selections[current_index][: setting_imgui_string_limit.get()] - + ".." - ) - if len(folder_selections[current_index]) > setting_imgui_string_limit.get() - else folder_selections[current_index] - ) - gui.text("{}: {} ".format(index, name)) - current_index += 1 - index = index + 1 - - # if total_folder_pages > 1: - # gui.spacer() - - # if gui.button('Next...'): - # actions.user.file_manager_next_folder_page() - - # if gui.button("Previous..."): - # actions.user.file_manager_previous_folder_page() - - -@imgui.open(y=10, x=1300) -def gui_files(gui: imgui.GUI): - global file_selections, current_file_page, total_file_pages - total_file_pages = math.ceil(len(file_selections) / setting_imgui_limit.get()) - - gui.text("Select a file ({}/{})".format(current_file_page, total_file_pages)) - gui.line() - index = 1 - current_index = (current_file_page - 1) * setting_imgui_limit.get() - - while index <= setting_imgui_limit.get() and current_index < len(file_selections): - name = ( - (file_selections[current_index][: setting_imgui_string_limit.get()] + "..") - if len(file_selections[current_index]) > setting_imgui_string_limit.get() - else file_selections[current_index] - ) - - gui.text("{}: {} ".format(index, name)) - current_index = current_index + 1 - index = index + 1 - - # if total_file_pages > 1: - # gui.spacer() - - # if gui.button('Next...'): - # actions.user.file_manager_next_file_page() - - # if gui.button("Previous..."): - # actions.user.file_manager_previous_file_page() - - -def clear_lists(): - global folder_selections, file_selections - if ( - len(ctx.lists["self.file_manager_directories"]) > 0 - or len(ctx.lists["self.file_manager_files"]) > 0 - ): - current_folder_page = current_file_page = 1 - ctx.lists["self.file_manager_directories"] = [] - ctx.lists["self.file_manager_files"] = [] - folder_selections = [] - file_selections = [] - - -def update_gui(): - if gui_folders.showing or setting_auto_show_pickers.get() >= 1: - gui_folders.show() - gui_files.show() - - -def update_lists(): - global folder_selections, file_selections, current_folder_page, current_file_page - is_valid_path = False - path = actions.user.file_manager_current_path() - directories = {} - files = {} - folder_selections = [] - file_selections = [] - # print(path) - try: - current_path = Path(path) - is_valid_path = current_path.is_dir() - except: - is_valid_path = False - - if is_valid_path: - # print("valid..." + str(current_path)) - try: - directories = get_directory_map(current_path) - files = get_file_map(current_path) - except: - # print("invalid path...") - - directories = {} - files = {} - - current_folder_page = current_file_page = 1 - ctx.lists["self.file_manager_directories"] = directories - ctx.lists["self.file_manager_files"] = files - folder_selections = sorted(directories.values(), key=str.casefold) - file_selections = sorted(files.values(), key=str.casefold) - - update_gui() - - -def win_event_handler(window): - global cached_path - - # on windows, we get events from the clock - # and such, so this check is important - if not window.app.exe or window != ui.active_window(): - return - - path = actions.user.file_manager_current_path() - - if not "user.file_manager" in registry.tags: - actions.user.file_manager_hide_pickers() - clear_lists() - elif path: - if cached_path != path: - update_lists() - elif cached_path: - clear_lists() - actions.user.file_manager_hide_pickers() - - cached_path = path - - -def register_events(): - ui.register("win_title", win_event_handler) - ui.register("win_focus", win_event_handler) - - -# prevent scary errors in the log by waiting for talon to be fully loaded -# before registering the events -app.register("ready", register_events) - diff --git a/talon/community/community-cursorless-0.4.0/code/find_and_replace.py b/talon/community/community-cursorless-0.4.0/code/find_and_replace.py deleted file mode 100644 index 3428852..0000000 --- a/talon/community/community-cursorless-0.4.0/code/find_and_replace.py +++ /dev/null @@ -1,50 +0,0 @@ -from talon import Context, actions, ui, Module, app -from typing import Union - -mod = Module() -mod.tag("find_and_replace", desc="Tag for enabling generic find and replace commands") - - -@mod.action_class -class Actions: - def find(text: str): - """Finds text in current editor""" - - def find_next(): - """Navigates to the next occurrence""" - - def find_previous(): - """Navigates to the previous occurrence""" - - def find_everywhere(text: str): - """Finds text across project""" - - def find_toggle_match_by_case(): - """Toggles find match by case sensitivity""" - - def find_toggle_match_by_word(): - """Toggles find match by whole words""" - - def find_toggle_match_by_regex(): - """Toggles find match by regex""" - - def replace(text: str): - """Search and replace for text in the active editor""" - - def replace_everywhere(text: str): - """Search and replaces for text in the entire project""" - - def replace_confirm(): - """Confirm replace at current position""" - - def replace_confirm_all(): - """Confirm replace all""" - - def select_previous_occurrence(text: str): - """Selects the previous occurrence of the text, and suppresses any find/replace dialogs.""" - - def select_next_occurrence(text: str): - """Selects the next occurrence of the text, and suppresses any find/replace dialogs.""" - - def select_next_token(): - """Selects the next occurrence of the token under the cursor, and suppresses any find/replace dialogs.""" diff --git a/talon/community/community-cursorless-0.4.0/code/formatters.py b/talon/community/community-cursorless-0.4.0/code/formatters.py deleted file mode 100644 index 3f27fc7..0000000 --- a/talon/community/community-cursorless-0.4.0/code/formatters.py +++ /dev/null @@ -1,294 +0,0 @@ -from talon import Module, Context, actions, ui, imgui, app -from talon.grammar import Phrase -from typing import List, Union -import logging -import re - -ctx = Context() -key = actions.key -edit = actions.edit - -words_to_keep_lowercase = ( - "a,an,the,at,by,for,in,is,of,on,to,up,and,as,but,or,nor".split(",") -) - -# The last phrase spoken, without & with formatting. Used for reformatting. -last_phrase = "" -last_phrase_formatted = "" - - -def surround(by): - def func(i, word, last): - if i == 0: - word = by + word - if last: - word += by - return word - - return func - - -def format_phrase(m: Union[str, Phrase], fmtrs: str): - global last_phrase, last_phrase_formatted - last_phrase = m - words = [] - if isinstance(m, str): - words = m.split(" ") - else: - # TODO: is this still necessary, and if so why? - if m.words[-1] == "over": - m.words = m.words[:-1] - - words = actions.dictate.parse_words(m) - words = actions.dictate.replace_words(words) - - result = last_phrase_formatted = format_phrase_no_history(words, fmtrs) - actions.user.add_phrase_to_history(result) - # Arguably, we shouldn't be dealing with history here, but somewhere later - # down the line. But we have a bunch of code that relies on doing it this - # way and I don't feel like rewriting it just now. -rntz, 2020-11-04 - return result - - -def format_phrase_no_history(word_list, fmtrs: str): - fmtr_list = fmtrs.split(",") - words = [] - spaces = True - for i, w in enumerate(word_list): - for name in reversed(fmtr_list): - smash, func = all_formatters[name] - w = func(i, w, i == len(word_list) - 1) - spaces = spaces and not smash - words.append(w) - sep = " " if spaces else "" - return sep.join(words) - - -NOSEP = True -SEP = False - - -def words_with_joiner(joiner): - """Pass through words unchanged, but add a separator between them.""" - - def formatter_function(i, word, _): - return word if i == 0 else joiner + word - - return (NOSEP, formatter_function) - - -def first_vs_rest(first_func, rest_func=lambda w: w): - """Supply one or two transformer functions for the first and rest of - words respectively. - - Leave second argument out if you want all but the first word to be passed - through unchanged. - Set first argument to None if you want the first word to be passed - through unchanged.""" - if first_func is None: - first_func = lambda w: w - - def formatter_function(i, word, _): - return first_func(word) if i == 0 else rest_func(word) - - return formatter_function - - -def every_word(word_func): - """Apply one function to every word.""" - - def formatter_function(i, word, _): - return word_func(word) - - return formatter_function - - -formatters_dict = { - "NOOP": (SEP, lambda i, word, _: word), - "DOUBLE_UNDERSCORE": (NOSEP, first_vs_rest(lambda w: "__%s__" % w)), - "PRIVATE_CAMEL_CASE": (NOSEP, first_vs_rest(lambda w: w, lambda w: w.capitalize())), - "PROTECTED_CAMEL_CASE": ( - NOSEP, - first_vs_rest(lambda w: w, lambda w: w.capitalize()), - ), - "PUBLIC_CAMEL_CASE": (NOSEP, every_word(lambda w: w.capitalize())), - "SNAKE_CASE": ( - NOSEP, - first_vs_rest(lambda w: w.lower(), lambda w: "_" + w.lower()), - ), - "NO_SPACES": (NOSEP, every_word(lambda w: w)), - "DASH_SEPARATED": words_with_joiner("-"), - "TERMINAL_DASH_SEPARATED": ( - NOSEP, - first_vs_rest(lambda w: " --" + w.lower(), lambda w: "-" + w.lower()), - ), - "DOUBLE_COLON_SEPARATED": words_with_joiner("::"), - "ALL_CAPS": (SEP, every_word(lambda w: w.upper())), - "ALL_LOWERCASE": (SEP, every_word(lambda w: w.lower())), - "DOUBLE_QUOTED_STRING": (SEP, surround('"')), - "SINGLE_QUOTED_STRING": (SEP, surround("'")), - "SPACE_SURROUNDED_STRING": (SEP, surround(" ")), - "DOT_SEPARATED": words_with_joiner("."), - "DOT_SNAKE": (NOSEP, lambda i, word, _: "." + word if i == 0 else "_" + word), - "SLASH_SEPARATED": (NOSEP, words_with_joiner("/")), - "CAPITALIZE_FIRST_WORD": (SEP, first_vs_rest(lambda w: w.capitalize())), - "CAPITALIZE_ALL_WORDS": ( - SEP, - lambda i, word, _: word.capitalize() - if i == 0 or word not in words_to_keep_lowercase - else word, - ), - "FIRST_THREE": (NOSEP, lambda i, word, _: word[0:3]), - "FIRST_FOUR": (NOSEP, lambda i, word, _: word[0:4]), - "FIRST_FIVE": (NOSEP, lambda i, word, _: word[0:5]), -} - -# This is the mapping from spoken phrases to formatters -formatters_words = { - "allcaps": formatters_dict["ALL_CAPS"], - "alldown": formatters_dict["ALL_LOWERCASE"], - "camel": formatters_dict["PRIVATE_CAMEL_CASE"], - "dotted": formatters_dict["DOT_SEPARATED"], - "dubstring": formatters_dict["DOUBLE_QUOTED_STRING"], - "dunder": formatters_dict["DOUBLE_UNDERSCORE"], - "hammer": formatters_dict["PUBLIC_CAMEL_CASE"], - "kebab": formatters_dict["DASH_SEPARATED"], - # "packed": formatters_dict["DOUBLE_COLON_SEPARATED"], - "padded": formatters_dict["SPACE_SURROUNDED_STRING"], - # "say": formatters_dict["NOOP"], - # "sentence": formatters_dict["CAPITALIZE_FIRST_WORD"], - "slasher": formatters_dict["SLASH_SEPARATED"], - "smash": formatters_dict["NO_SPACES"], - "snake": formatters_dict["SNAKE_CASE"], - # "speak": formatters_dict["NOOP"], - "string": formatters_dict["SINGLE_QUOTED_STRING"], - "title": formatters_dict["CAPITALIZE_ALL_WORDS"], - # disable a few formatters for now - # "tree": formatters_dict["FIRST_THREE"], - # "quad": formatters_dict["FIRST_FOUR"], - # "fiver": formatters_dict["FIRST_FIVE"], -} - -all_formatters = {} -all_formatters.update(formatters_dict) -all_formatters.update(formatters_words) - -mod = Module() -mod.list("formatters", desc="list of formatters") -mod.list( - "prose_formatter", - desc="words to start dictating prose, and the formatter they apply", -) - - -@mod.capture(rule="{self.formatters}+") -def formatters(m) -> str: - "Returns a comma-separated string of formatters e.g. 'SNAKE,DUBSTRING'" - return ",".join(m.formatters_list) - - -@mod.capture( - # Note that if the user speaks something like "snake dot", it will - # insert "dot" - otherwise, they wouldn't be able to insert punctuation - # words directly. - rule=" ( | )*" -) -def format_text(m) -> str: - "Formats the text and returns a string" - out = "" - formatters = m[0] - for chunk in m[1:]: - if isinstance(chunk, ImmuneString): - out += chunk.string - else: - out += format_phrase(chunk, formatters) - return out - - -class ImmuneString(object): - """Wrapper that makes a string immune from formatting.""" - - def __init__(self, string): - self.string = string - - -@mod.capture( - # Add anything else into this that you want to be able to speak during a - # formatter. - rule="( | numb )" -) -def formatter_immune(m) -> ImmuneString: - """Text that can be interspersed into a formatter, e.g. characters. - - It will be inserted directly, without being formatted. - - """ - if hasattr(m, "number"): - value = m.number - else: - value = m[0] - return ImmuneString(str(value)) - - -@mod.action_class -class Actions: - def formatted_text(phrase: Union[str, Phrase], formatters: str) -> str: - """Formats a phrase according to formatters. formatters is a comma-separated string of formatters (e.g. 'CAPITALIZE_ALL_WORDS,DOUBLE_QUOTED_STRING')""" - return format_phrase(phrase, formatters) - - def insert_formatted(phrase: Union[str, Phrase], formatters: str): - """Inserts a phrase formatted according to formatters. Formatters is a comma separated list of formatters (e.g. 'CAPITALIZE_ALL_WORDS,DOUBLE_QUOTED_STRING')""" - actions.insert(format_phrase(phrase, formatters)) - - def formatters_help_toggle(): - """Lists all formatters""" - if gui.showing: - gui.hide() - else: - gui.show() - - def formatters_reformat_last(formatters: str) -> str: - """Clears and reformats last formatted phrase""" - global last_phrase, last_phrase_formatted - if actions.user.get_last_phrase() != last_phrase_formatted: - # The last thing we inserted isn't the same as the last thing we - # formatted, so abort. - logging.warning( - "formatters_reformat_last(): Last phrase wasn't a formatter!" - ) - return - actions.user.clear_last_phrase() - actions.user.insert_formatted(last_phrase, formatters) - - def formatters_reformat_selection(formatters: str) -> str: - """Reformats the current selection.""" - selected = edit.selected_text() - unformatted = re.sub(r"[^a-zA-Z0-9]+", " ", selected).lower() - # TODO: Separate out camelcase & studleycase vars - - # Delete separately for compatibility with programs that don't overwrite - # selected text (e.g. Emacs) - edit.delete() - text = actions.self.formatted_text(unformatted, formatters) - actions.insert(text) - return text - - def insert_many(strings: List[str]) -> None: - """Insert a list of strings, sequentially.""" - for string in strings: - actions.insert(string) - - -ctx.lists["self.formatters"] = formatters_words.keys() -ctx.lists["self.prose_formatter"] = { - "speak": "NOOP", - "sense": "CAPITALIZE_FIRST_WORD", -} - - -@imgui.open() -def gui(gui: imgui.GUI): - gui.text("List formatters") - gui.line() - for name in sorted(set(formatters_words.keys())): - gui.text(f"{name} | {format_phrase_no_history(['one', 'two', 'three'], name)}") diff --git a/talon/community/community-cursorless-0.4.0/code/help.py b/talon/community/community-cursorless-0.4.0/code/help.py deleted file mode 100644 index cb96928..0000000 --- a/talon/community/community-cursorless-0.4.0/code/help.py +++ /dev/null @@ -1,625 +0,0 @@ -from collections import defaultdict -import itertools -import math -from typing import Dict, List, Iterable, Set, Tuple, Union - -from talon import Module, Context, actions, imgui, Module, registry, ui, app -from talon.grammar import Phrase - -mod = Module() -mod.list("help_contexts", desc="list of available contexts") -mod.mode("help", "mode for commands that are available only when help is visible") -setting_help_max_contexts_per_page = mod.setting( - "help_max_contexts_per_page", - type=int, - default=20, - desc="Max contexts to display per page in help", -) -setting_help_max_command_lines_per_page = mod.setting( - "help_max_command_lines_per_page", - type=int, - default=50, - desc="Max lines of command to display per page in help", -) - -ctx = Context() -# context name -> commands -context_command_map = {} - -# rule word -> Set[(context name, rule)] -rule_word_map: Dict[str, Set[Tuple[str, str]]] = defaultdict(set) -search_phrase = None - -# context name -> actual context -context_map = {} - -current_context_page = 1 -sorted_context_map_keys = [] - -selected_context = None -selected_context_page = 1 - -total_page_count = 1 - -cached_active_contexts_list = [] - -live_update = True -cached_window_title = None -show_enabled_contexts_only = False - - -def update_title(): - global live_update - global show_enabled_contexts_only - global cached_window_title - - if live_update: - if gui_context_help.showing: - if selected_context == None: - refresh_context_command_map(show_enabled_contexts_only) - else: - update_active_contexts_cache(registry.active_contexts()) - - -# todo: dynamic rect? -@imgui.open(y=0) -def gui_alphabet(gui: imgui.GUI): - global alphabet - gui.text("Alphabet help") - gui.line() - - for key, val in alphabet.items(): - gui.text("{}: {}".format(val, key)) - - gui.spacer() - if gui.button("close"): - gui_alphabet.hide() - - -def format_context_title(context_name: str) -> str: - global cached_active_contexts_list - return "{} [{}]".format( - context_name, - "ACTIVE" - if context_map.get(context_name, None) in cached_active_contexts_list - else "INACTIVE", - ) - - -def format_context_button(index: int, context_label: str, context_name: str) -> str: - global cached_active_contexts_list - global show_enabled_contexts_only - - if not show_enabled_contexts_only: - return "{}. {}{}".format( - index, - context_label, - "*" - if context_map.get(context_name, None) in cached_active_contexts_list - else "", - ) - else: - return "{}. {} ".format(index, context_label) - - -# translates 1-based index -> actual index in sorted_context_map_keys -def get_context_page(index: int) -> int: - return math.ceil(index / setting_help_max_contexts_per_page.get()) - - -def get_total_context_pages() -> int: - return math.ceil( - len(sorted_context_map_keys) / setting_help_max_contexts_per_page.get() - ) - - -def get_current_context_page_length() -> int: - start_index = (current_context_page - 1) * setting_help_max_contexts_per_page.get() - return len( - sorted_context_map_keys[ - start_index : start_index + setting_help_max_contexts_per_page.get() - ] - ) - - -def get_command_line_count(command: Tuple[str, str]) -> int: - """This should be kept in sync with draw_commands - """ - _, body = command - lines = len(body.split("\n")) - if lines == 1: - return 1 - else: - return lines + 1 - - -def get_pages(item_line_counts: List[int]) -> List[int]: - """Given some set of indivisible items with given line counts, - return the page number each item should appear on. - - If an item will cross a page boundary, it is moved to the next page, - so that pages may be shorter than the maximum lenth, but not longer. The only - exception is when an item is longer than the maximum page length, in which - case that item will be placed on a longer page. - """ - current_page_line_count = 0 - current_page = 1 - pages = [] - for line_count in item_line_counts: - if ( - line_count + current_page_line_count - > setting_help_max_command_lines_per_page.get() - ): - if current_page_line_count == 0: - # Special case, render a larger page. - page = current_page - current_page_line_count = 0 - else: - page = current_page + 1 - current_page_line_count = line_count - current_page += 1 - else: - current_page_line_count += line_count - page = current_page - pages.append(page) - return pages - - -@imgui.open(y=0) -def gui_context_help(gui: imgui.GUI): - global context_command_map - global current_context_page - global selected_context - global selected_context_page - global sorted_context_map_keys - global show_enabled_contexts_only - global cached_active_contexts_list - global total_page_count - global search_phrase - - # if no selected context, draw the contexts - if selected_context is None and search_phrase is None: - total_page_count = get_total_context_pages() - - if not show_enabled_contexts_only: - gui.text( - "Help: All ({}/{}) (* = active)".format( - current_context_page, total_page_count - ) - ) - else: - gui.text( - "Help: Active Contexts Only ({}/{})".format( - current_context_page, total_page_count - ) - ) - - gui.line() - - current_item_index = 1 - current_selection_index = 1 - for key in sorted_context_map_keys: - if key in ctx.lists["self.help_contexts"]: - target_page = get_context_page(current_item_index) - - if current_context_page == target_page: - button_name = format_context_button( - current_selection_index, - key, - ctx.lists["self.help_contexts"][key], - ) - - if gui.button(button_name): - selected_context = ctx.lists["self.help_contexts"][key] - current_selection_index = current_selection_index + 1 - - current_item_index += 1 - - if total_page_count > 1: - gui.spacer() - if gui.button("Next..."): - actions.user.help_next() - - if gui.button("Previous..."): - actions.user.help_previous() - - # if there's a selected context, draw the commands for it - else: - if selected_context is not None: - draw_context_commands(gui) - elif search_phrase is not None: - draw_search_commands(gui) - - gui.spacer() - if total_page_count > 1: - if gui.button("Next..."): - actions.user.help_next() - - if gui.button("Previous..."): - actions.user.help_previous() - - if gui.button("Return"): - actions.user.help_return() - - if gui.button("Refresh"): - actions.user.help_refresh() - - if gui.button("Close"): - actions.user.help_hide() - - -def draw_context_commands(gui: imgui.GUI): - global selected_context - global total_page_count - global selected_context_page - - context_title = format_context_title(selected_context) - title = f"Context: {context_title}" - commands = context_command_map[selected_context].items() - item_line_counts = [get_command_line_count(command) for command in commands] - pages = get_pages(item_line_counts) - total_page_count = max(pages, default=1) - draw_commands_title(gui, title) - - filtered_commands = [ - command - for command, page in zip(commands, pages) - if page == selected_context_page - ] - - draw_commands(gui, filtered_commands) - - -def draw_search_commands(gui: imgui.GUI): - global search_phrase - global total_page_count - global cached_active_contexts_list - global selected_context_page - - title = f"Search: {search_phrase}" - commands_grouped = get_search_commands(search_phrase) - commands_flat = list(itertools.chain.from_iterable(commands_grouped.values())) - - sorted_commands_grouped = sorted( - commands_grouped.items(), - key=lambda item: context_map[item[0]] not in cached_active_contexts_list, - ) - - pages = get_pages( - [ - sum(get_command_line_count(command) for command in commands) + 3 - for _, commands in sorted_commands_grouped - ] - ) - total_page_count = max(pages, default=1) - - draw_commands_title(gui, title) - - current_item_index = 1 - for (context, commands), page in zip(sorted_commands_grouped, pages): - if page == selected_context_page: - gui.text(format_context_title(context)) - gui.line() - draw_commands(gui, commands) - gui.spacer() - - -def get_search_commands(phrase: str) -> Dict[str, Tuple[str, str]]: - global rule_word_map - tokens = search_phrase.split(" ") - - viable_commands = rule_word_map[tokens[0]] - for token in tokens[1:]: - viable_commands &= rule_word_map[token] - - commands_grouped = defaultdict(list) - for context, rule in viable_commands: - command = context_command_map[context][rule] - commands_grouped[context].append((rule, command)) - - return commands_grouped - - -def draw_commands_title(gui: imgui.GUI, title: str): - global selected_context_page - global total_page_count - - gui.text("{} ({}/{})".format(title, selected_context_page, total_page_count)) - gui.line() - - -def draw_commands(gui: imgui.GUI, commands: Iterable[Tuple[str, str]]): - for key, val in commands: - val = val.split("\n") - if len(val) > 1: - gui.text("{}:".format(key)) - for line in val: - gui.text(" {}".format(line)) - else: - gui.text("{}: {}".format(key, val[0])) - - -def reset(): - global current_context_page - global sorted_context_map_keys - global selected_context - global search_phrase - global selected_context_page - global cached_window_title - global show_enabled_contexts_only - - current_context_page = 1 - sorted_context_map_keys = None - selected_context = None - search_phrase = None - selected_context_page = 1 - cached_window_title = None - show_enabled_contexts_only = False - - -def update_active_contexts_cache(active_contexts): - # print("update_active_contexts_cache") - global cached_active_contexts_list - cached_active_contexts_list = active_contexts - - -# example usage todo: make a list definable in .talon -# overrides = {"generic browser" : "broswer"} -overrides = {} - - -def refresh_context_command_map(enabled_only=False): - global rule_word_map - global context_command_map - global context_map - global sorted_context_map_keys - global show_enabled_contexts_only - global cached_window_title - global context_map - - context_map = {} - cached_short_context_names = {} - show_enabled_contexts_only = enabled_only - cached_window_title = ui.active_window().title - active_contexts = registry.active_contexts() - # print(str(active_contexts)) - update_active_contexts_cache(active_contexts) - - context_command_map = {} - for context_name, context in registry.contexts.items(): - splits = context_name.split(".") - index = -1 - if "talon" in splits[index]: - index = -2 - short_name = splits[index].replace("_", " ") - else: - short_name = splits[index].replace("_", " ") - - if "mac" == short_name or "win" == short_name or "linux" == short_name: - index = index - 1 - short_name = splits[index].replace("_", " ") - - # print("short name: " + short_name) - if short_name in overrides: - short_name = overrides[short_name] - - if enabled_only and context in active_contexts or not enabled_only: - context_command_map[context_name] = {} - for command_alias, val in context.commands.items(): - # print(str(val)) - if command_alias in registry.commands: - # print(str(val.rule.rule) + ": " + val.target.code) - context_command_map[context_name][ - str(val.rule.rule) - ] = val.target.code - # print(short_name) - # print("length: " + str(len(context_command_map[context_name]))) - if len(context_command_map[context_name]) == 0: - context_command_map.pop(context_name) - else: - cached_short_context_names[short_name] = context_name - context_map[context_name] = context - - refresh_rule_word_map(context_command_map) - - ctx.lists["self.help_contexts"] = cached_short_context_names - # print(str(ctx.lists["self.help_contexts"])) - sorted_context_map_keys = sorted(cached_short_context_names) - - -def refresh_rule_word_map(context_command_map): - global rule_word_map - rule_word_map = defaultdict(set) - - for context_name, commands in context_command_map.items(): - for rule in commands: - tokens = set(token for token in rule.split(" ") if token.isalpha()) - for token in tokens: - rule_word_map[token].add((context_name, rule)) - - -events_registered = False - - -def register_events(register: bool): - global events_registered - if register: - if not events_registered and live_update: - events_registered = True - # registry.register('post:update_contexts', contexts_updated) - registry.register("update_commands", commands_updated) - else: - events_registered = False - # registry.unregister('post:update_contexts', contexts_updated) - registry.unregister("update_commands", commands_updated) - - -@mod.action_class -class Actions: - def help_alphabet(ab: dict): - """Provides the alphabet dictionary""" - # what you say is stored as a trigger - global alphabet - alphabet = ab - reset() - # print("help_alphabet - alphabet gui_alphabet: {}".format(gui_alphabet.showing)) - # print( - # "help_alphabet - gui_context_help showing: {}".format( - # gui_context_help.showing - # ) - # ) - gui_context_help.hide() - gui_alphabet.hide() - gui_alphabet.show() - register_events(False) - actions.mode.enable("user.help") - - def help_context_enabled(): - """Display contextual command info""" - reset() - refresh_context_command_map(enabled_only=True) - gui_alphabet.hide() - gui_context_help.show() - register_events(True) - actions.mode.enable("user.help") - - def help_context(): - """Display contextual command info""" - reset() - refresh_context_command_map() - gui_alphabet.hide() - gui_context_help.show() - register_events(True) - actions.mode.enable("user.help") - - def help_search(phrase: str): - """Display command info for search phrase""" - global search_phrase - - reset() - search_phrase = phrase - refresh_context_command_map() - gui_alphabet.hide() - gui_context_help.show() - register_events(True) - actions.mode.enable("user.help") - - def help_selected_context(m: str): - """Display command info for selected context""" - global selected_context - global selected_context_page - - if not gui_context_help.showing: - reset() - refresh_context_command_map() - else: - selected_context_page = 1 - update_active_contexts_cache(registry.active_contexts()) - - selected_context = m - gui_alphabet.hide() - gui_context_help.show() - register_events(True) - actions.mode.enable("user.help") - - def help_next(): - """Navigates to next page""" - global current_context_page - global selected_context - global selected_context_page - global total_page_count - - if gui_context_help.showing: - if selected_context is None and search_phrase is None: - if current_context_page != total_page_count: - current_context_page += 1 - else: - current_context_page = 1 - else: - if selected_context_page != total_page_count: - selected_context_page += 1 - else: - selected_context_page = 1 - - def help_select_index(index: int): - """Select the context by a number""" - global sorted_context_map_keys, selected_context - if gui_context_help.showing: - if index < setting_help_max_contexts_per_page.get() and ( - (current_context_page - 1) * setting_help_max_contexts_per_page.get() - + index - < len(sorted_context_map_keys) - ): - if selected_context is None: - selected_context = ctx.lists["self.help_contexts"][ - sorted_context_map_keys[ - (current_context_page - 1) - * setting_help_max_contexts_per_page.get() - + index - ] - ] - - def help_previous(): - """Navigates to previous page""" - global current_context_page - global selected_context - global selected_context_page - global total_page_count - - if gui_context_help.showing: - if selected_context is None and search_phrase is None: - if current_context_page != 1: - current_context_page -= 1 - else: - current_context_page = total_page_count - - else: - if selected_context_page != 1: - selected_context_page -= 1 - else: - selected_context_page = total_page_count - - def help_return(): - """Returns to the main help window""" - global selected_context - global selected_context_page - global show_enabled_contexts_only - - if gui_context_help.showing: - refresh_context_command_map(show_enabled_contexts_only) - selected_context_page = 1 - selected_context = None - - def help_refresh(): - """Refreshes the help""" - global show_enabled_contexts_only - global selected_context - - if gui_context_help.showing: - if selected_context == None: - refresh_context_command_map(show_enabled_contexts_only) - else: - update_active_contexts_cache(registry.active_contexts()) - - def help_hide(): - """Hides the help""" - reset() - - # print("help_hide - alphabet gui_alphabet: {}".format(gui_alphabet.showing)) - # print( - # "help_hide - gui_context_help showing: {}".format(gui_context_help.showing) - # ) - - gui_alphabet.hide() - gui_context_help.hide() - refresh_context_command_map() - register_events(False) - actions.mode.disable("user.help") - - -def commands_updated(_): - update_title() - - -app.register("ready", refresh_context_command_map) - diff --git a/talon/community/community-cursorless-0.4.0/code/history.py b/talon/community/community-cursorless-0.4.0/code/history.py deleted file mode 100644 index 2d98221..0000000 --- a/talon/community/community-cursorless-0.4.0/code/history.py +++ /dev/null @@ -1,76 +0,0 @@ -from talon import imgui, Module, speech_system, actions, app - -# We keep command_history_size lines of history, but by default display only -# command_history_display of them. -mod = Module() -setting_command_history_size = mod.setting("command_history_size", int, default=50) -setting_command_history_display = mod.setting( - "command_history_display", int, default=10 -) - -hist_more = False -history = [] - - -def parse_phrase(word_list): - return " ".join(word.split("\\")[0] for word in word_list) - - -def on_phrase(j): - global history - - try: - val = parse_phrase(getattr(j["parsed"], "_unmapped", j["phrase"])) - except: - val = parse_phrase(j["phrase"]) - - if val != "": - history.append(val) - history = history[-setting_command_history_size.get() :] - - -# todo: dynamic rect? -@imgui.open(x=1300, y=915) -def gui(gui: imgui.GUI): - global history - text = ( - history[:] if hist_more else history[-setting_command_history_display.get() :] - ) - for line in text: - gui.text(line) - - -speech_system.register("phrase", on_phrase) - - -@mod.action_class -class Actions: - def history_toggle(): - """Toggles viewing the history""" - if gui.showing: - gui.hide() - else: - gui.show() - - def history_enable(): - """Enables the history""" - gui.show() - - def history_disable(): - """Disables the history""" - gui.hide() - - def history_clear(): - """Clear the history""" - global history - history = [] - - def history_more(): - """Show more history""" - global hist_more - hist_more = True - - def history_less(): - """Show less history""" - global hist_more - hist_more = False diff --git a/talon/community/community-cursorless-0.4.0/code/homophones.csv b/talon/community/community-cursorless-0.4.0/code/homophones.csv deleted file mode 100644 index e5a4cf1..0000000 --- a/talon/community/community-cursorless-0.4.0/code/homophones.csv +++ /dev/null @@ -1,651 +0,0 @@ -able,Abel -Adam,atom -Cain,cane -Chile,chili,chilly -check,Czech -Dane,deign -finish,Finnish -gale,Gail -Hugh,hue,hew -I,eye,aye -Jim,gym -laps,lapse,Lapps -Lou,lieu -Nice,niece -Paul,pall -Pete,peat -sue,Sioux -Wayne,wane,wain -acclamation,acclimation -add,ad -addition,edition -adds,ads,adz -adherence,adherents -ado,adieu -aerial,ariel -arrow,aero -affected,effected -afterward,afterword -aid,aide -ale,ail -all,awl -alluded,eluded -illusion,allusion -allowed,aloud -alter,altar -analyst,annalist -appetite,apatite -apprize,apprise -arc,ark -ascent,assent -assistance,assistants -augur,auger -aunt,ant -auto,otto -oral,aural -oriole,aureole -away,aweigh -acts,ax -axis,axes -axle,axel -eyes,ayes -bah,baa -Babel,babble -bad,bade -bait,bate -bald,balled,bawled -bail,bale,baal -band,banned -barred,bard -baron,barren -basil,basal -base,bass -basis,bases -basque,bask -based,baste -baited,bated -ball,bawl -bizarre,bazaar -bear,bare -beat,beet -bow,beau -be,bee -beach,beech -been,bin -beer,bier -bell,belle -better,bettor -bib,bibb -bite,byte,bight -bird,burred -birth,berth -blue,blew -block,bloc -bore,boar -boulder,bolder -bomb,balm,bombe -booty,bootie -border,boarder -board,bored -born,borne -bow,bough -bowed,bode -bold,bowled -braid,brayed -brays,braise -breach,breech -break,brake -bread,bred -brews,bruise -bridal,bridle -broach,brooch -brewed,brood -browse,brows -brute,brut -build,billed -bullion,bouillon -boy,buoy -burger,burgher -borough,burrow,burro -bury,berry -bust,bussed -but,butt -by,buy,bye -caddy,caddie -calendar,calender -callous,callus -cannon,canon -cantor,canter -canvas,canvass -capital,capitol -carol,carrel -carrot,carat,caret,karat -cash,cache -cached,cashed -cast,caste -caster,castor -cause,caws -seed,cede -ceiling,sealing -seller,cellar -sensor,censor -sent,cent,scent -serial,cereal -chance,chants -chased,chaste -chauffeur,shofar -cheap,cheep -chic,sheik -choose,chews -cited,sided,sighted -clack,claque -clammer,clamor,clamber -clause,claws -clue,clew -click,clique -climb,clime -close,clothes,cloze -coal,cole -course,coarse -coat,cote -coax,cokes -collared,collard -complacent,complaisant -complement,compliment -conceded,conceited -consonants,consonance -continents,continence -coup,coo -coulee,coolie -cops,copse -coral,choral -cord,chord,cored -core,corps -coughers,coffers -council,counsel -coupe,coop -coarser,courser -cousin,cozen -coward,cowered -craft,kraft -creek,creak -crepe,crape -cruel,crewel -cruise,crews -queue,cue -current,currant -cursor,curser -signet,cygnet -symbol,cymbal -Cyprus,cypress -damn,dam -days,daze -dear,deer -dense,dents -diffused,defused -discrete,discreet -disperse,disburse -descent,dissent -do,due,dew -doc,dock -do,dough,doe -does,doze -draft,draught -ducked,duct -ducks,ducts -dual,duel -done,dun -die,dye -dying,dyeing -adduce,educe -eke,eek -effect,affect -effects,affects -eight,ate -illicit,elicit -elude,allude -elusive,illusive,allusive -emend,amend -innumerable,enumerable -errant,arrant -eve,eave -exceed,accede -except,accept -exercise,exorcise -I'd,eyed -faint,feint -fair,fare -fairy,ferry -foe,faux -fawn,faun -facts,fax -phase,faze -feet,feat -fens,fends -fete,fate -few,phew -Phil,fill -find,fined -fisher,fissure -flare,flair -flee,flea -flow,floe -flower,flour -flew,flu,flue -flyer,flier -fold,foaled -for,four,fore -foregone,forgone -forward,foreword -fort,forte -fourth,forth -foul,fowl -frank,franc -phrase,frays -freeze,frees,frieze -friar,fryer -fur,fir -gaffe,gaff -gate,gait -gamble,gambol -gel,jell -gene,Jean -jibe,gibe -guild,gild -gilder,guilder -guilt,gilt -gnome,Nome -gopher,gofer -gourd,gored -gorilla,guerilla -graham,gram -graft,graphed -great,grate -greater,grater -grade,grayed -graze,grays -Greece,grease -grill,grille -grizzly,grisly -grown,groan -guest,guessed -gauge,gage -hail,hale -hall,haul -have,halve -handmade,handmaid -hangar,hanger -handsome,hansom -hair,hare -hey,hay -haze,hays -heart,hart -he'll,heal,heel -air,heir,err -heard,herd -here,hear -heroin,heroine -he'd,heed -high,hi -higher,hire -ho,hoe -hold,holed -whole,hole -holy,wholly,holey -horde,hoard -horse,hoarse -hose,hoes -hostile,hostel -humorous,humerus -hurts,hertz -him,hymn -idle,idol,idyll -imminent,immanent -impassable,impassible -in,inn -innocence,innocents -insight,incite -instance,instants -intense,intents -I'll,aisle,isle -islet,eyelet -its,it's -jam,jamb -jinx,jinks -kernel,colonel -nap,knap -nave,knave -new,knew,gnu -knit,nit -knock,nock -no,know -coy,koi -crawl,kraal -lacks,lax -latter,ladder -laid,lade -lama,llama -lane,lain -lee,lea -lead,led -leak,leek -lean,lien -least,leased -leach,leech -lay,lei -lays,leis,laze -lens,lends -lesson,lessen -let's,lets -levy,levee -light,lite -liken,lichen -links,lynx -literal,littoral -loathe,loath -loch,lock -load,lode,lowed -loan,lone -loot,lute -low,lo -lochs,locks,lox -lumber,lumbar -lie,lye -liar,lyre,lier -matter,madder -made,maid -maze,maize -male,mail -mall,maul -main,Maine,mane -manner,manor -mantle,mantel -mayor,mare -mark,marc -martial,marshal -martin,marten -mast,massed -mat,matte -meet,meat,mete -meteor,meatier -metal,medal,mettle -medal,meddle,mettle -Mary,marry,merry -metal,meddle,mettle -mule,mewl -mean,mien -mill,mil -mince,mints -mind,mined -minor,miner -Mrs.,misses -missile,missal -missed,mist -might,mite -mode,mowed -mood,mooed -mourn,morn -moat,mote -morning,mourning -moose,mousse -moan,mown -mucus,mucous -muscle,mussel -muse,mews -must,mussed -mustard,mustered -naval,navel -need,knead,kneed -nay,neigh -nice,gneiss -knickers,nickers -night,knight -none,nun -knows,nose -not,knot -or,ore,oar -owed,ode -oh,owe -our,hour -outcast,outcaste -overdue,overdo -overseas,oversees -paste,paced -packed,pact -pale,pail -pain,pane -palette,palate,pallet -pair,pear,pare -pairs,pears -parley,parlay -past,passed -patients,patience -patted,padded -pause,paws -piece,peace -peas,pees -pedal,peddle,petal -pee,pea -peel,peal -peer,pier -penance,pennants -paean,peon,paeon -per,purr -parish,perish -petrol,petrel -pew,pugh -flocks,phlox -pie,pi -picot,pekoe -pigeon,pidgin -pilot,Pilate -peak,peek,pique -pistol,pistil -plaque,plack -plate,plait -plane,plain -please,pleas -plum,plumb -poll,pole -pull,pool -pour,pore -praise,prays,preys -precedence,precedents -premier,premiere -presence,presents -pray,prey -pride,pried -primer,primmer -principle,principal -prince,prints -profit,prophet -pros,prose -perl,pearl,purl -pervade,purveyed -quartz,quarts -queue,cue,cu -quince,quints -choir,quire -rabbit,rabbet -rain,reign,rein -wrap,rap -wrapped,rapped,rapt -raise,rays,raze -read,red -read,reed -real,reel -wreak,reek -residents,residence -rest,wrest -wretch,retch -review,revue -rigor,rigger -ring,wring -right,write,rite -roads,rhodes -Rome,roam -row,roe -role,roll -room,rheum -rose,rows -rough,ruff -route,root -rue,roux -road,rode,rowed -rude,rued -rumor,roomer -rung,wrung -Russell,rustle -sack,sac -sacks,sax -sale,sail -sane,seine -sachet,sashay -saver,savor -seen,scene -sense,cents,scents -skull,scull -seer,sear,sere -see,sea -cedar,seeder -seem,seam -sees,seize,seas -sell,cell -series,Ceres -session,cession -sheer,shear -shoe,shoo -shoot,chute -shown,shone -sick,sic -side,sighed -size,sighs -site,sight,cite -sink,sync -slay,sleigh -slight,sleight -slow,sloe -slew,slough,slue -sword,soared -sold,soled -son,sun -sore,soar -sorry,sari -soul,sole -so,sow,sew -spade,spayed -stayed,staid -stare,stair -stationary,stationery -stake,steak -steel,steal -step,steppe -style,stile -straightened,straitened -straight,strait -swayed,suede -suit,soot -some,sum -summary,summery -Sunday,sundae -surf,serf -surge,serge -sweet,suite -tax,tacks -tacked,tact -tale,tail -taper,tapir -terry,tarry -taupe,tope -taught,taut -tea,tee -team,teem -tease,teas,tees -tear,tare -tens,tends -tense,tents -than,then -the,thee -there's,theirs -their,there,they're -through,threw -thrown,throne -throws,throes -time,thyme -tick,tic -tie,Thai -tied,tide -tear,tier -Tigris,tigress -timber,timbre -to,two,too -toe,tow -told,tolled -tool,tulle -tort,torte -torturous,tortuous -towed,toad,toed -tracked,tract -trader,traitor -troop,troupe -trust,trussed -turbine,turban -turn,tern -tutor,Tudor,tooter -tucks,tux -utter,udder -undo,undue -earn,urn -use,ewes,yews -veil,vale -valence,valance -vain,vein,vane -vein,vane -Venus,venous -versus,verses -very,vary -vile,vial -vice,vise -waste,waist -wait,weight -waiter,wader -whale,wail,wale -wears,where's,wares -wave,waive -wax,whacks -way,weigh,whey -we,wee -where,wear,ware -whether,weather,wether -we'd,weed -week,weak -wade,weighed -ways,weighs -wet,whet -we've,weave -Wales,whales,wails -we'll,wheel -which,witch -while,wile -were,whir -word,whirred -hoop,whoop -whose,who's -wine,whine -wind,whined,wined -whoa,woe -walk,wok -one,won -want,wont -would,wood -war,wore -world,whirled,whorled -worn,warn -rack,wrack -rapper,wrapper -wrote,rote -rye,wry -you,yew,ewe -yoke,yolk -your,you're,yore -you'll,Yule diff --git a/talon/community/community-cursorless-0.4.0/code/homophones.py b/talon/community/community-cursorless-0.4.0/code/homophones.py deleted file mode 100644 index 35a49ef..0000000 --- a/talon/community/community-cursorless-0.4.0/code/homophones.py +++ /dev/null @@ -1,168 +0,0 @@ -from talon import Context, Module, app, clip, cron, imgui, actions, ui, fs -import os - -######################################################################## -# global settings -######################################################################## - -# a list of homophones where each line is a comma separated list -# e.g. where,wear,ware -# a suitable one can be found here: -# https://github.com/pimentel/homophones -cwd = os.path.dirname(os.path.realpath(__file__)) -homophones_file = os.path.join(cwd, "homophones.csv") -# if quick_replace, then when a word is selected and only one homophone exists, -# replace it without bringing up the options -quick_replace = True -show_help = False -######################################################################## - -ctx = Context() -mod = Module() -mod.mode("homophones") -mod.list("homophones_canonicals", desc="list of words ") - - -main_screen = ui.main_screen() - - -def update_homophones(name, flags): - if name != homophones_file: - return - - phones = {} - canonical_list = [] - with open(homophones_file, "r") as f: - for line in f: - words = line.rstrip().split(",") - canonical_list.append(words[0]) - for word in words: - word = word.lower() - old_words = phones.get(word, []) - phones[word] = sorted(set(old_words + words)) - - global all_homophones - all_homophones = phones - ctx.lists["self.homophones_canonicals"] = canonical_list - - -update_homophones(homophones_file, None) -fs.watch(cwd, update_homophones) -active_word_list = None -is_selection = False - - -def close_homophones(): - gui.hide() - actions.mode.disable("user.homophones") - - -def raise_homophones(word, forced=False, selection=False): - global quick_replace - global active_word_list - global show_help - global force_raise - global is_selection - - force_raise = forced - is_selection = selection - - if is_selection: - word = word.strip() - - is_capitalized = word == word.capitalize() - is_upper = word.isupper() - - word = word.lower() - - if word not in all_homophones: - app.notify("homophones.py", '"%s" not in homophones list' % word) - return - - active_word_list = all_homophones[word] - if ( - is_selection - and len(active_word_list) == 2 - and quick_replace - and not force_raise - ): - if word == active_word_list[0].lower(): - new = active_word_list[1] - else: - new = active_word_list[0] - - if is_capitalized: - new = new.capitalize() - elif is_upper: - new = new.upper() - - clip.set(new) - actions.edit.paste() - - return - - actions.mode.enable("user.homophones") - show_help = False - gui.show() - - -@imgui.open(x=main_screen.x + main_screen.width / 2.6, y=main_screen.y) -def gui(gui: imgui.GUI): - global active_word_list - if show_help: - gui.text("Homephone help - todo") - else: - gui.text("Select a homophone") - gui.line() - index = 1 - for word in active_word_list: - gui.text("Choose {}: {} ".format(index, word)) - index = index + 1 - - -def show_help_gui(): - global show_help - show_help = True - gui.show() - - -@mod.capture(rule="{self.homophones_canonicals}") -def homophones_canonical(m) -> str: - "Returns a single string" - return m.homophones_canonicals - - -@mod.action_class -class Actions: - def homophones_hide(): - """Hides the homophones display""" - close_homophones() - - def homophones_show(m: str): - """Sentence formatter""" - print(m) - raise_homophones(m, False, False) - - def homophones_show_selection(): - """Sentence formatter""" - raise_homophones(actions.edit.selected_text(), False, True) - - def homophones_force_show(m: str): - """Sentence formatter""" - raise_homophones(m, True, False) - - def homophones_force_show_selection(): - """Sentence formatter""" - raise_homophones(actions.edit.selected_text(), True, True) - - def homophones_select(number: int) -> str: - """selects the homophone by number""" - if number <= len(active_word_list) and number > 0: - return active_word_list[number - 1] - - error = "homophones.py index {} is out of range (1-{})".format( - number, len(active_word_list) - ) - app.notify(error) - raise error - diff --git a/talon/community/community-cursorless-0.4.0/code/keeper.py b/talon/community/community-cursorless-0.4.0/code/keeper.py deleted file mode 100644 index 8ec548c..0000000 --- a/talon/community/community-cursorless-0.4.0/code/keeper.py +++ /dev/null @@ -1,11 +0,0 @@ -from talon import actions, speech_system - - -def fn(d): - words = d["parsed"]._unmapped - if words[0] == "keeper": - actions.insert(" ".join(words[1:])) - d["parsed"]._sequence = [] - - -speech_system.register("pre:phrase", fn) diff --git a/talon/community/community-cursorless-0.4.0/code/keys.py b/talon/community/community-cursorless-0.4.0/code/keys.py deleted file mode 100644 index baeb3d8..0000000 --- a/talon/community/community-cursorless-0.4.0/code/keys.py +++ /dev/null @@ -1,253 +0,0 @@ -from typing import Set -from user.pokey_talon.code.terms import DELETE - -from talon import Module, Context, actions, app -import sys - -default_alphabet = "air bat cap drum each fine gust harp sit jane crunch look made near odd pit quench red sun trap urge vest whale plex yank zip".split( - " " -) -letters_string = "abcdefghijklmnopqrstuvwxyz" - -default_digits = "zero one two three four five six seven eight nine".split(" ") -numbers = [str(i) for i in range(10)] -default_f_digits = ( - "one two three four five six seven eight nine ten eleven twelve".split(" ") -) - -mod = Module() -mod.list("letter", desc="The spoken phonetic alphabet") -mod.list("symbol_key", desc="All symbols from the keyboard") -mod.list("immune_symbol_key", desc="Symbols that can appear in a formatter") -mod.list("arrow_key", desc="All arrow keys") -mod.list("number_key", desc="All number keys") -mod.list("modifier_key", desc="All modifier keys") -mod.list("function_key", desc="All function keys") -mod.list("special_key", desc="All special keys") -mod.list("punctuation", desc="words for inserting punctuation into text") - - -@mod.capture(rule="{self.modifier_key}+") -def modifiers(m) -> str: - "One or more modifier keys" - return "-".join(m.modifier_key_list) - - -@mod.capture(rule="{self.arrow_key}") -def arrow_key(m) -> str: - "One directional arrow key" - return m.arrow_key - - -@mod.capture(rule="+") -def arrow_keys(m) -> str: - "One or more arrow keys separated by a space" - return str(m) - - -@mod.capture(rule="{self.number_key}") -def number_key(m) -> str: - "One number key" - return m.number_key - - -@mod.capture(rule="{self.letter}") -def letter(m) -> str: - "One letter key" - return m.letter - - -@mod.capture(rule="{self.special_key}") -def special_key(m) -> str: - "One special key" - return m.special_key - - -@mod.capture(rule="{self.symbol_key}") -def symbol_key(m) -> str: - "One symbol key" - return m.symbol_key - - -@mod.capture(rule="{self.immune_symbol_key}") -def immune_symbol_key(m) -> str: - "A symbol key that is allowed to appear within a format string" - return m.immune_symbol_key - - -@mod.capture(rule="{self.function_key}") -def function_key(m) -> str: - "One function key" - return m.function_key - - -@mod.capture(rule="( | | )") -def any_alphanumeric_key(m) -> str: - "any alphanumeric key" - return str(m) - - -@mod.capture( - rule="( | | " - "| | | )" -) -def unmodified_key(m) -> str: - "A single key with no modifiers" - return str(m) - - -@mod.capture(rule="{self.modifier_key}* ") -def key(m) -> str: - "A single key with optional modifiers" - try: - mods = m.modifier_key_list - except AttributeError: - mods = [] - return "-".join(mods + [m.unmodified_key]) - - -@mod.capture(rule="+") -def keys(m) -> str: - "A sequence of one or more keys with optional modifiers" - return " ".join(m.key_list) - - -@mod.capture(rule="{self.letter}+") -def letters(m) -> str: - "Multiple letter keys" - return "".join(m.letter_list) - - -ctx = Context() -modifier_keys = { - # If you find 'alt' is often misrecognized, try using 'alter'. - "alt": "alt", #'alter': 'alt', - "many": "cmd", - "troll": "ctrl", #'troll': 'ctrl', - "option": "alt", - "ship": "shift", #'sky': 'shift', - "super": "super", -} -if app.platform == "mac": - modifier_keys["command"] = "cmd" - modifier_keys["option"] = "alt" -ctx.lists["self.modifier_key"] = modifier_keys -alphabet = dict(zip(default_alphabet, letters_string)) -ctx.lists["self.letter"] = alphabet - -# `punctuation_words` is for words you want available BOTH in dictation and as -# key names in command mode. `symbol_key_words` is for key names that should be -# available in command mode, but NOT during dictation. -punctuation_words = { - # TODO: I'm not sure why we need these, I think it has something to do with - # Dragon. Possibly it has been fixed by later improvements to talon? -rntz - "`": "`", - ",": ",", # <== these things - "back tick": "`", - "comma": ",", - "period": ".", - "semi": ";", - "colon": ":", - "forward slash": "/", - "question mark": "?", - "exclamation mark": "!", - "exclamation point": "!", - "dollar sign": "$", - "asterisk": "*", - "hash sign": "#", - "number sign": "#", - "percent sign": "%", - "at sign": "@", - "and sign": "&", - "ampersand": "&", -} - -immune_symbol_key_words = { - "dot": ".", - "dash": "-", -} - -symbol_key_words = { - "brick": "`", - "stroke": "/", - "backstroke": "\\", - "minus": "-", - "equal": "=", - "plus": "+", - "tilde": "~", - "bang": "!", - "dollar": "$", - "down score": "_", - "question": "?", - "single": "'", - "double": '"', - "leper": "(", - "repper": ")", - "lack": "[", - "rack": "]", - "lace": "{", - "race": "}", - "angle": "<", - "less than": "<", - "wrangle": ">", - "greater than": ">", - "snow": "*", - "pound": "#", - "percy": "%", - "tangle": "^", - "amper": "&", - "pipe": "|", -} - -# make punctuation words also included in {user.symbol_keys} -symbol_key_words.update(punctuation_words) -symbol_key_words.update(immune_symbol_key_words) -ctx.lists["self.punctuation"] = punctuation_words -ctx.lists["self.symbol_key"] = symbol_key_words -ctx.lists["self.immune_symbol_key"] = immune_symbol_key_words -ctx.lists["self.number_key"] = dict(zip(default_digits, numbers)) -ctx.lists["self.arrow_key"] = { - "down": "down", - "left": "left", - "right": "right", - "up": "up", -} - -simple_keys = [ - # "end", - # "home", - # "insert", - "pagedown", - "pageup", - "tab", -] - -alternate_keys = { - "clap": "enter", - "deli": "delete", - "drill": "delete", - "chuck that": "backspace", - "wipe": "backspace", - "scrape": "escape", - "void": "space", - "page up": "pageup", - "page down": "pagedown", -} -# mac apparently doesn't have the menu key. -if app.platform in ("windows", "linux"): - alternate_keys["menu key"] = "menu" - alternate_keys["print screen"] = "printscr" - -keys = {k: k for k in simple_keys} -keys.update(alternate_keys) -ctx.lists["self.special_key"] = keys -ctx.lists["self.function_key"] = { - f"fun {default_f_digits[i]}": f"f{i + 1}" for i in range(12) -} - - -@mod.action_class -class Actions: - def get_alphabet() -> dict: - """Provides the alphabet dictionary""" - return alphabet diff --git a/talon/community/community-cursorless-0.4.0/code/line_commands.py b/talon/community/community-cursorless-0.4.0/code/line_commands.py deleted file mode 100644 index 45d1a49..0000000 --- a/talon/community/community-cursorless-0.4.0/code/line_commands.py +++ /dev/null @@ -1,46 +0,0 @@ -import os -import os.path -import requests -import time -from pathlib import Path -from talon import ctrl, ui, Module, Context, actions, clip -import tempfile - -mod = Module() - -mod.tag( - "line_commands", - desc="Tag for enabling generic line navigation and selection commands", -) - - -@mod.action_class -class Actions: - def extend_until_line(line: int): - """Extends the selection from current line to the specified line""" - - def select_range(line_start: int, line_end: int): - """Selects lines from line_start to line line_end""" - actions.edit.jump_line(line_start) - actions.edit.extend_line_end() - - number_of_lines = line_end - line_start - for i in range(0, number_of_lines): - actions.edit.extend_line_down() - actions.edit.extend_line_end() - - def extend_camel_left(): - """Extends the selection by camel/subword to the left""" - - def extend_camel_right(): - """Extends the selection by camel/subword to the right""" - - def camel_left(): - """Moves cursor to the left by camel case/subword""" - - def camel_right(): - """Move cursor to the right by camel case/subword""" - - def line_clone(line: int): - """Clones specified line at current position""" - diff --git a/talon/community/community-cursorless-0.4.0/code/macro.py b/talon/community/community-cursorless-0.4.0/code/macro.py deleted file mode 100644 index c5ad7a2..0000000 --- a/talon/community/community-cursorless-0.4.0/code/macro.py +++ /dev/null @@ -1,51 +0,0 @@ -from talon import actions, Module, speech_system - -mod = Module() - -macro = [] -recording = False - - -@mod.action_class -class Actions: - def macro_record(): - """record a new macro""" - global macro - global recording - - macro = [] - recording = True - - def macro_stop(): - """stop recording""" - global recording - recording = False - - def macro_insert_wait(number_small: int): - """Insert wait for given number of seconds""" - if not number_small: - actions.sleep("250ms") - else: - actions.sleep(f"{number_small}s") - - def macro_play(): - """player recorded macro""" - actions.user.macro_stop() - - # :-1 because we don't want to replay `macro play` - for words in macro[:-1]: - print(words) - actions.mimic(words) - - -def fn(d): - if not recording: - return - - if "parsed" not in d: - return - - macro.append(d["parsed"]._unmapped) - - -speech_system.register("pre:phrase", fn) diff --git a/talon/community/community-cursorless-0.4.0/code/messaging.py b/talon/community/community-cursorless-0.4.0/code/messaging.py deleted file mode 100644 index a1e34f3..0000000 --- a/talon/community/community-cursorless-0.4.0/code/messaging.py +++ /dev/null @@ -1,42 +0,0 @@ -from talon import Context, actions, ui, Module, app - -mod = Module() -mod.tag("messaging", desc="Tag for generic multi-channel messaging apps") - - -@mod.action_class -class messaging_actions: - # Navigation and UI components - - def messaging_workspace_previous(): - """Move to previous workspace/server""" - - def messaging_workspace_next(): - """Move to next qorkspace/server""" - - def messaging_open_channel_picker(): - """Open channel picker""" - - def messaging_channel_previous(): - """Move to previous channel""" - - def messaging_channel_next(): - """Move to next channel""" - - def messaging_unread_previous(): - """Move to previous unread channel""" - - def messaging_unread_next(): - """Moved to next unread channel""" - - def messaging_open_search(): - """Open message search""" - - def messaging_mark_workspace_read(): - """Mark this workspace/server as read""" - - def messaging_mark_channel_read(): - """Mark this channel as read.""" - - def messaging_upload_file(): - """Upload a file as a message""" diff --git a/talon/community/community-cursorless-0.4.0/code/microphone_selection.py b/talon/community/community-cursorless-0.4.0/code/microphone_selection.py deleted file mode 100644 index bf7b9e5..0000000 --- a/talon/community/community-cursorless-0.4.0/code/microphone_selection.py +++ /dev/null @@ -1,69 +0,0 @@ -from talon import actions -from talon import Module, actions, imgui, scripting, app -from talon.microphone import manager -from talon.lib import cubeb -from talon import scripting - -ctx = cubeb.Context() -mod = Module() - - -def devices_changed(device_type): - update_microphone_list() - - -microphone_device_list = [] - - -def update_microphone_list(): - global microphone_device_list - microphone_device_list = [] - for device in ctx.inputs(): - if str(device.state) == "DeviceState.ENABLED": - microphone_device_list.append(device) - - -@imgui.open() -def gui(gui: imgui.GUI): - gui.text("Select a Microphone") - gui.line() - for index, item in enumerate(microphone_device_list, 1): - if gui.button("{}. {}".format(index, item.name)): - actions.user.microphone_select(index) - - -@mod.action_class -class Actions: - def microphone_selection_toggle(): - """""" - if gui.showing: - gui.hide() - else: - gui.show() - - def microphone_select(index: int): - """Selects a micropohone""" - # print(str(index) + " " + str(len(microphone_device_list))) - if 1 <= index and index <= len(microphone_device_list): - microphone = microphone_device_list[index - 1].name - for item in manager.menu.items: - # print(item.name + " " + microphone) - if microphone in item.name: - # manager.menu_click(item) - actions.speech.set_microphone(item.name) - app.notify("Activating {}".format(item.name)) - - break - - gui.hide() - - -ctx.register("devices_changed", devices_changed) - - -def on_ready(): - update_microphone_list() - - -app.register("ready", on_ready) - diff --git a/talon/community/community-cursorless-0.4.0/code/momentary.py b/talon/community/community-cursorless-0.4.0/code/momentary.py deleted file mode 100644 index 2e53ffa..0000000 --- a/talon/community/community-cursorless-0.4.0/code/momentary.py +++ /dev/null @@ -1,28 +0,0 @@ -from talon import Module, actions, speech_system, scope - -flag = False -def on_phrase_post(j): - global flag - if flag: - flag = False - checked_modes = list(scope.get('mode').intersection({'sleep', 'dictation'})) - # make sure we're in sleep or dictation mode: - if len(checked_modes) == 1: - mode = checked_modes[0] - actions.mode.enable('command') - actions.mode.disable(mode) - try: - # NOTE: the following API is completely private and subject to change with no notice - speech_system._on_audio_frame(j['samples']) - finally: - actions.mode.disable('command') - actions.mode.enable(mode) -speech_system.register('post:phrase', on_phrase_post) - -mod = Module() -@mod.action_class -class Actions: - def momentary(): - """Wake up Talon and re-run the entire current audio""" - global flag - flag = True diff --git a/talon/community/community-cursorless-0.4.0/code/mouse.py b/talon/community/community-cursorless-0.4.0/code/mouse.py deleted file mode 100644 index 7d1af1d..0000000 --- a/talon/community/community-cursorless-0.4.0/code/mouse.py +++ /dev/null @@ -1,373 +0,0 @@ -import os -import pathlib -import subprocess - -from talon import ( - Context, - Module, - actions, - app, - cron, - ctrl, - clip, - imgui, - noise, - settings, - ui, -) -from talon_plugins import eye_mouse, eye_zoom_mouse, speech -from talon_plugins.eye_mouse import config, toggle_camera_overlay, toggle_control - -key = actions.key -self = actions.self -scroll_amount = 0 -click_job = None -scroll_job = None -gaze_job = None -cancel_scroll_on_pop = True - -default_cursor = { - "AppStarting": r"%SystemRoot%\Cursors\aero_working.ani", - "Arrow": r"%SystemRoot%\Cursors\aero_arrow.cur", - "Hand": r"%SystemRoot%\Cursors\aero_link.cur", - "Help": r"%SystemRoot%\Cursors\aero_helpsel.cur", - "No": r"%SystemRoot%\Cursors\aero_unavail.cur", - "NWPen": r"%SystemRoot%\Cursors\aero_pen.cur", - "Person": r"%SystemRoot%\Cursors\aero_person.cur", - "Pin": r"%SystemRoot%\Cursors\aero_pin.cur", - "SizeAll": r"%SystemRoot%\Cursors\aero_move.cur", - "SizeNESW": r"%SystemRoot%\Cursors\aero_nesw.cur", - "SizeNS": r"%SystemRoot%\Cursors\aero_ns.cur", - "SizeNWSE": r"%SystemRoot%\Cursors\aero_nwse.cur", - "SizeWE": r"%SystemRoot%\Cursors\aero_ew.cur", - "UpArrow": r"%SystemRoot%\Cursors\aero_up.cur", - "Wait": r"%SystemRoot%\Cursors\aero_busy.ani", - "Crosshair": "", - "IBeam": "", -} - -# todo figure out why notepad++ still shows the cursor sometimes. -hidden_cursor = os.path.join( - os.path.dirname(os.path.realpath(__file__)), r"Resources\HiddenCursor.cur" -) - -mod = Module() -mod.list( - "mouse_button", desc="List of mouse button words to mouse_click index parameter" -) -setting_mouse_enable_pop_click = mod.setting( - "mouse_enable_pop_click", - type=int, - default=0, - desc="Enable pop to click when control mouse is enabled.", -) -setting_mouse_enable_pop_stops_scroll = mod.setting( - "mouse_enable_pop_stops_scroll", - type=int, - default=0, - desc="When enabled, pop stops continuous scroll modes (wheel upper/downer/gaze)", -) -setting_mouse_wake_hides_cursor = mod.setting( - "mouse_wake_hides_cursor", - type=int, - default=0, - desc="When enabled, mouse wake will hide the cursor. mouse_wake enables zoom mouse.", -) -setting_mouse_hide_mouse_gui = mod.setting( - "mouse_hide_mouse_gui", - type=int, - default=0, - desc="When enabled, the 'Scroll Mouse' GUI will not be shown.", -) -setting_mouse_continuous_scroll_amount = mod.setting( - "mouse_continuous_scroll_amount", - type=int, - default=80, - desc="The default amount used when scrolling continuously", -) -setting_mouse_wheel_down_amount = mod.setting( - "mouse_wheel_down_amount", - type=int, - default=120, - desc="The amount to scroll up/down (equivalent to mouse wheel on Windows by default)", -) - -continuous_scoll_mode = "" - - -@imgui.open(x=700, y=0) -def gui_wheel(gui: imgui.GUI): - gui.text("Scroll mode: {}".format(continuous_scoll_mode)) - gui.line() - if gui.button("Wheel Stop [stop scrolling]"): - actions.user.mouse_scroll_stop() - - -@mod.action_class -class Actions: - def mouse_show_cursor(): - """Shows the cursor""" - show_cursor_helper(True) - - def mouse_hide_cursor(): - """Hides the cursor""" - show_cursor_helper(False) - - def mouse_wake(): - """Enable control mouse, zoom mouse, and disables cursor""" - eye_zoom_mouse.toggle_zoom_mouse(True) - # eye_mouse.control_mouse.enable() - if setting_mouse_wake_hides_cursor.get() >= 1: - show_cursor_helper(False) - - def mouse_calibrate(): - """Start calibration""" - eye_mouse.calib_start() - - def mouse_toggle_control_mouse(): - """Toggles control mouse""" - toggle_control(not config.control_mouse) - - def mouse_toggle_camera_overlay(): - """Toggles camera overlay""" - toggle_camera_overlay(not config.show_camera) - - def mouse_toggle_zoom_mouse(): - """Toggles zoom mouse""" - eye_zoom_mouse.toggle_zoom_mouse(not eye_zoom_mouse.zoom_mouse.enabled) - - def mouse_cancel_zoom_mouse(): - """Cancel zoom mouse if pending""" - if ( - eye_zoom_mouse.zoom_mouse.enabled - and eye_zoom_mouse.zoom_mouse.state != eye_zoom_mouse.STATE_IDLE - ): - eye_zoom_mouse.zoom_mouse.cancel() - - def mouse_trigger_zoom_mouse(): - """Trigger zoom mouse if enabled""" - if eye_zoom_mouse.zoom_mouse.enabled: - eye_zoom_mouse.zoom_mouse.on_pop(eye_zoom_mouse.zoom_mouse.state) - - def mouse_drag(): - """(TEMPORARY) Press and hold/release button 0 depending on state for dragging""" - # todo: fixme temporary fix for drag command - button_down = len(list(ctrl.mouse_buttons_down())) > 0 - print(str(ctrl.mouse_buttons_down())) - if not button_down: - # print("start drag...") - ctrl.mouse_click(button=0, down=True) - # app.notify("drag started") - else: - # print("end drag...") - ctrl.mouse_click(button=0, up=True) - - # app.notify("drag stopped") - - def mouse_sleep(): - """Disables control mouse, zoom mouse, and re-enables cursor""" - eye_zoom_mouse.toggle_zoom_mouse(False) - toggle_control(False) - show_cursor_helper(True) - stop_scroll() - - # todo: fixme temporary fix for drag command - button_down = len(list(ctrl.mouse_buttons_down())) > 0 - if button_down: - ctrl.mouse_click(button=0, up=True) - - def mouse_scroll_down(): - """Scrolls down""" - mouse_scroll(setting_mouse_wheel_down_amount.get())() - - def mouse_scroll_down_continuous(): - """Scrolls down continuously""" - global continuous_scoll_mode - continuous_scoll_mode = "scroll down continuous" - mouse_scroll(setting_mouse_continuous_scroll_amount.get())() - - if scroll_job is None: - start_scroll() - - if setting_mouse_hide_mouse_gui.get() == 0: - gui_wheel.show() - - def mouse_scroll_up(): - """Scrolls up""" - mouse_scroll(-setting_mouse_wheel_down_amount.get())() - - def mouse_scroll_up_continuous(): - """Scrolls up continuously""" - global continuous_scoll_mode - continuous_scoll_mode = "scroll up continuous" - mouse_scroll(-setting_mouse_continuous_scroll_amount.get())() - - if scroll_job is None: - start_scroll() - if setting_mouse_hide_mouse_gui.get() == 0: - gui_wheel.show() - - def mouse_scroll_stop(): - """Stops scrolling""" - stop_scroll() - - def mouse_gaze_scroll(): - """Starts gaze scroll""" - global continuous_scoll_mode - continuous_scoll_mode = "gaze scroll" - start_cursor_scrolling() - if setting_mouse_hide_mouse_gui.get() == 0: - gui_wheel.show() - - def copy_mouse_position(): - """Copy the current mouse position coordinates""" - position = ctrl.mouse_pos() - clip.set_text((repr(position))) - - def mouse_move_center_active_window(): - """move the mouse cursor to the center of the currently active window""" - rect = ui.active_window().rect - ctrl.mouse_move(rect.left + (rect.width / 2), rect.top + (rect.height / 2)) - - -def show_cursor_helper(show): - """Show/hide the cursor""" - if app.platform == "windows": - import ctypes - import winreg - - import win32con - - try: - Registrykey = winreg.OpenKey( - winreg.HKEY_CURRENT_USER, r"Control Panel\Cursors", 0, winreg.KEY_WRITE - ) - - for value_name, value in default_cursor.items(): - if show: - winreg.SetValueEx( - Registrykey, value_name, 0, winreg.REG_EXPAND_SZ, value - ) - else: - winreg.SetValueEx( - Registrykey, value_name, 0, winreg.REG_EXPAND_SZ, hidden_cursor - ) - - winreg.CloseKey(Registrykey) - - ctypes.windll.user32.SystemParametersInfoA( - win32con.SPI_SETCURSORS, 0, None, 0 - ) - - except WindowsError: - print("Unable to show_cursor({})".format(str(show))) - else: - ctrl.cursor_visible(show) - - -def on_pop(active): - pass - # actions.core.repeat_command() - - -noise.register("pop", on_pop) - - -def mouse_scroll(amount): - def scroll(): - global scroll_amount - if (scroll_amount >= 0) == (amount >= 0): - scroll_amount += amount - else: - scroll_amount = amount - actions.mouse_scroll(y=int(amount)) - - return scroll - - -def scroll_continuous_helper(): - global scroll_amount - # print("scroll_continuous_helper") - if scroll_amount and ( - eye_zoom_mouse.zoom_mouse.state == eye_zoom_mouse.STATE_IDLE - ): # or eye_zoom_mouse.zoom_mouse.state == eye_zoom_mouse.STATE_SLEEP): - actions.mouse_scroll(by_lines=False, y=int(scroll_amount / 10)) - - -def start_scroll(): - global scroll_job - scroll_job = cron.interval("60ms", scroll_continuous_helper) - # if eye_zoom_mouse.zoom_mouse.enabled and eye_mouse.mouse.attached_tracker is not None: - # eye_zoom_mouse.zoom_mouse.sleep(True) - - -def gaze_scroll(): - # print("gaze_scroll") - if ( - eye_zoom_mouse.zoom_mouse.state == eye_zoom_mouse.STATE_IDLE - ): # or eye_zoom_mouse.zoom_mouse.state == eye_zoom_mouse.STATE_SLEEP: - x, y = ctrl.mouse_pos() - - # the rect for the window containing the mouse - rect = None - - # on windows, check the active_window first since ui.windows() is not z-ordered - if app.platform == "windows" and ui.active_window().rect.contains(x, y): - rect = ui.active_window().rect - else: - windows = ui.windows() - for w in windows: - if w.rect.contains(x, y): - rect = w.rect - break - - if rect is None: - # print("no window found!") - return - - midpoint = rect.y + rect.height / 2 - amount = int(((y - midpoint) / (rect.height / 10)) ** 3) - actions.mouse_scroll(by_lines=False, y=amount) - - # print(f"gaze_scroll: {midpoint} {rect.height} {amount}") - - -def stop_scroll(): - global scroll_amount, scroll_job, gaze_job - scroll_amount = 0 - if scroll_job: - cron.cancel(scroll_job) - - if gaze_job: - cron.cancel(gaze_job) - - scroll_job = None - gaze_job = None - gui_wheel.hide() - - # if eye_zoom_mouse.zoom_mouse.enabled and eye_mouse.mouse.attached_tracker is not None: - # eye_zoom_mouse.zoom_mouse.sleep(False) - - -def start_cursor_scrolling(): - global scroll_job, gaze_job - stop_scroll() - gaze_job = cron.interval("60ms", gaze_scroll) - # if eye_zoom_mouse.zoom_mouse.enabled and eye_mouse.mouse.attached_tracker is not None: - # eye_zoom_mouse.zoom_mouse.sleep(True) - - -if app.platform == "mac": - from talon import tap - - def on_move(e): - if not config.control_mouse: - buttons = ctrl.mouse_buttons_down() - # print(str(ctrl.mouse_buttons_down())) - if not e.flags & tap.DRAG and buttons: - e.flags |= tap.DRAG - # buttons is a set now - e.button = list(buttons)[0] - e.modify() - - tap.register(tap.MMOVE | tap.HOOK, on_move) diff --git a/talon/community/community-cursorless-0.4.0/code/multiple_cursors.py b/talon/community/community-cursorless-0.4.0/code/multiple_cursors.py deleted file mode 100644 index ce499ac..0000000 --- a/talon/community/community-cursorless-0.4.0/code/multiple_cursors.py +++ /dev/null @@ -1,32 +0,0 @@ -from talon import Context, actions, ui, Module, app - -mod = Module() -mod.tag("multiple_cursors", desc="Tag for enabling generic multiple cursor commands") - - -@mod.action_class -class multiple_cursor_actions: - def multi_cursor_enable(): - """Enables multi-cursor mode""" - - def multi_cursor_disable(): - """Disables multi-cursor mode""" - - def multi_cursor_add_above(): - """Adds cursor to line above""" - - def multi_cursor_add_below(): - """Adds cursor to line below""" - - def multi_cursor_select_fewer_occurrences(): - """Removes selection & cursor at last occurrence""" - - def multi_cursor_select_more_occurrences(): - """Adds cursor at next occurrence of selection""" - - def multi_cursor_select_all_occurrences(): - """Adds cursor at every occurrence of selection""" - - def multi_cursor_add_to_line_ends(): - """Adds cursor at end of every selected line""" - diff --git a/talon/community/community-cursorless-0.4.0/code/numbers.py b/talon/community/community-cursorless-0.4.0/code/numbers.py deleted file mode 100644 index 792df91..0000000 --- a/talon/community/community-cursorless-0.4.0/code/numbers.py +++ /dev/null @@ -1,186 +0,0 @@ -from talon import Context, Module, actions -from typing import List, Optional, Union, Iterator - -mod = Module() -ctx = Context() - -digits = "zero one two three four five six seven eight nine".split() -teens = "eleven twelve thirteen fourteen fifteen sixteen seventeen eighteen nineteen".split() -tens = "ten twenty thirty forty fifty sixty seventy eighty ninety".split() -scales = "hundred thousand million billion trillion quadrillion quintillion sextillion septillion octillion nonillion decillion".split() - -digits_map = {n: i for i, n in enumerate(digits)} -digits_map["oh"] = 0 -teens_map = {n: i + 11 for i, n in enumerate(teens)} -tens_map = {n: 10 * (i + 1) for i, n in enumerate(tens)} -scales_map = {n: 10 ** (3 * (i+1)) for i, n in enumerate(scales[1:])} -scales_map["hundred"] = 100 - -numbers_map = digits_map.copy() -numbers_map.update(teens_map) -numbers_map.update(tens_map) -numbers_map.update(scales_map) - -def parse_number(l: List[str]) -> str: - """Parses a list of words into a number/digit string.""" - l = list(scan_small_numbers(l)) - for scale in scales: - l = parse_scale(scale, l) - return "".join(str(n) for n in l) - -def scan_small_numbers(l: List[str]) -> Iterator[Union[str,int]]: - """ - Takes a list of number words, yields a generator of mixed numbers & strings. - Translates small number terms (<100) into corresponding numbers. - Drops all occurrences of "and". - Smashes digits onto tens words, eg. ["twenty", "one"] -> [21]. - But note that "ten" and "zero" are excluded, ie: - ["ten", "three"] -> [10, 3] - ["fifty", "zero"] -> [50, 0] - Does nothing to scale words ("hundred", "thousand", "million", etc). - """ - # reversed so that repeated pop() visits in left-to-right order - l = [x for x in reversed(l) if x != "and"] - while l: - n = l.pop() - # fuse tens onto digits, eg. "twenty", "one" -> 21 - if n in tens_map and n != "ten" and l and digits_map.get(l[-1], 0) != 0: - d = l.pop() - yield numbers_map[n] + numbers_map[d] - # turn small number terms into corresponding numbers - elif n not in scales_map: - yield numbers_map[n] - else: - yield n - -def parse_scale(scale: str, l: List[Union[str,int]]) -> List[Union[str,int]]: - """Parses a list of mixed numbers & strings for occurrences of the following - pattern: - - - - where is a scale word like "hundred", "thousand", "million", etc and - multiplier and remainder are numbers or strings of numbers of the - appropriate size. For example: - - parse_scale("hundred", [1, "hundred", 2]) -> [102] - parse_scale("thousand", [12, "thousand", 3, 45]) -> [12345] - - We assume that all scales of lower magnitude have already been parsed; don't - call parse_scale("thousand") until you've called parse_scale("hundred"). - """ - scale_value = scales_map[scale] - scale_digits = len(str(scale_value)) - - # Split the list on the desired scale word, then parse from left to right. - left, *splits = split_list(scale, l) - for right in splits: - # (1) Figure out the multiplier by looking to the left of the scale - # word. We ignore non-integers because they are scale words that we - # haven't processed yet; this strategy means that "thousand hundred" - # gets parsed as 1,100 instead of 100,000, but "hundred thousand" is - # parsed correctly as 100,000. - before = 1 # default multiplier - if left and isinstance(left[-1], int) and left[-1] != 0: - before = left.pop() - - # (2) Absorb numbers to the right, eg. in [1, "thousand", 1, 26], "1 - # thousand" absorbs ["1", "26"] to make 1,126. We pull numbers off - # `right` until we fill up the desired number of digits. - after = "" - while right and isinstance(right[0], int): - next = after + str(right[0]) - if len(next) >= scale_digits: break - after = next - right.pop(0) - after = int(after) if after else 0 - - # (3) Push the parsed number into place, append whatever was left - # unparsed, and continue. - left.append(before * scale_value + after) - left.extend(right) - - return left - -def split_list(value, l: list) -> Iterator: - """Splits a list by occurrences of a given value.""" - start = 0 - while True: - try: i = l.index(value, start) - except ValueError: break - yield l[start:i] - start = i+1 - yield l[start:] - - -# # ---------- TESTS (uncomment to run) ---------- -# def test_number(expected, string): -# print('testing:', string) -# l = list(scan_small_numbers(string.split())) -# print(" scan --->", l) -# for scale in scales: -# old = l -# l = parse_scale(scale, l) -# if scale in old: print(" parse -->", l) -# else: assert old == l, "parse_scale should do nothing if the scale does not occur in the list" -# result = "".join(str(n) for n in l) -# assert result == parse_number(string.split()) -# assert str(expected) == result, f"parsing {string!r}, expected {expected}, got {result}" - -# test_number(105000, "one hundred and five thousand") -# test_number(1000000, "one thousand thousand") -# test_number(1501000, "one million five hundred one thousand") -# test_number(1501106, "one million five hundred and one thousand one hundred and six") -# test_number(123, "one two three") -# test_number(123, "one twenty three") -# test_number(104, "ten four") # borderline, but valid in some dialects -# test_number(1066, "ten sixty six") # a common way of saying years -# test_number(1906, "nineteen oh six") # year -# test_number(2001, "twenty oh one") # year -# test_number(2020, "twenty twenty") -# test_number(1001, "one thousand one") -# test_number(1010, "one thousand ten") -# test_number(123456, "one hundred and twenty three thousand and four hundred and fifty six") -# test_number(123456, "one twenty three thousand four fifty six") - -# ## failing (and somewhat debatable) tests from old numbers.py -# #test_number(10000011, "one million one one") -# #test_number(100001010, "one million ten ten") -# #test_number(1050006000, "one hundred thousand and five thousand and six thousand") - - -# ---------- CAPTURES ---------- -alt_digits = "(" + ("|".join(digits_map.keys())) + ")" -alt_teens = "(" + ("|".join(teens_map.keys())) + ")" -alt_tens = "(" + ("|".join(tens_map.keys())) + ")" -alt_scales = "(" + ("|".join(scales_map.keys())) + ")" -number_word = "(" + "|".join(numbers_map.keys()) + ")" - -# TODO: allow things like "double eight" for 88 -@ctx.capture("digit_string", rule=f"({alt_digits} | {alt_teens} | {alt_tens})+") -def digit_string(m) -> str: return parse_number(list(m)) - -@ctx.capture("digits", rule="") -def digits(m) -> int: - """Parses a phrase representing a digit sequence, returning it as an integer.""" - return int(m.digit_string) - -@mod.capture(rule=f"{number_word}+ (and {number_word}+)*") -def number_string(m) -> str: - """Parses a number phrase, returning that number as a string.""" - return parse_number(list(m)) - -@ctx.capture("number", rule="") -def number(m) -> int: - """Parses a number phrase, returning it as an integer.""" - return int(m.number_string) - -@ctx.capture("number_signed", rule=f"[negative|minus] ") -def number_signed(m): - number = m[-1] - return -number if (m[0] in ["negative", "minus"]) else number - -@ctx.capture( - "number_small", rule=f"({alt_digits} | {alt_teens} | {alt_tens} [{alt_digits}])" -) -def number_small(m): return int(parse_number(list(m))) diff --git a/talon/community/community-cursorless-0.4.0/code/ordinals.py b/talon/community/community-cursorless-0.4.0/code/ordinals.py deleted file mode 100644 index f5fb3b9..0000000 --- a/talon/community/community-cursorless-0.4.0/code/ordinals.py +++ /dev/null @@ -1,87 +0,0 @@ -from talon import Context, Module, actions, app, ui - - -def ordinal(n): - """ - Convert an integer into its ordinal representation:: - ordinal(0) => '0th' - ordinal(3) => '3rd' - ordinal(122) => '122nd' - ordinal(213) => '213th' - """ - n = int(n) - suffix = ["th", "st", "nd", "rd", "th"][min(n % 10, 4)] - if 11 <= (n % 100) <= 13: - suffix = "th" - return str(n) + suffix - - -# The primitive ordinal words in English below a hundred. -ordinal_words = { - 0: "zeroth", - 1: "first", - 2: "second", - 3: "third", - 4: "fourth", - 5: "fifth", - 6: "sixth", - 7: "seventh", - 8: "eighth", - 9: "ninth", - 10: "tenth", - 11: "eleventh", - 12: "twelfth", - 13: "thirteenth", - 14: "fourteenth", - 15: "fifteenth", - 16: "sixteenth", - 17: "seventeenth", - 18: "eighteenth", - 19: "nineteenth", - 20: "twentieth", - 30: "thirtieth", - 40: "fortieth", - 50: "fiftieth", - 60: "sixtieth", - 70: "seventieth", - 80: "eightieth", - 90: "ninetieth", -} -tens_words = "zero ten twenty thirty forty fifty sixty seventy eighty ninety".split() - -# ordinal_numbers maps ordinal words into their corresponding numbers. -ordinal_numbers = {} -ordinal_small = {} -for n in range(1, 100): - if n in ordinal_words: - word = ordinal_words[n] - else: - (tens, units) = divmod(n, 10) - assert 1 < tens < 10, "we have already handled all ordinals < 20" - assert 0 < units, "we have already handled all ordinals divisible by ten" - word = f"{tens_words[tens]} {ordinal_words[units]}" - - if n <= 20: - ordinal_small[word] = n - ordinal_numbers[word] = n - - -mod = Module() -ctx = Context() -mod.list("ordinals", desc="list of ordinals") -mod.list("ordinals_small", desc="list of ordinals small (1-20)") - -ctx.lists["self.ordinals"] = ordinal_numbers.keys() -ctx.lists["self.ordinals_small"] = ordinal_small.keys() - - -@mod.capture(rule="{self.ordinals}") -def ordinals(m) -> int: - """Returns a single ordinal as a digit""" - return int(ordinal_numbers[m[0]]) - - -@mod.capture(rule="{self.ordinals_small}") -def ordinals_small(m) -> int: - """Returns a single ordinal as a digit""" - return int(ordinal_numbers[m[0]]) diff --git a/talon/community/community-cursorless-0.4.0/code/parrot.py b/talon/community/community-cursorless-0.4.0/code/parrot.py deleted file mode 100644 index 4643926..0000000 --- a/talon/community/community-cursorless-0.4.0/code/parrot.py +++ /dev/null @@ -1,14 +0,0 @@ -from talon import Module, Context, actions, app - -mod = Module() - - -@mod.action_class -class Actions: - def dental_click(): - """Responds to an alveolar click""" - app.notify("Dental click") - - def postalveolar_click(): - """Responds to an postalveolar click""" - actions.core.repeat_phrase(1) \ No newline at end of file diff --git a/talon/community/community-cursorless-0.4.0/code/phrase_history.py b/talon/community/community-cursorless-0.4.0/code/phrase_history.py deleted file mode 100644 index f06f50d..0000000 --- a/talon/community/community-cursorless-0.4.0/code/phrase_history.py +++ /dev/null @@ -1,60 +0,0 @@ -from talon import Module, actions, imgui -import logging - -mod = Module() - -# list of recent phrases, most recent first -phrase_history = [] -phrase_history_length = 40 -phrase_history_display_length = 40 - -@mod.action_class -class Actions: - def get_last_phrase() -> str: - """Gets the last phrase""" - return phrase_history[0] if phrase_history else "" - - def get_recent_phrase(number: int) -> str: - """Gets the nth most recent phrase""" - try: return phrase_history[number-1] - except IndexError: return "" - - def clear_last_phrase(): - """Clears the last phrase""" - # Currently, this removes the cleared phrase from the phrase history, so - # that repeated calls clear successively earlier phrases, which is often - # useful. But it would be nice if we could do this without removing - # those phrases from the history entirely, so that they were still - # accessible for copying, for example. - if not phrase_history: - logging.warning("clear_last_phrase(): No last phrase to clear!") - return - for _ in phrase_history[0]: - actions.edit.delete() - phrase_history.pop(0) - - def select_last_phrase(): - """Selects the last phrase""" - if not phrase_history: - logging.warning("select_last_phrase(): No last phrase to select!") - return - for _ in phrase_history[0]: - actions.edit.extend_left() - - def add_phrase_to_history(text: str): - """Adds a phrase to the phrase history""" - global phrase_history - phrase_history.insert(0, text) - phrase_history = phrase_history[:phrase_history_length] - - def toggle_phrase_history(): - """Toggles list of recent phrases""" - if gui.showing: gui.hide() - else: gui.show() - -@imgui.open() -def gui(gui: imgui.GUI): - gui.text("Recent phrases") - gui.line() - for index, text in enumerate(phrase_history[:phrase_history_display_length], 1): - gui.text(f"{index}: {text}") diff --git a/talon/community/community-cursorless-0.4.0/code/screenshot.py b/talon/community/community-cursorless-0.4.0/code/screenshot.py deleted file mode 100644 index 09c5f7d..0000000 --- a/talon/community/community-cursorless-0.4.0/code/screenshot.py +++ /dev/null @@ -1,83 +0,0 @@ -from talon import Module, screen, ui, actions, clip, app, settings -from datetime import datetime -import os, subprocess - -active_platform = app.platform -default_command = None -if active_platform == "windows": - - default_folder = os.path.expanduser(os.path.join("~", r"OneDrive\Desktop")) - # this is probably not the correct way to check for onedrive, quick and dirty - if not os.path.isdir(default_folder): - default_folder = os.path.join("~", "Desktop") -elif active_platform == "mac": - default_folder = os.path.join("~", "Desktop") -elif active_platform == "linux": - default_folder = "~" - default_command = "scrot -s" - -mod = Module() -screenshot_folder = mod.setting( - "screenshot_folder", - type=str, - default=default_folder, - desc="Where to save screenshots. Note this folder must exist.", -) -screenshot_selection_command = mod.setting( - "screenshot_selection_command", - type=str, - default=default_command, - desc="Commandline trigger for taking a selection of the screen. By default, only linux uses this.", -) - - -def get_screenshot_path(): - filename = "screenshot-%s.png" % datetime.now().strftime("%Y%m%d%H%M%S") - folder_path = screenshot_folder.get() - path = os.path.expanduser(os.path.join(folder_path, filename)) - return os.path.normpath(path) - - -@mod.action_class -class Actions: - def screenshot(): - """takes a screenshot of the entire screen and saves it to the desktop as screenshot.png""" - img = screen.capture_rect(screen.main_screen().rect) - path = get_screenshot_path() - - img.write_file(path) - app.notify(subtitle="Screenshot: %s" % path) - - def screenshot_window(): - """takes a screenshot of the current window and says it to the desktop as screenshot.png""" - img = screen.capture_rect(ui.active_window().rect) - path = get_screenshot_path() - img.write_file(path) - app.notify(subtitle="Screenshot: %s" % path) - - def screenshot_selection(): - """triggers an application is capable of taking a screenshot of a portion of the screen""" - command = screenshot_selection_command.get() - if command: - path = get_screenshot_path() - command = command.split() - command.append(path) - subprocess.Popen(command) - app.notify(subtitle="Screenshot: %s" % path) - else: - if active_platform == "windows": - actions.key("super-shift-s") - elif active_platform == "mac": - actions.key("ctrl-shift-cmd-4") - # linux is handled by the command by default - # elif active_platform == "linux": - - def screenshot_clipboard(): - """takes a screenshot of the entire screen and saves it to the clipboard""" - img = screen.capture_rect(screen.main_screen().rect) - clip.set_image(img) - - def screenshot_window_clipboard(): - """takes a screenshot of the window and saves it to the clipboard""" - img = screen.capture_rect(ui.active_window().rect) - clip.set_image(img) diff --git a/talon/community/community-cursorless-0.4.0/code/search_engines.py b/talon/community/community-cursorless-0.4.0/code/search_engines.py deleted file mode 100644 index 9e313b3..0000000 --- a/talon/community/community-cursorless-0.4.0/code/search_engines.py +++ /dev/null @@ -1,33 +0,0 @@ -from .user_settings import get_list_from_csv -from talon import Module, Context -from urllib.parse import quote_plus -import webbrowser - -mod = Module() -mod.list( - "search_engine", - desc="A search engine. Any instance of %s will be replaced by query text", -) - -_search_engine_defaults = { - "amazon": "https://www.amazon.com/s/?field-keywords=%s", - "google": "https://www.google.com/search?q=%s", - "map": "https://maps.google.com/maps?q=%s", - "scholar": "https://scholar.google.com/scholar?q=%s", - "wiki": "https://en.wikipedia.org/w/index.php?search=%s", -} - -ctx = Context() -ctx.lists["self.search_engine"] = get_list_from_csv( - "search_engines.csv", - headers=("URL Template", "Name"), - default=_search_engine_defaults, -) - - -@mod.action_class -class Actions: - def search_with_search_engine(search_template: str, search_text: str): - """Search a search engine for given text""" - url = search_template.replace("%s", quote_plus(search_text)) - webbrowser.open(url) \ No newline at end of file diff --git a/talon/community/community-cursorless-0.4.0/code/slow_mode.py b/talon/community/community-cursorless-0.4.0/code/slow_mode.py deleted file mode 100644 index 33c1284..0000000 --- a/talon/community/community-cursorless-0.4.0/code/slow_mode.py +++ /dev/null @@ -1,4 +0,0 @@ -from talon import Module - -mod = Module() -mod.mode("slow") \ No newline at end of file diff --git a/talon/community/community-cursorless-0.4.0/code/snippet_watcher.py b/talon/community/community-cursorless-0.4.0/code/snippet_watcher.py deleted file mode 100644 index 1c9b5e1..0000000 --- a/talon/community/community-cursorless-0.4.0/code/snippet_watcher.py +++ /dev/null @@ -1,95 +0,0 @@ -# from talon import app, fs -# import os, csv, re -# from os.path import isfile, join -# from itertools import islice -# from pathlib import Path -# import json -# from jsoncomment import JsonComment - -# parser = JsonComment(json) - -# pattern = re.compile(r"[A-Z][a-z]*|[a-z]+|\d") - -# # todo: should this be an action that lives elsewhere?? -# def create_spoken_form(text, max_len=15): -# return " ".join(list(islice(pattern.findall(text), max_len))) - - -# class snippet_watcher: -# directories = {} -# snippet_dictionary = {} -# callback_function = None -# file_snippet_cache = {} - -# def __notify(self): -# # print("NOTIFY") -# self.snippet_dictionary = {} -# for key, val in self.file_snippet_cache.items(): -# self.snippet_dictionary.update(val) - -# # print(str(self.snippet_dictionary)) -# if self.callback_function: -# self.callback_function(self.snippet_dictionary) - -# def __update_all_snippets(self): -# for directory, file_list in self.directories.items(): -# if os.path.isdir(directory): -# for f in file_list: -# path = os.path.join(directory, f) -# self.__process_file(path) - -# # print(str(self.snippet_dictionary)) -# self.__notify() - -# def __process_file(self, name): -# path_obj = Path(name) -# directory = os.path.normpath(path_obj.parents[0]) -# file_name = path_obj.name -# file_type = path_obj.suffix -# self.file_snippet_cache[str(path_obj)] = {} - -# print("{}, {}, {}, {}".format(name, directory, file_name, file_type)) -# if directory in self.directories and file_name in self.directories[directory]: -# if file_type.lower() == ".json": -# jsonDict = {} - -# if os.path.isfile(name): -# with open(name, "r") as f: -# jsonDict = parser.load(f) -# # else: -# # print("snippet_watcher.py: File {} does not exist".format(directory)) - -# for key, data in jsonDict.items(): -# self.file_snippet_cache[str(path_obj)][ -# create_spoken_form(key) -# ] = data["prefix"] - -# def __on_fs_change(self, name, flags): -# self.__process_file(name) - -# # print(str(self.snippet_dictionary)) -# self.__notify() - -# def __init__(self, dirs, callback): -# self.directories = dirs -# self.callback_function = callback -# self.snippet_dictionary = {} -# self.file_snippet_cache = {} -# # none = process all directories -# self.__update_all_snippets() - -# for directory in self.directories.keys(): -# if os.path.isdir(directory): -# fs.watch(directory, self.__on_fs_change) -# # else: -# # print( -# # "snippet_watcher.py: directory {} does not exist".format(directory) -# # ) - - -# # Test = snippet_watcher( -# # {os.path.expandvars(r"%AppData%\Code\User\snippets"): ["python.json"]}, -# # None -# # # {os.path.expandvars(r"%USERPROFILE%\.vscode\extensions\ms-dotnettools.csharp-1.22.1\snippets": ["csharp.json"]}, -# # ) -# # print(str(Test.directories)) diff --git a/talon/community/community-cursorless-0.4.0/code/snippets.py b/talon/community/community-cursorless-0.4.0/code/snippets.py deleted file mode 100644 index 966b1d9..0000000 --- a/talon/community/community-cursorless-0.4.0/code/snippets.py +++ /dev/null @@ -1,41 +0,0 @@ -# defines placeholder actions and captures for ide-specific snippet functionality -from talon import Module, actions, app, Context, imgui, registry - -mod = Module() -mod.tag("snippets", desc="Tag for enabling code snippet-related commands") -mod.list("snippets", desc="List of code snippets") - - -@imgui.open() -def gui(gui: imgui.GUI): - gui.text("snippets") - gui.line() - - if "user.snippets" in registry.lists: - function_list = sorted(registry.lists["user.snippets"][0].keys()) - # print(str(registry.lists["user.snippets"])) - - # print(str(registry.lists["user.code_functions"])) - if function_list: - for i, entry in enumerate(function_list): - gui.text("{}".format(entry, function_list)) - - -@mod.action_class -class Actions: - def snippet_search(text: str): - """Triggers the program's snippet search""" - - def snippet_insert(text: str): - """Inserts a snippet""" - - def snippet_create(): - """Triggers snippet creation""" - - def snippet_toggle(): - """Toggles UI for available snippets""" - if gui.showing: - gui.hide() - else: - gui.show() - diff --git a/talon/community/community-cursorless-0.4.0/code/splits.py b/talon/community/community-cursorless-0.4.0/code/splits.py deleted file mode 100644 index ab2b6c6..0000000 --- a/talon/community/community-cursorless-0.4.0/code/splits.py +++ /dev/null @@ -1,46 +0,0 @@ -from talon import Module, actions, app - -mod = Module() -mod.tag("splits", desc="Tag for enabling generic window split commands") - - -@mod.action_class -class Actions: - def split_window_right(): - """Move active tab to right split""" - - def split_window_left(): - """Move active tab to left split""" - - def split_window_down(): - """Move active tab to lower split""" - - def split_window_up(): - """Move active tab to upper split""" - - def split_window_vertically(): - """Splits window vertically""" - - def split_window_horizontally(): - """Splits window horizontally""" - - def split_flip(): - """Flips the orietation of the active split""" - - def split_window(): - """Splits the window""" - - def split_clear(): - """Clears the current split""" - - def split_clear_all(): - """Clears all splits""" - - def split_next(): - """Goes to next split""" - - def split_last(): - """Goes to last split""" - - def split_number(index: int): - """Navigates to a the specified split""" diff --git a/talon/community/community-cursorless-0.4.0/code/sql.py b/talon/community/community-cursorless-0.4.0/code/sql.py deleted file mode 100644 index e69de29..0000000 diff --git a/talon/community/community-cursorless-0.4.0/code/switcher.py b/talon/community/community-cursorless-0.4.0/code/switcher.py deleted file mode 100644 index b137649..0000000 --- a/talon/community/community-cursorless-0.4.0/code/switcher.py +++ /dev/null @@ -1,346 +0,0 @@ -import os -import re -import time - -import talon -from .create_spoken_forms import create_spoken_forms -from talon import Context, Module, app, imgui, ui, fs, actions -from glob import glob -from itertools import islice -from pathlib import Path - -# Construct at startup a list of overides for application names (similar to how homophone list is managed) -# ie for a given talon recognition word set `one note`, recognized this in these switcher functions as `ONENOTE` -# the list is a comma seperated `, ` -# TODO: Consider put list csv's (homophones.csv, app_name_overrides.csv) files together in a seperate directory,`knausj_talon/lists` -cwd = os.path.dirname(os.path.realpath(__file__)) -overrides_directory = os.path.join(cwd, "app_names") -override_file_name = f"app_name_overrides.{talon.app.platform}.csv" -override_file_path = os.path.join(overrides_directory, override_file_name) - -mod = Module() -mod.list("running", desc="all running applications") -mod.list("launch", desc="all launchable applications") -ctx = Context() - -# a list of the current overrides -overrides = {} - -# a list of the currently running application names -running_application_dict = {} - - -mac_application_directories = [ - "/Applications", - "/Applications/Utilities", - "/System/Applications", - "/System/Applications/Utilities", -] - -# windows_application_directories = [ -# "%AppData%/Microsoft/Windows/Start Menu/Programs", -# "%ProgramData%/Microsoft/Windows/Start Menu/Programs", -# "%AppData%/Microsoft/Internet Explorer/Quick Launch/User Pinned/TaskBar", -# ] - -words_to_exclude = [ - "and", - "zero", - "one", - "two", - "three", - "for", - "four", - "five", - "six", - "seven", - "eight", - "nine", - "microsoft", - "windows", - "Windows", -] - -# windows-specific logic -if app.platform == "windows": - import os - import ctypes - import pywintypes - import pythoncom - import winerror - - try: - import winreg - except ImportError: - # Python 2 - import _winreg as winreg - - bytes = lambda x: str(buffer(x)) - - from ctypes import wintypes - from win32com.shell import shell, shellcon - from win32com.propsys import propsys, pscon - - # KNOWNFOLDERID - # https://msdn.microsoft.com/en-us/library/dd378457 - # win32com defines most of these, except the ones added in Windows 8. - FOLDERID_AppsFolder = pywintypes.IID("{1e87508d-89c2-42f0-8a7e-645a0f50ca58}") - - # win32com is missing SHGetKnownFolderIDList, so use ctypes. - - _ole32 = ctypes.OleDLL("ole32") - _shell32 = ctypes.OleDLL("shell32") - - _REFKNOWNFOLDERID = ctypes.c_char_p - _PPITEMIDLIST = ctypes.POINTER(ctypes.c_void_p) - - _ole32.CoTaskMemFree.restype = None - _ole32.CoTaskMemFree.argtypes = (wintypes.LPVOID,) - - _shell32.SHGetKnownFolderIDList.argtypes = ( - _REFKNOWNFOLDERID, # rfid - wintypes.DWORD, # dwFlags - wintypes.HANDLE, # hToken - _PPITEMIDLIST, - ) # ppidl - - def get_known_folder_id_list(folder_id, htoken=None): - if isinstance(folder_id, pywintypes.IIDType): - folder_id = bytes(folder_id) - pidl = ctypes.c_void_p() - try: - _shell32.SHGetKnownFolderIDList(folder_id, 0, htoken, ctypes.byref(pidl)) - return shell.AddressAsPIDL(pidl.value) - except WindowsError as e: - if e.winerror & 0x80070000 == 0x80070000: - # It's a WinAPI error, so re-raise it, letting Python - # raise a specific exception such as FileNotFoundError. - raise ctypes.WinError(e.winerror & 0x0000FFFF) - raise - finally: - if pidl: - _ole32.CoTaskMemFree(pidl) - - def enum_known_folder(folder_id, htoken=None): - id_list = get_known_folder_id_list(folder_id, htoken) - folder_shell_item = shell.SHCreateShellItem(None, None, id_list) - items_enum = folder_shell_item.BindToHandler( - None, shell.BHID_EnumItems, shell.IID_IEnumShellItems - ) - result = [] - for item in items_enum: - # print(item.GetDisplayName(shellcon.SIGDN_NORMALDISPLAY)) - result.append(item.GetDisplayName(shellcon.SIGDN_NORMALDISPLAY)) - - return result - - def list_known_folder(folder_id, htoken=None): - result = [] - for item in enum_known_folder(folder_id, htoken): - result.append(item.GetDisplayName(shellcon.SIGDN_NORMALDISPLAY)) - result.sort(key=lambda x: x.upper()) - return result - - -@mod.capture(rule="{self.running}") # | )") -def running_applications(m) -> str: - "Returns a single application name" - try: - return m.running - except AttributeError: - return m.text - - -@mod.capture(rule="{self.launch}") -def launch_applications(m) -> str: - "Returns a single application name" - return m.launch - - -def update_lists(): - global running_application_dict - running_application_dict = {} - running = {} - for cur_app in ui.apps(background=False): - name = cur_app.name - - spoken_forms = create_spoken_forms(name, words_to_exclude=words_to_exclude) - for spoken_form in spoken_forms: - if spoken_form not in running: - running[spoken_form] = cur_app.name - - running_application_dict[cur_app.name] = True - print(running) - - for override in overrides: - running[override] = overrides[override] - - lists = { - "self.running": running, - # "self.launch": launch, - } - - # batch update lists - ctx.lists.update(lists) - - -def update_overrides(name, flags): - """Updates the overrides list""" - global overrides - overrides = {} - - if name is None or name == override_file_path: - # print("update_overrides") - with open(override_file_path, "r") as f: - for line in f: - line = line.rstrip() - line = line.split(",") - if len(line) == 2: - overrides[line[0].lower()] = line[1].strip() - - update_lists() - - -@mod.action_class -class Actions: - def get_running_app(name: str) -> ui.App: - """Get the first available running app with `name`.""" - # We should use the capture result directly if it's already in the list - # of running applications. Otherwise, name is from and we - # can be a bit fuzzier - if name not in running_application_dict: - if len(name) < 3: - raise RuntimeError( - f'Skipped getting app: "{name}" has less than 3 chars.' - ) - for running_name, full_application_name in ctx.lists[ - "self.running" - ].items(): - if running_name == name or running_name.lower().startswith( - name.lower() - ): - name = full_application_name - break - for app in ui.apps(): - if app.name == name and not app.background: - return app - raise RuntimeError(f'App not running: "{name}"') - - def switcher_focus(name: str): - """Focus a new application by name""" - app = actions.user.get_running_app(name) - app.focus() - - # Hacky solution to do this reliably on Mac. - timeout = 5 - t1 = time.monotonic() - if talon.app.platform == "mac": - while ui.active_app() != app and time.monotonic() - t1 < timeout: - time.sleep(0.1) - - def switcher_launch(path: str): - """Launch a new application by path""" - if app.platform == "windows": - is_valid_path = False - try: - current_path = Path(path) - is_valid_path = current_path.is_file() - # print("valid path: {}".format(is_valid_path)) - - except: - # print("invalid path") - is_valid_path = False - - if is_valid_path: - # print("path: " + path) - ui.launch(path=path) - - else: - # print("envelop") - actions.key("super-s") - actions.sleep("300ms") - actions.insert("apps: {}".format(path)) - actions.sleep("150ms") - actions.key("enter") - - else: - ui.launch(path=path) - - def switcher_toggle_running(): - """Shows/hides all running applications""" - if gui.showing: - gui.hide() - else: - gui.show() - - def switcher_hide_running(): - """Hides list of running applications""" - gui.hide() - - -@imgui.open() -def gui(gui: imgui.GUI): - gui.text("Names of running applications") - gui.line() - for line in ctx.lists["self.running"]: - gui.text(line) - - -def update_launch_list(): - launch = {} - if app.platform == "mac": - for base in mac_application_directories: - if os.path.isdir(base): - for name in os.listdir(base): - path = os.path.join(base, name) - name = name.rsplit(".", 1)[0].lower() - launch[name] = path - words = name.split(" ") - for word in words: - if word and word not in launch: - if len(name) > 6 and len(word) < 3: - continue - launch[word] = path - - elif app.platform == "windows": - shortcuts = enum_known_folder(FOLDERID_AppsFolder) - # str(shortcuts) - for name in shortcuts: - # print("hit: " + name) - # print(name) - # name = path.rsplit("\\")[-1].split(".")[0].lower() - if "install" not in name: - spoken_form = create_spoken_forms(name) - # print(spoken_form) - launch[spoken_form] = name - words = spoken_form.split(" ") - for word in words: - if word not in words_to_exclude and word not in launch: - if len(name) > 6 and len(word) < 3: - continue - launch[word] = name - - ctx.lists["self.launch"] = launch - - -def ui_event(event, arg): - if event in ("app_launch", "app_close"): - update_lists() - - -# Currently update_launch_list only does anything on mac, so we should make sure -# to initialize user launch to avoid getting "List not found: user.launch" -# errors on other platforms. -ctx.lists["user.launch"] = {} -ctx.lists["user.running"] = {} - -# Talon starts faster if you don't use the `talon.ui` module during launch -def on_ready(): - update_overrides(None, None) - fs.watch(overrides_directory, update_overrides) - update_launch_list() - ui.register("", ui_event) - - -# NOTE: please update this from "launch" to "ready" in Talon v0.1.5 -app.register("ready", on_ready) diff --git a/talon/community/community-cursorless-0.4.0/code/tabs.py b/talon/community/community-cursorless-0.4.0/code/tabs.py deleted file mode 100644 index 546829f..0000000 --- a/talon/community/community-cursorless-0.4.0/code/tabs.py +++ /dev/null @@ -1,11 +0,0 @@ -from talon import Context, actions, ui, Module, app - -mod = Module() - -@mod.action_class -class tab_actions: - def tab_jump(number: int): - """Jumps to the specified tab""" - - def tab_final(): - """Jumps to the final tab""" diff --git a/talon/community/community-cursorless-0.4.0/code/tags.py b/talon/community/community-cursorless-0.4.0/code/tags.py deleted file mode 100644 index f9e44a7..0000000 --- a/talon/community/community-cursorless-0.4.0/code/tags.py +++ /dev/null @@ -1,17 +0,0 @@ -from talon import Context, Module - -mod = Module() - -tagList = [ - "debugger", - "disassembler", - "gdb", - "git", # commandline tag for git commands - "ida", - "tabs", - "taskwarrior", # commandline tag for taskwarrior commands - "tmux", - "windbg", -] -for entry in tagList: - mod.tag(entry, f"tag to load {entry} and/or related plugins ") diff --git a/talon/community/community-cursorless-0.4.0/code/talon_helpers.py b/talon/community/community-cursorless-0.4.0/code/talon_helpers.py deleted file mode 100644 index e8d3e30..0000000 --- a/talon/community/community-cursorless-0.4.0/code/talon_helpers.py +++ /dev/null @@ -1,55 +0,0 @@ -from talon import Context, actions, ui, Module, app, clip -import os -import re -from itertools import islice - - -mod = Module() -pattern = re.compile(r"[A-Z][a-z]*|[a-z]+|\d") - -# todo: should this be an action that lives elsewhere?? -def create_name(text, max_len=20): - return "_".join(list(islice(pattern.findall(text), max_len))).lower() - - -@mod.action_class -class Actions: - def talon_add_context_clipboard_python(): - """Adds os-specific context info to the clipboard for the focused app for .py files. Assumes you've a Module named mod declared.""" - friendly_name = actions.app.name() - # print(actions.app.executable()) - executable = actions.app.executable().split(os.path.sep)[-1] - app_name = create_name(friendly_name.replace(".exe", "")) - if app.platform == "mac": - result = 'mod.apps.{} = """\nos: {}\nand app.bundle: {}\n"""'.format( - app_name, app.platform, actions.app.bundle() - ) - elif app.platform == "windows": - result = 'mod.apps.{} = """\nos: windows\nand app.name: {}\nos: windows\nand app.exe: {}\n"""'.format( - app_name, friendly_name, executable - ) - else: - result = 'mod.apps.{} = """\nos: {}\nand app.name: {}\n"""'.format( - app_name, app.platform, friendly_name - ) - - clip.set_text(result) - - def talon_add_context_clipboard(): - """Adds os-specific context info to the clipboard for the focused app for .talon files""" - friendly_name = actions.app.name() - # print(actions.app.executable()) - executable = actions.app.executable().split(os.path.sep)[-1] - if app.platform == "mac": - result = "os: {}\nand app.bundle: {}\n".format( - app.platform, actions.app.bundle() - ) - elif app.platform == "windows": - result = "os: windows\nand app.name: {}\nos: windows\nand app.exe: {}\n".format( - friendly_name, executable - ) - else: - result = "os: {}\nand app.name: {}\n".format(app.platform, friendly_name) - - clip.set_text(result) - diff --git a/talon/community/community-cursorless-0.4.0/code/terms.py b/talon/community/community-cursorless-0.4.0/code/terms.py deleted file mode 100644 index e5e5d7c..0000000 --- a/talon/community/community-cursorless-0.4.0/code/terms.py +++ /dev/null @@ -1,42 +0,0 @@ -""" -Stores terms that are used in many different places -""" -from talon import Module - -mod = Module() - -SELECT = "take" -TELEPORT = "pop" -OPERATOR = "do" -DELETE = "chuck" -FIND = "scout" - - -@mod.capture(rule=SELECT) -def select(m) -> str: - """Term for select""" - return str(m) - - -@mod.capture(rule=TELEPORT) -def teleport(m) -> str: - """Verb to use for commands that teleport the cursor to another place""" - return str(m) - - -@mod.capture(rule=OPERATOR) -def operator(m) -> str: - """Prefix for operators""" - return str(m) - - -@mod.capture(rule=DELETE) -def delete(m) -> str: - """Verb to use for commands that delete things""" - return str(m) - - -@mod.capture(rule=FIND) -def find(m) -> str: - """Verb to use for commands that find things""" - return str(m) \ No newline at end of file diff --git a/talon/community/community-cursorless-0.4.0/code/todo_list.py b/talon/community/community-cursorless-0.4.0/code/todo_list.py deleted file mode 100644 index 5e8e221..0000000 --- a/talon/community/community-cursorless-0.4.0/code/todo_list.py +++ /dev/null @@ -1,39 +0,0 @@ -from talon import Context, actions, ui, Module, app - -mod = Module() -mod.tag("todo_list", desc="Tag for enabling generic todo list commands") - - -@mod.action_class -class Actions: - def mark_complete(): - """Mark a todo as completed""" - pass - - def mark_cancelled(): - """Mark a todo as cancelled""" - pass - - def show_today(): - """Show today""" - pass - - def show_inbox(): - """Show inbox""" - pass - - def show_upcoming(): - """Show upcoming""" - pass - - def show_anytime(): - """Show anytime""" - pass - - def show_someday(): - """Show someday""" - pass - - def show_logbook(): - """Show logbook""" - pass diff --git a/talon/community/community-cursorless-0.4.0/code/user_settings.py b/talon/community/community-cursorless-0.4.0/code/user_settings.py deleted file mode 100644 index 55b34a3..0000000 --- a/talon/community/community-cursorless-0.4.0/code/user_settings.py +++ /dev/null @@ -1,60 +0,0 @@ -import csv -import os -from pathlib import Path -from typing import Dict, List, Tuple -from talon import resource - -# NOTE: This method requires this module to be one folder below the top-level -# knausj folder. -SETTINGS_DIR = Path(__file__).parents[1] / "settings" - -if not SETTINGS_DIR.is_dir(): - os.mkdir(SETTINGS_DIR) - - -def get_list_from_csv( - filename: str, headers: Tuple[str, str], default: Dict[str, str] = {} -): - """Retrieves list from CSV""" - path = SETTINGS_DIR / filename - assert filename.endswith(".csv") - - if not path.is_file(): - with open(path, "w", encoding="utf-8") as file: - writer = csv.writer(file) - writer.writerow(headers) - for key, value in default.items(): - writer.writerow([key] if key == value else [value, key]) - - # Now read via resource to take advantage of talon's - # ability to reload this script for us when the resource changes - with resource.open(str(path), "r") as f: - rows = list(csv.reader(f)) - - # print(str(rows)) - mapping = {} - if len(rows) >= 2: - actual_headers = rows[0] - if not actual_headers == list(headers): - print( - f'"{filename}": Malformed headers - {actual_headers}.' - + f" Should be {list(headers)}. Ignoring row." - ) - for row in rows[1:]: - if len(row) == 0: - # Windows newlines are sometimes read as empty rows. :champagne: - continue - if len(row) == 1: - output = spoken_form = row[0] - else: - output, spoken_form = row[:2] - if len(row) > 2: - print( - f'"{filename}": More than two values in row: {row}.' - + " Ignoring the extras." - ) - # Leading/trailing whitespace in spoken form can prevent recognition. - spoken_form = spoken_form.strip() - mapping[spoken_form] = output - - return mapping diff --git a/talon/community/community-cursorless-0.4.0/code/vocabulary.py b/talon/community/community-cursorless-0.4.0/code/vocabulary.py deleted file mode 100644 index cd94e5a..0000000 --- a/talon/community/community-cursorless-0.4.0/code/vocabulary.py +++ /dev/null @@ -1,90 +0,0 @@ -from talon import Context, Module -from .user_settings import get_list_from_csv - -mod = Module() -ctx = Context() - -mod.list("vocabulary", desc="additional vocabulary words") - - -# Default words that will need to be capitalized (particularly under w2l). -# NB. These defaults and those later in this file are ONLY used when -# auto-creating the corresponding settings/*.csv files. Those csv files -# determine the contents of user.vocabulary and dictate.word_map. Once they -# exist, the contents of the lists/dictionaries below are irrelevant. -_capitalize_defaults = [ - "I", - "I'm", - "I've", - "I'll", - "I'd", - "Monday", - "Mondays", - "Tuesday", - "Tuesdays", - "Wednesday", - "Wednesdays", - "Thursday", - "Thursdays", - "Friday", - "Fridays", - "Saturday", - "Saturdays", - "Sunday", - "Sundays", - "January", - "February", - # March omitted because it's a regular word too - "April", - # May omitted because it's a regular word too - "June", - "July", - "August", - "September", - "October", - "November", - "December", -] - -# Default words that need to be remapped. -_word_map_defaults = { - # E.g: - # "cash": "cache", -} -_word_map_defaults.update({word.lower(): word for word in _capitalize_defaults}) - - -# "dictate.word_map" is used by `actions.dictate.replace_words` to rewrite words -# Talon recognized. Entries in word_map don't change the priority with which -# Talon recognizes some words over others. - -ctx.settings["dictate.word_map"] = get_list_from_csv( - "words_to_replace.csv", - headers=("Replacement", "Original"), - default=_word_map_defaults, -) - - -# Default words that should be added to Talon's vocabulary. -_simple_vocab_default = ["nmap", "admin", "Cisco", "Citrix", "VPN", "DNS", "Minecraft"] - -# Defaults for different pronounciations of words that need to be added to -# Talon's vocabulary. -_default_vocabulary = { - "N map": "nmap", - "under documented": "under-documented", -} -_default_vocabulary.update({word: word for word in _simple_vocab_default}) - -# "user.vocabulary" is used to explicitly add words/phrases that Talon doesn't -# recognize. Words in user.vocabulary (or other lists and captures) are -# "command-like" and their recognition is prioritized over ordinary words. -ctx.lists["user.vocabulary"] = get_list_from_csv( - "additional_words.csv", - headers=("Word(s)", "Spoken Form (If Different)"), - default=_default_vocabulary, -) - -# for quick verification of the reload -# print(str(ctx.settings["dictate.word_map"])) -# print(str(ctx.lists["user.vocabulary"])) diff --git a/talon/community/community-cursorless-0.4.0/code/window_snap.py b/talon/community/community-cursorless-0.4.0/code/window_snap.py deleted file mode 100644 index b7ade5a..0000000 --- a/talon/community/community-cursorless-0.4.0/code/window_snap.py +++ /dev/null @@ -1,221 +0,0 @@ -"""Tools for voice-driven window management. - -Originally from dweil/talon_community - modified for newapi by jcaw. - -""" - -# TODO: Map keyboard shortcuts to this manager once Talon has key hooks on all -# platforms - -import time -from operator import xor -from typing import Optional - -from talon import ui, Module, Context, actions - - -def sorted_screens(): - """Return screens sorted by their topmost, then leftmost, edge. - - Screens will be sorted left-to-right, then top-to-bottom as a tiebreak. - - """ - - return sorted( - sorted(ui.screens(), key=lambda screen: screen.visible_rect.top), - key=lambda screen: screen.visible_rect.left, - ) - - -def _set_window_pos(window, x, y, width, height): - """Helper to set the window position.""" - # TODO: Special case for full screen move - use os-native maximize, rather - # than setting the position? - - # 2020/10/01: While the upstream Talon implementation for MS Windows is - # settling, this may be buggy on full screen windows. Aegis doesn't want a - # hacky solution merged, so for now just repeat the command. - # - # TODO: Audit once upstream Talon is bug-free on MS Windows - window.rect = ui.Rect(round(x), round(y), round(width), round(height)) - - -def _bring_forward(window): - current_window = ui.active_window() - try: - window.focus() - current_window.focus() - except Exception as e: - # We don't want to block if this fails. - print(f"Couldn't bring window to front: {e}") - - -def _get_app_window(app_name: str) -> ui.Window: - return actions.self.get_running_app(app_name).active_window - - -def _move_to_screen( - window, offset: Optional[int] = None, screen_number: Optional[int] = None -): - """Move a window to a different screen. - - Provide one of `offset` or `screen_number` to specify a target screen. - - Provide `window` to move a specific window, otherwise the current window is - moved. - - """ - assert ( - screen_number or offset and not (screen_number and offset) - ), "Provide exactly one of `screen_number` or `offset`." - - src_screen = window.screen - screens = sorted_screens() - if offset: - screen_number = (screens.index(src_screen) + offset) % len(screens) - else: - # Human to array index - screen_number -= 1 - - dest_screen = screens[screen_number] - if src_screen == dest_screen: - return - - # Retain the same proportional position on the new screen. - dest = dest_screen.visible_rect - src = src_screen.visible_rect - # TODO: Test this on different-sized screens - # - # TODO: Is this the best behaviour for moving to a vertical screen? Probably - # not. - proportional_width = dest.width / src.width - proportional_height = dest.height / src.height - _set_window_pos( - window, - x=dest.left + (window.rect.left - src.left) * proportional_width, - y=dest.top + (window.rect.top - src.top) * proportional_height, - width=window.rect.width * proportional_width, - height=window.rect.height * proportional_height, - ) - - -def _snap_window_helper(window, pos): - screen = window.screen.visible_rect - - _set_window_pos( - window, - x=screen.x + (screen.width * pos.left), - y=screen.y + (screen.height * pos.top), - width=screen.width * (pos.right - pos.left), - height=screen.height * (pos.bottom - pos.top), - ) - - -class RelativeScreenPos(object): - """Represents a window position as a fraction of the screen.""" - - def __init__(self, left, top, right, bottom): - self.left = left - self.top = top - self.bottom = bottom - self.right = right - - -mod = Module() -mod.list( - "window_snap_positions", - "Predefined window positions for the current window. See `RelativeScreenPos`.", -) - - -_snap_positions = { - # Halves - # .---.---. .-------. - # | | | & |-------| - # '---'---' '-------' - "left": RelativeScreenPos(0, 0, 0.5, 1), - "right": RelativeScreenPos(0.5, 0, 1, 1), - "top": RelativeScreenPos(0, 0, 1, 0.5), - "bottom": RelativeScreenPos(0, 0.5, 1, 1), - # Thirds - # .--.--.--. - # | | | | - # '--'--'--' - "center third": RelativeScreenPos(1 / 3, 0, 2 / 3, 1), - "left third": RelativeScreenPos(0, 0, 1 / 3, 1), - "right third": RelativeScreenPos(2 / 3, 0, 1, 1), - "left two thirds": RelativeScreenPos(0, 0, 2 / 3, 1), - "right two thirds": RelativeScreenPos(1 / 3, 0, 1, 1,), - # Quarters - # .---.---. - # |---|---| - # '---'---' - "top left": RelativeScreenPos(0, 0, 0.5, 0.5), - "top right": RelativeScreenPos(0.5, 0, 1, 0.5), - "bottom left": RelativeScreenPos(0, 0.5, 0.5, 1), - "bottom right": RelativeScreenPos(0.5, 0.5, 1, 1), - # Sixths - # .--.--.--. - # |--|--|--| - # '--'--'--' - "top right third": RelativeScreenPos(2 / 3, 0, 1, 0.5), - "top left two thirds": RelativeScreenPos(0, 0, 2 / 3, 0.5), - "top right two thirds": RelativeScreenPos(1 / 3, 0, 1, 0.5), - "top center third": RelativeScreenPos(1 / 3, 0, 2 / 3, 0.5), - "bottom left third": RelativeScreenPos(0, 0.5, 1 / 3, 1), - "bottom right third": RelativeScreenPos(2 / 3, 0.5, 1, 1), - "bottom left two thirds": RelativeScreenPos(0, 0.5, 2 / 3, 1), - "bottom right two thirds": RelativeScreenPos(1 / 3, 0.5, 1, 1), - "bottom center third": RelativeScreenPos(1 / 3, 0.5, 2 / 3, 1), - # Special - "center": RelativeScreenPos(1 / 8, 1 / 6, 7 / 8, 5 / 6), - "full": RelativeScreenPos(0, 0, 1, 1), - "fullscreen": RelativeScreenPos(0, 0, 1, 1), -} - - -@mod.capture(rule="{user.window_snap_positions}") -def window_snap_position(m) -> RelativeScreenPos: - return _snap_positions[m.window_snap_positions] - - -ctx = Context() -ctx.lists["user.window_snap_positions"] = _snap_positions.keys() - - -@mod.action_class -class Actions: - def snap_window(pos: RelativeScreenPos) -> None: - """Move the active window to a specific position on-screen. - - See `RelativeScreenPos` for the structure of this position. - - """ - _snap_window_helper(ui.active_window(), pos) - - def move_window_next_screen() -> None: - """Move the active window to a specific screen.""" - _move_to_screen(ui.active_window(), offset=1) - - def move_window_previous_screen() -> None: - """Move the active window to the previous screen.""" - _move_to_screen(ui.active_window(), offset=-1) - - def move_window_to_screen(screen_number: int) -> None: - """Move the active window leftward by one.""" - _move_to_screen(ui.active_window(), screen_number=screen_number) - - def snap_app(app_name: str, pos: RelativeScreenPos): - """Snap a specific application to another screen.""" - window = _get_app_window(app_name) - _bring_forward(window) - _snap_window_helper(window, pos) - - def move_app_to_screen(app_name: str, screen_number: int): - """Move a specific application to another screen.""" - window = _get_app_window(app_name) - print(window) - _bring_forward(window) - _move_to_screen( - window, screen_number=screen_number, - ) diff --git a/talon/community/community-cursorless-0.4.0/eye_tracking_settings.py b/talon/community/community-cursorless-0.4.0/eye_tracking_settings.py deleted file mode 100644 index d24369a..0000000 --- a/talon/community/community-cursorless-0.4.0/eye_tracking_settings.py +++ /dev/null @@ -1,11 +0,0 @@ -# from talon import app -# from talon.track.geom import Point2d -# from talon_plugins import speech, eye_mouse, eye_zoom_mouse - -# if app.platform == "mac": -# eye_zoom_mouse.config.screen_area = Point2d(100, 75) -# eye_zoom_mouse.config.img_scale = 6 -# elif app.platform == "windows": -# eye_zoom_mouse.config.screen_area = Point2d(200, 150) -# eye_zoom_mouse.config.img_scale = 4.5 - diff --git a/talon/community/community-cursorless-0.4.0/lang/batch.talon b/talon/community/community-cursorless-0.4.0/lang/batch.talon deleted file mode 100644 index 84550bc..0000000 --- a/talon/community/community-cursorless-0.4.0/lang/batch.talon +++ /dev/null @@ -1,23 +0,0 @@ -mode: user.batch -mode: command -and code.language: batch -- -#tag(): user.code_operators -tag(): user.code_comment -#tag(): user.code_generic - - -action(user.code_comment): "REM " - -# exit without killing cmd shell -soft exit: "exit /B 1\n" -# exit with killing cmd shell -hard exit: "exit 1\n" -echo: "echo " -echo off: "@echo off\n" -call: "call " -call shell: "call cmd \\c " -if error: "if errorlevel 1 " -go to: "goto " -delayed expansion: "SETLOCAL EnableDelayedExpansion\n" -arg : "%{number_small}" diff --git a/talon/community/community-cursorless-0.4.0/lang/block_comment.talon b/talon/community/community-cursorless-0.4.0/lang/block_comment.talon deleted file mode 100644 index 128f2bd..0000000 --- a/talon/community/community-cursorless-0.4.0/lang/block_comment.talon +++ /dev/null @@ -1,51 +0,0 @@ -tag: user.code_block_comment -- -block comment: user.code_block_comment() -block comment line: - #todo: this should probably be a single function once - #.talon supports implementing actions with parameters? - edit.line_start() - user.code_block_comment_prefix() - key(space) - edit.line_end() - key(space) - user.code_block_comment_suffix() -#adds comment to the start of the line -block comment line over: - #todo: this should probably be a single function once - #.talon supports implementing actions with parameters? - edit.line_start() - user.code_block_comment() - insert(user.text) -block comment over: - #todo: this should probably be a single function once - #.talon supports implementing actions with parameters? - user.code_block_comment() - insert(user.text) -block comment $: - #todo: this should probably be a single function once - #.talon supports implementing actions with parameters? - user.code_block_comment() - insert(user.text) -(line | inline) block comment over: - #todo: this should probably be a single function once - #.talon supports implementing actions with parameters? - edit.line_end() - user.code_block_comment_prefix() - key(space) - insert(user.text) - key(space) - user.code_block_comment_suffix() -(line | inline) block comment $: - #todo: this should probably be a single function once - #.talon supports implementing actions with parameters? - edit.line_end() - user.code_block_comment_prefix() - key(space) - insert(user.text) - key(space) - user.code_block_comment_suffix() -open block comment: - user.code_block_comment_prefix() -close block comment: - user.code_block_comment_suffix() diff --git a/talon/community/community-cursorless-0.4.0/lang/c/c.py b/talon/community/community-cursorless-0.4.0/lang/c/c.py deleted file mode 100644 index 5a86301..0000000 --- a/talon/community/community-cursorless-0.4.0/lang/c/c.py +++ /dev/null @@ -1,236 +0,0 @@ -from talon import Context, Module, actions, settings - -mod = Module() -mod.setting( - "use_stdint_datatypes ", - type=int, - default=1, - desc="Use the stdint datatype naming in commands by default", -) - -ctx = Context() -ctx.matches = r""" -mode: user.c -mode: command -and code.language: c -""" - -ctx.lists["self.c_pointers"] = { - "pointer": "*", - "pointer to pointer": "**", -} - -ctx.lists["self.stdint_signed"] = { - "signed": "", - "unsigned": "u", -} - -ctx.lists["self.c_signed"] = { - "signed": "signed ", - "unsigned": "unsigned ", -} - -common_types = { - "static": "static", - "volatile": "volatile", - "register": "register", -} - -ctx.lists["self.stdint_types"] = { - "character": "int8_t", - "char": "int8_t", - "short": "int16_t", - "long": "int32_t", - "long long": "int64_t", - "int": "int32_t", - "integer": "int32_t", - "void": "void", - "double": "double", - "struct": "struct", - "struck": "struct", - "num": "enum", - "union": "union", - "float": "float", -} - -ctx.lists["self.c_types"] = { - "character": "char", - "char": "char", - "short": "short", - "long": "long", - "int": "int", - "integer": "int", - "void": "void", - "double": "double", - "struct": "struct", - "struck": "struct", - "num": "enum", - "union": "union", - "float": "float", -} - -ctx.lists["user.code_libraries"] = { - "assert": "assert.h", - "type": "ctype.h", - "error": "errno.h", - "float": "float.h", - "limits": "limits.h", - "locale": "locale.h", - "math": "math.h", - "set jump": "setjmp.h", - "signal": "signal.h", - "arguments": "stdarg.h", - "definition": "stddef.h", - "input": "stdio.h", - "output": "stdio.h", - "library": "stdlib.h", - "string": "string.h", - "time": "time.h", - "standard int": "stdint.h", -} - -ctx.lists["user.code_functions"] = { - "mem copy": "memcpy", - "mem set": "memset", - "string cat": "strcat", - "stir cat": "strcat", - "stir en cat": "strncat", - "stir elle cat": "strlcat", - "stir copy": "strcpy", - "stir en copy": "strncpy", - "stir elle copy": "strlcpy", - "string char": "strchr", - "string dupe": "strdup", - "stir dupe": "strdup", - "stir comp": "strcmp", - "stir en comp": "strncmp", - "string len": "strlen", - "stir len": "strlen", - "is digit": "isdigit", - "get char": "getchar", - "print eff": "printf", - "es print eff": "sprintf", - "es en print eff": "sprintf", - "stir to int": "strtoint", - "stir to unsigned int": "strtouint", - "ay to eye": "atoi", - "em map": "mmap", - "ma map": "mmap", - "em un map": "munmap", - "size of": "sizeof", - "ef open": "fopen", - "ef write": "fwrite", - "ef read": "fread", - "ef close": "fclose", - "exit": "exit", - "signal": "signal", - "set jump": "setjmp", - "get op": "getopt", - "malloc": "malloc", - "see alloc": "calloc", - "alloc ah": "alloca", - "re alloc": "realloc", - "free": "free", -} - -mod.list("c_pointers", desc="Common C pointers") -mod.list("c_signed", desc="Common C datatype signed modifiers") -mod.list("c_types", desc="Common C types") -mod.list("stdint_types", desc="Common stdint C types") -mod.list("stdint_signed", desc="Common stdint C datatype signed modifiers") - - -@mod.capture(rule="{self.c_pointers}") -def c_pointers(m) -> str: - "Returns a string" - return m.c_pointers - - -@mod.capture(rule="{self.c_signed}") -def c_signed(m) -> str: - "Returns a string" - return m.c_signed - - -@mod.capture(rule="{self.c_types}") -def c_types(m) -> str: - "Returns a string" - return m.c_types - - -@mod.capture(rule="{self.c_types}") -def c_types(m) -> str: - "Returns a string" - return m.c_types - - -@mod.capture(rule="{self.stdint_types}") -def stdint_types(m) -> str: - "Returns a string" - return m.stdint_types - - -@mod.capture(rule="{self.stdint_signed}") -def stdint_signed(m) -> str: - "Returns a string" - return m.stdint_signed - - -# NOTE: we purposely we don't have a space after signed, to faciltate stdint -# style uint8_t constructions -@mod.capture(rule="[] [+]") -def c_cast(m) -> str: - "Returns a string" - return "(" + " ".join(list(m)) + ")" - - -# NOTE: we purposely we don't have a space after signed, to faciltate stdint -# style uint8_t constructions -@mod.capture(rule="[] [+]") -def c_stdint_cast(m) -> str: - "Returns a string" - return "(" + "".join(list(m)) + ")" - - -@mod.capture(rule="[][]") -def c_variable(m) -> str: - "Returns a string" - return " ".join(list(m)) - - -@ctx.action_class("user") -class user_actions: - def code_insert_function(text: str, selection: str): - if selection: - text = text + "({})".format(selection) - else: - text = text + "()" - - actions.user.paste(text) - actions.edit.left() - - # TODO - it would be nice that you integrate that types from c_cast - # instead of defaulting to void - def code_private_function(text: str): - """Inserts private function declaration""" - result = "void {}".format( - actions.user.formatted_text( - text, settings.get("user.code_private_function_formatter") - ) - ) - - actions.user.code_insert_function(result, None) - - def code_private_static_function(text: str): - """Inserts private static function""" - result = "static void {}".format( - actions.user.formatted_text( - text, settings.get("user.code_private_function_formatter") - ) - ) - - actions.user.code_insert_function(result, None) - - def code_insert_library(text: str, selection: str): - actions.user.paste("include <{}>".format(selection)) - diff --git a/talon/community/community-cursorless-0.4.0/lang/c/c.talon b/talon/community/community-cursorless-0.4.0/lang/c/c.talon deleted file mode 100644 index c5ca9fb..0000000 --- a/talon/community/community-cursorless-0.4.0/lang/c/c.talon +++ /dev/null @@ -1,162 +0,0 @@ -mode: user.c -mode: command -and code.language: c -- -tag(): user.code_operators -tag(): user.code_comment -tag(): user.code_block_comment -tag(): user.code_generic -settings(): - user.code_private_function_formatter = "SNAKE_CASE" - user.code_protected_function_formatter = "SNAKE_CASE" - user.code_public_function_formatter = "SNAKE_CASE" - user.code_private_variable_formatter = "SNAKE_CASE" - user.code_protected_variable_formatter = "SNAKE_CASE" - user.code_public_variable_formatter = "SNAKE_CASE" - # whether or not to use uint_8 style datatypes - # user.use_stdint_datatypes = 1 - - -action(user.code_operator_indirection): "*" -action(user.code_operator_address_of): "&" -action(user.code_operator_structure_dereference): "->" -action(user.code_operator_subscript): - insert("[]") - key(left) -action(user.code_operator_assignment): " = " -action(user.code_operator_subtraction): " - " -action(user.code_operator_subtraction_assignment): " -= " -action(user.code_operator_addition): " + " -action(user.code_operator_addition_assignment): " += " -action(user.code_operator_multiplication): " * " -action(user.code_operator_multiplication_assignment): " *= " -#action(user.code_operator_exponent): " ** " -action(user.code_operator_division): " / " -action(user.code_operator_division_assignment): " /= " -action(user.code_operator_modulo): " % " -action(user.code_operator_modulo_assignment): " %= " -action(user.code_operator_equal): " == " -action(user.code_operator_not_equal): " != " -action(user.code_operator_greater_than): " > " -action(user.code_operator_greater_than_or_equal_to): " >= " -action(user.code_operator_less_than): " < " -action(user.code_operator_less_than_or_equal_to): " <= " -action(user.code_operator_and): " && " -action(user.code_operator_or): " || " -action(user.code_operator_bitwise_and): " & " -action(user.code_operator_bitwise_and_assignment): " &= " -action(user.code_operator_bitwise_or): " | " -action(user.code_operator_bitwise_or_assignment): " |= " -action(user.code_operator_bitwise_exclusive_or): " ^ " -action(user.code_operator_bitwise_exclusive_or_assignment): " ^= " -action(user.code_operator_bitwise_left_shift): " << " -action(user.code_operator_bitwise_left_shift_assignment): " <<= " -action(user.code_operator_bitwise_right_shift): " >> " -action(user.code_operator_bitwise_right_shift_assignment): " >>= " -action(user.code_null): "NULL" -action(user.code_is_null): " == NULL " -action(user.code_is_not_null): " != NULL" -action(user.code_state_if): - insert("if () {\n}\n") - key(up:2 left:3) -action(user.code_state_else_if): - insert("else if () {\n}\n") - key(up:2 left:3) -action(user.code_state_else): - insert("else\n{\n}\n") - key(up:2) -action(user.code_state_switch): - insert("switch ()") - edit.left() -action(user.code_state_case): - insert("case \nbreak;") - edit.up() -action(user.code_state_for): "for " -action(user.code_state_go_to): "goto " -action(user.code_state_while): - insert("while ()") - edit.left() -action(user.code_state_return): "return " -action(user.code_break): "break;" -action(user.code_next): "continue;" -action(user.code_true): "true" -action(user.code_false): "false" -action(user.code_type_definition): "typedef " -action(user.code_typedef_struct): - insert("typedef struct") - insert("{\n\n}") - edit.up() - key(tab) -action(user.code_from_import): "using " -action(user.code_include): insert("#include ") -action(user.code_include_system): - insert("#include <>") - edit.left() -action(user.code_include_local): - insert('#include ""') - edit.left() -action(user.code_comment): "//" -action(user.code_block_comment): - insert("/*") - key(enter) - key(enter) - insert("*/") - edit.up() -action(user.code_block_comment_prefix): "/*" -action(user.code_block_comment_suffix): "*/" - -^funky $: user.code_default_function(text) -^static funky $: user.code_private_static_function(text) - - -# XXX - make these generic in programming, as they will match cpp, etc -state define: "#define " -state undefine: "#undef " -state if define: "#ifdef " - -# XXX - preprocessor instead of pre? -state pre if: "#if " -state error: "#error " -state pre else if: "#elif " -state pre end: "#endif " -state pragma: "#pragma " -state default: "default:\nbreak;" - -#control flow -#best used with a push like command -#the below example may not work in editors that automatically add the closing bracket -#if so uncomment the two lines and comment out the rest accordingly -push brackets: - edit.line_end() - #insert("{") - #key(enter) - insert("{}") - edit.left() - key(enter) - key(enter) - edit.up() - -# Declare variables or structs etc. -# Ex. * int myList - : - insert("{c_variable} ") - insert(user.formatted_text(phrase, "PRIVATE_CAMEL_CASE,NO_SPACES")) - - : - insert("{c_variable} {letter} ") - -# Ex. (int *) -cast to : "{c_cast}" -standard cast to : "{stdint_cast}" -: "{c_types}" -: "{c_pointers}" -: "{c_signed}" -standard : "{stdint_types}" -int main: - insert("int main()") - edit.left() - -toggle includes: user.code_toggle_libraries() -include : - user.code_insert_library(code_libraries, "") - key(end enter) diff --git a/talon/community/community-cursorless-0.4.0/lang/comment.talon b/talon/community/community-cursorless-0.4.0/lang/comment.talon deleted file mode 100644 index 8a0e2e6..0000000 --- a/talon/community/community-cursorless-0.4.0/lang/comment.talon +++ /dev/null @@ -1,38 +0,0 @@ -tag: user.code_comment -- -# comment: user.code_comment() -# comment line: -# #todo: this should probably be a single function once -# #.talon supports implementing actions with parameters? -# edit.line_start() -# user.code_comment() -#adds comment to the start of the line -# comment line over: -# #todo: this should probably be a single function once -# #.talon supports implementing actions with parameters? -# edit.line_start() -# user.code_comment() -# insert(user.text) -# insert(" ") -# comment over: -# #todo: this should probably be a single function once -# #.talon supports implementing actions with parameters? -# user.code_comment() -# insert(user.text) -# comment $: -# #todo: this should probably be a single function once -# #.talon supports implementing actions with parameters? -# user.code_comment() -# insert(user.text) -(line | inline) comment over: - #todo: this should probably be a single function once - #.talon supports implementing actions with parameters? - edit.line_end() - user.code_comment() - insert(user.text) -(line | inline) comment $: - #todo: this should probably be a single function once - #.talon supports implementing actions with parameters? - edit.line_end() - user.code_comment() - insert(user.text) diff --git a/talon/community/community-cursorless-0.4.0/lang/csharp/csharp.py b/talon/community/community-cursorless-0.4.0/lang/csharp/csharp.py deleted file mode 100644 index b3a991f..0000000 --- a/talon/community/community-cursorless-0.4.0/lang/csharp/csharp.py +++ /dev/null @@ -1,81 +0,0 @@ -from talon import Context, Module, actions, imgui, settings, ui - -ctx = Context() -ctx.matches = r""" -mode: user.csharp -mode: command -and code.language: csharp -""" -ctx.lists["user.code_functions"] = { - "integer": "int.TryParse", - "print": "Console.WriteLine", - "string": ".ToString", -} - - -@ctx.action_class("user") -class user_actions: - def code_insert_function(text: str, selection: str): - if selection: - text = text + "({})".format(selection) - else: - text = text + "()" - - actions.user.paste(text) - actions.edit.left() - - def code_private_function(text: str): - """Inserts private function declaration""" - result = "private void {}".format( - actions.user.formatted_text( - text, settings.get("user.code_private_function_formatter") - ) - ) - - actions.user.code_insert_function(result, None) - - def code_private_static_function(text: str): - """Inserts private static function""" - result = "private static void {}".format( - actions.user.formatted_text( - text, settings.get("user.code_private_function_formatter") - ) - ) - - actions.user.code_insert_function(result, None) - - def code_protected_function(text: str): - result = "private void {}".format( - actions.user.formatted_text( - text, settings.get("user.code_protected_function_formatter") - ) - ) - - actions.user.code_insert_function(result, None) - - def code_protected_static_function(text: str): - result = "protected static void {}".format( - actions.user.formatted_text( - text, settings.get("user.code_protected_function_formatter") - ) - ) - - actions.user.code_insert_function(result, None) - - def code_public_function(text: str): - result = "public void {}".format( - actions.user.formatted_text( - text, settings.get("user.code_public_function_formatter") - ) - ) - - actions.user.code_insert_function(result, None) - - def code_public_static_function(text: str): - result = "public static void {}".format( - actions.user.formatted_text( - text, settings.get("user.code_public_function_formatter") - ) - ) - - actions.user.code_insert_function(result, None) diff --git a/talon/community/community-cursorless-0.4.0/lang/csharp/csharp.talon b/talon/community/community-cursorless-0.4.0/lang/csharp/csharp.talon deleted file mode 100644 index f1659c1..0000000 --- a/talon/community/community-cursorless-0.4.0/lang/csharp/csharp.talon +++ /dev/null @@ -1,111 +0,0 @@ -mode: user.csharp -mode: command -and code.language: csharp -- -tag(): user.code_operators -tag(): user.code_comment -tag(): user.code_generic -settings(): - user.code_private_function_formatter = "PRIVATE_CAMEL_CASE" - user.code_protected_function_formatter = "PUBLIC_CAMEL_CASE" - user.code_public_function_formatter = "PUBLIC_CAMEL_CASE" - user.code_private_variable_formatter = "PRIVATE_CAMEL_CASE" - user.code_protected_variable_formatter = "PUBLIC_CAMEL_CASE" - user.code_public_variable_formatter = "PUBLIC_CAMEL_CASE" - -action(user.code_operator_indirection): "*" -action(user.code_operator_address_of): "&" -action(user.code_operator_structure_dereference): "->" -action(user.code_operator_lambda): "=>" -action(user.code_operator_subscript): - insert("[]") - key(left) -action(user.code_operator_assignment): " = " -action(user.code_operator_subtraction): " - " -action(user.code_operator_subtraction_assignment): " -= " -action(user.code_operator_addition): " + " -action(user.code_operator_addition_assignment): " += " -action(user.code_operator_multiplication): " * " -action(user.code_operator_multiplication_assignment): " *= " -#action(user.code_operator_exponent): " ** " -action(user.code_operator_division): " / " -action(user.code_operator_division_assignment): " /= " -action(user.code_operator_modulo): " % " -action(user.code_operator_modulo_assignment): " %= " -action(user.code_operator_equal): " == " -action(user.code_operator_not_equal): " != " -action(user.code_operator_greater_than): " > " -action(user.code_operator_greater_than_or_equal_to): " >= " -action(user.code_operator_less_than): " < " -action(user.code_operator_less_than_or_equal_to): " <= " -action(user.code_operator_and): " && " -action(user.code_operator_or): " || " -action(user.code_operator_bitwise_and): " & " -action(user.code_operator_bitwise_and_assignment): " &= " -action(user.code_operator_bitwise_or): " | " -action(user.code_operator_bitwise_or_assignment): " |= " -action(user.code_operator_bitwise_exclusive_or): " ^ " -action(user.code_operator_bitwise_exclusive_or_assignment): " ^= " -action(user.code_operator_bitwise_left_shift): " << " -action(user.code_operator_bitwise_left_shift_assignment): " <<= " -action(user.code_operator_bitwise_right_shift): " >> " -action(user.code_operator_bitwise_right_shift_assignment): " >>= " -action(user.code_block): - insert("{}") - key(left enter enter up tab) -action(user.code_self): "this" -action(user.code_null): "null" -action(user.code_is_null): " == null " -action(user.code_is_not_null): " != null" -action(user.code_state_if): - insert("if()") - key(left) -action(user.code_state_else_if): - insert("else if()") - key(left) -action(user.code_state_else): - insert("else\n{{\n}}\n") - key(up ) -action(user.code_state_switch): - insert("switch()") - edit.left() -action(user.code_state_case): - insert("case \nbreak;") - edit.up() -action(user.code_state_for): "for " -action(user.code_state_for_each): - insert("foreach() ") - key(left) - edit.word_left() - key(space) - edit.left() -action(user.code_state_go_to): "go to " -action(user.code_state_while): - insert("while()") - edit.left() -action(user.code_state_return): "return " -action(user.code_break): "break;" -action(user.code_next): "continue;" -action(user.code_true): "true" -action(user.code_false): "false" - -#action(user.code_type_definition): "typedef " -#action(user.code_typedef_struct): -# insert("typedef struct") -# insert("{{\n\n}}") -# edit.up() -# key(tab) -action(user.code_type_class): "class " -action(user.code_import): "using " -action(user.code_from_import): "using " -action(user.code_include): insert("using ") -action(user.code_include_system): insert("using ") -action(user.code_include_local): insert('using ') -action(user.code_comment): "//" - -^funky $: user.code_default_function(text) -^pro funky $: user.code_protected_function(text) -^pub funky $: user.code_public_function(text) -^static funky $: user.code_private_static_function(text) -^pro static funky $: user.code_protected_static_function(text) -^pub static funky $: user.code_public_static_function(text) \ No newline at end of file diff --git a/talon/community/community-cursorless-0.4.0/lang/go.talon b/talon/community/community-cursorless-0.4.0/lang/go.talon deleted file mode 100644 index b403a61..0000000 --- a/talon/community/community-cursorless-0.4.0/lang/go.talon +++ /dev/null @@ -1,200 +0,0 @@ -mode: user.go -mode: command -and code.language: go -- -variadic: "..." -logical and: " && " -logical or: " || " -# Many of these add extra terrible spacing under the assumption that -# gofmt/goimports will erase it. -state comment: "// " -[line] comment : - key("cmd-right") - insert(" // ") - insert(user.formatted_text(text, "sentence")) - -# "add comment [over]: -# key("cmd-right") -# text_with_leading(" // ") -# ] -# "[state] context: insert("ctx") -state (funk | func | fun): "func " -function (Annette | init) [over]: "func init() {\n" -function [over]: - insert("func ") - insert(user.formatted_text(text, "PRIVATE_CAMEL_CASE")) - insert("(") - sleep(100ms) - -method [over]: - insert("meth ") - insert(user.formatted_text(text, "PRIVATE_CAMEL_CASE")) - sleep(100ms) - -state var: "var " -variable [] [over]: - insert("var ") - insert(user.formatted_text(text, "PRIVATE_CAMEL_CASE")) - # insert(" ") - sleep(100ms) - -of type [] [over]: - insert(" ") - insert(user.formatted_text(text, "PRIVATE_CAMEL_CASE")) - -# "set [over]: -# insert(user.formatted_text(text, "PRIVATE_CAMEL_CASE")) -# insert(" := ") -# sleep(100ms) -# ] -state break: "break" -state (chan | channel): " chan " -state go: "go " -state if: "if " -if [over]: - insert("if ") - insert(user.formatted_text(text, "PRIVATE_CAMEL_CASE")) -spawn [over]: - insert("go ") - insert(user.formatted_text(text, "PRIVATE_CAMEL_CASE")) -state else if: " else if " -else if [over]: - insert(" else if ") - insert(user.formatted_text(text, "PRIVATE_CAMEL_CASE")) - -state else: " else " -else [over]: - insert(" else {") - key("enter") - insert(user.formatted_text(text, "PRIVATE_CAMEL_CASE")) - -state while: "while " -while [over]: - insert("while ") - insert(user.formatted_text(text, "PRIVATE_CAMEL_CASE")) - -state for: "for " -for [over]: - insert("for ") - insert(user.formatted_text(text, "PRIVATE_CAMEL_CASE")) - -state for range: "forr " -range [over]: - insert("forr ") - insert(user.formatted_text(text, "PRIVATE_CAMEL_CASE")) - -state format: "fmt" -format [over]: - insert("fmt.") - insert(user.formatted_text(text, "PUBLIC_CAMEL_CASE")) - -state switch: "switch " -switch [over]: - insert("switch ") - insert(user.formatted_text(text, "PRIVATE_CAMEL_CASE")) - -state select: "select " -# "select :insert("select "), insert(user.formatted_text(text, "PRIVATE_CAMEL_CASE")] -state (const | constant): " const " -constant [over]: - insert("const ") - insert(user.formatted_text(text, "PUBLIC_CAMEL_CASE")) - -state case: " case " -state default: " default:" -case [over]: - insert("case ") - insert(user.formatted_text(text, "PRIVATE_CAMEL_CASE")) - -state type: " type " -type [over]: - insert("type ") - insert(user.formatted_text(text, "PUBLIC_CAMEL_CASE")) -state true: " true " -state false: " false " -state (start | struct | struck): - insert(" struct {") - key("enter") -(struct | struck) [over]: - insert(" struct {") - key("enter") - insert(user.formatted_text(text, "PUBLIC_CAMEL_CASE")) - -[state] empty interface: " interface{} " -state interface: - insert(" interface {") - key("enter") -interface [over]: - insert(" interface {") - key("enter") - insert(user.formatted_text(text, "PUBLIC_CAMEL_CASE")) - -state string: " string " -[state] (int | integer | ant): "int" -state slice: " []" -slice of: "[]" -[state] (no | nil): "nil" -state (int | integer | ant) 64: " int64 " -state tag: - insert(" ``") - key("left") -field tag [over]: - insert(" ``") - key("left") - sleep(100ms) - insert(user.formatted_text(text, "snake")) - insert(" ") - sleep(100ms) - -state return: " return " -return [over]: - insert("return ") - insert(user.formatted_text(text, "PRIVATE_CAMEL_CASE")) - -map of string to string: " map[string]string " -map of [over]: - insert("map[") - insert(user.formatted_text(text, "PRIVATE_CAMEL_CASE")) - key("right") - sleep(100ms) - -receive: " <- " -make: "make(" -loggers [] [over]: - insert("logrus.") - insert(user.formatted_text(text, "PUBLIC_CAMEL_CASE")) - -length [over]: - insert("len(") - insert(user.formatted_text(text, "PRIVATE_CAMEL_CASE")) - -append [over]: - insert("append(") - insert(user.formatted_text(text, "PRIVATE_CAMEL_CASE")) - -state (air | err): "err" -error: " err " -loop over [] [over]: - insert("forr ") - insert(user.formatted_text(text, "PRIVATE_CAMEL_CASE")) - -item [over]: - insert(", ") - insert(user.formatted_text(text, "PRIVATE_CAMEL_CASE")) - -value [over]: - insert(": ") - insert(user.formatted_text(text, "PRIVATE_CAMEL_CASE")) - -address of [] [over]: - insert("&") - insert(user.formatted_text(text, "PRIVATE_CAMEL_CASE")) - -pointer to [] [over]: - insert("*") - insert(user.formatted_text(text, "PRIVATE_CAMEL_CASE")) - -swipe [] [over]: - key("right") - insert(", ") - insert(user.formatted_text(text, "PRIVATE_CAMEL_CASE")) diff --git a/talon/community/community-cursorless-0.4.0/lang/java/java.talon b/talon/community/community-cursorless-0.4.0/lang/java/java.talon deleted file mode 100644 index 82d6678..0000000 --- a/talon/community/community-cursorless-0.4.0/lang/java/java.talon +++ /dev/null @@ -1,81 +0,0 @@ -mode: user.java -mode: command -and code.language: java - -- -tag(): user.code_operators -tag(): user.code_generic - -action(user.code_operator_indirection): skip() -action(user.code_operator_address_of): skip() -action(user.code_operator_lambda): " -> " -action(user.code_operator_subscript): - insert("[]") - key(left) -action(user.code_operator_assignment): " = " -action(user.code_operator_subtraction): " - " -action(user.code_operator_subtraction_assignment): " -= " -action(user.code_operator_addition): " + " -action(user.code_operator_addition_assignment): " += " -action(user.code_operator_multiplication): " * " -action(user.code_operator_multiplication_assignment): " *= " -action(user.code_operator_exponent): " ^ " -action(user.code_operator_division): " / " -action(user.code_operator_division_assignment): " /= " -action(user.code_operator_modulo): " % " -action(user.code_operator_modulo_assignment): " %= " -action(user.code_operator_equal): " == " -action(user.code_operator_not_equal): " != " -action(user.code_operator_greater_than): " > " -action(user.code_operator_greater_than_or_equal_to): " >= " -action(user.code_operator_less_than): " < " -action(user.code_operator_less_than_or_equal_to): " <= " -action(user.code_operator_and): " && " -action(user.code_operator_or): " || " -action(user.code_operator_bitwise_and): " & " -action(user.code_operator_bitwise_or): " | " -action(user.code_operator_bitwise_exclusive_or): " ^ " -action(user.code_operator_bitwise_left_shift): " << " -action(user.code_operator_bitwise_left_shift_assignment): " <<= " -action(user.code_operator_bitwise_right_shift): " >> " -action(user.code_operator_bitwise_right_shift_assignment): " >>= " -action(user.code_self): "this" -action(user.code_null): "null" -action(user.code_is_null): " == null" -action(user.code_is_not_null): " != null" -action(user.code_state_if): - insert("if () ") - key(left) - key(left) -action(user.code_state_else_if): - insert("else if () ") - key(left) - key(left) -action(user.code_state_else): - insert("else ") - key(enter) -action(user.code_state_switch): - insert("switch () ") - key(left) - edit.left() -action(user.code_state_case): - insert("case \nbreak;") - edit.up() -action(user.code_state_for): - insert('for () ') - key(left) - key(left) -action(user.code_state_while): - insert("while () ") - edit.left() - edit.left() -action(user.code_type_class): "class " -action(user.code_private_function): - insert("private") -action(user.code_protected_function): - user.code_private_function() -action(user.code_public_function): - insert("public ") -action(user.code_state_return): - insert("return ") - \ No newline at end of file diff --git a/talon/community/community-cursorless-0.4.0/lang/javascript/javascript.py b/talon/community/community-cursorless-0.4.0/lang/javascript/javascript.py deleted file mode 100644 index 704829d..0000000 --- a/talon/community/community-cursorless-0.4.0/lang/javascript/javascript.py +++ /dev/null @@ -1,83 +0,0 @@ -from talon import Module, Context, actions, ui, imgui, settings - -ctx = Context() -ctx.matches = r""" -mode: user.javascript -mode: command -and code.language: javascript -""" -# tbd -# ctx.lists["user.code_functions"] = { -# "integer": "int.TryParse", -# "print": "Console.WriteLine", -# "string": ".ToString", -# } - - -@ctx.action_class("user") -class user_actions: - def code_insert_function(text: str, selection: str): - if selection: - text = text + "({})".format(selection) - else: - text = text + "()" - - actions.user.paste(text) - actions.edit.left() - - def code_private_function(text: str): - """Inserts private function declaration""" - result = "function {}".format( - actions.user.formatted_text( - text, settings.get("user.code_private_function_formatter") - ) - ) - - actions.user.code_insert_function(result, None) - - # def code_private_static_function(text: str): - # """Inserts private static function""" - # result = "private static void {}".format( - # actions.user.formatted_text( - # text, settings.get("user.code_private_function_formatter") - # ) - # ) - - # actions.user.code_insert_function(result, None) - - def code_protected_function(text: str): - result = "function {}".format( - actions.user.formatted_text( - text, settings.get("user.code_protected_function_formatter") - ) - ) - - actions.user.code_insert_function(result, None) - - # def code_protected_static_function(text: str): - # result = "protected static void {}".format( - # actions.user.formatted_text( - # text, settings.get("user.code_protected_function_formatter") - # ) - # ) - - # actions.user.code_insert_function(result, None) - - def code_public_function(text: str): - result = "function {}".format( - actions.user.formatted_text( - text, settings.get("user.code_public_function_formatter") - ) - ) - - actions.user.code_insert_function(result, None) - - # def code_public_static_function(text: str): - # result = "public static void {}".format( - # actions.user.formatted_text( - # text, settings.get("user.code_public_function_formatter") - # ) - # ) - - # actions.user.code_insert_function(result, None) - diff --git a/talon/community/community-cursorless-0.4.0/lang/javascript/javascript.talon b/talon/community/community-cursorless-0.4.0/lang/javascript/javascript.talon deleted file mode 100644 index 7bd4680..0000000 --- a/talon/community/community-cursorless-0.4.0/lang/javascript/javascript.talon +++ /dev/null @@ -1,166 +0,0 @@ -mode: user.javascript -mode: command -and code.language: javascript -- -tag(): user.code_operators -tag(): user.code_comment -tag(): user.code_generic - -settings(): - user.code_private_function_formatter = "PRIVATE_CAMEL_CASE" - user.code_protected_function_formatter = "PRIVATE_CAMEL_CASE" - user.code_public_function_formatter = "PRIVATE_CAMEL_CASE" - user.code_private_variable_formatter = "PRIVATE_CAMEL_CASE" - user.code_protected_variable_formatter = "PRIVATE_CAMEL_CASE" - user.code_public_variable_formatter = "PRIVATE_CAMEL_CASE" - -action(user.code_is_not_null): " !== null" - -action(user.code_is_null): " === null" - -action(user.code_type_dictionary): - insert("{}") - key(left) - -action(user.code_state_if): - insert("if ()") - key(left) - -action(user.code_state_else_if): - insert(" else if ()") - key(left) - -action(user.code_state_else): - insert(" else {}") - key(left enter) - -action(user.code_block): - insert("{}") - key(left enter) - -action(user.code_self): "this" - -action(user.code_state_while): - insert("while ()") - key(left) - -action(user.code_state_return): - insert("return ") - -action(user.code_state_for): - insert("for ()") - key(left) - -action(user.code_state_switch): - insert("switch ()") - key(left) - -action(user.code_state_case): "case :" - -action(user.code_state_go_to): "" - -action(user.code_import): "import " - -action(user.code_from_import): - insert(" from \"\"") - key(left) - -action(user.code_type_class): "class " - -action(user.code_include): "" - -action(user.code_include_system): "" - -action(user.code_include_local): "" - -action(user.code_type_definition): "" - -action(user.code_typedef_struct): "" - -action(user.code_state_for_each): - insert(".forEach()") - key(left) - -action(user.code_break): "break;" -action(user.code_next): "continue;" -action(user.code_true): "true" -action(user.code_false): "false" - -action(user.code_null): "null" - -action(user.code_operator_indirection): "" -action(user.code_operator_address_of): "" -action(user.code_operator_structure_dereference): "" -action(user.code_operator_lambda): " => " -action(user.code_operator_subscript): - insert("[]") - key(left) -action(user.code_operator_assignment): " = " -action(user.code_operator_subtraction): " - " -action(user.code_operator_subtraction_assignment): " -= " -action(user.code_operator_addition): " + " -action(user.code_operator_addition_assignment): " += " -action(user.code_operator_multiplication): " * " -action(user.code_operator_multiplication_assignment): " *= " -action(user.code_operator_exponent): " ** " -action(user.code_operator_division): " / " -action(user.code_operator_division_assignment): " /= " -action(user.code_operator_modulo): " % " -action(user.code_operator_modulo_assignment): " %= " -action(user.code_operator_equal): " == " -action(user.code_operator_not_equal): " != " -op treek: " === " -op nottreek: " !== " -action(user.code_operator_greater_than): " > " -action(user.code_operator_greater_than_or_equal_to): " >= " -action(user.code_operator_less_than): " < " -action(user.code_operator_less_than_or_equal_to): " <= " -action(user.code_operator_and): " && " -action(user.code_operator_or): " || " -action(user.code_operator_bitwise_and): " & " -action(user.code_operator_bitwise_and_assignment): " &= " -action(user.code_operator_bitwise_or): " | " -action(user.code_operator_bitwise_or_assignment): " |= " -action(user.code_operator_bitwise_exclusive_or): " ^ " -action(user.code_operator_bitwise_exclusive_or_assignment): " ^= " -action(user.code_operator_bitwise_left_shift): " << " -action(user.code_operator_bitwise_left_shift_assignment): " <<= " -action(user.code_operator_bitwise_right_shift): " >> " -action(user.code_operator_bitwise_right_shift_assignment): " >>= " - -state const: "const " - -state let: "let " - -state var: "var " - -state async: "async " - -state await: "await " - -state map: - insert(".map()") - key(left) - -state filter: - insert(".filter()") - key(left) - -state reduce: - insert(".reduce()") - key(left) - -state length: insert(".length") - -state quote var: - insert("${}") - key(left) - -state log: - insert("console.log()") - key(left) -state spread: "..." - -^funky $: user.code_default_function(text) -^pro funky $: user.code_protected_function(text) -^pub funky $: user.code_public_function(text) \ No newline at end of file diff --git a/talon/community/community-cursorless-0.4.0/lang/operators.talon b/talon/community/community-cursorless-0.4.0/lang/operators.talon deleted file mode 100644 index 570077e..0000000 --- a/talon/community/community-cursorless-0.4.0/lang/operators.talon +++ /dev/null @@ -1,55 +0,0 @@ -tag: user.code_operators -- -#pointer operators - dereference: user.code_operator_indirection() - address of: user.code_operator_address_of() - arrow: user.code_operator_structure_dereference() - -#lambda - lambda: user.code_operator_lambda() - -#subscript - subscript: user.code_operator_subscript() - -#assignment - (equals | assign): user.code_operator_assignment() - -#math operators - (minus | subtract): user.code_operator_subtraction() - (minus | subtract) equals: user.code_operator_subtraction_assignment() - (plus | add): user.code_operator_addition() - (plus | add) equals: user.code_operator_addition_assignment() - (times | multiply): user.code_operator_multiplication() - (times | multiply) equals: user.code_operator_multiplication_assignment() - divide: user.code_operator_division() - divide equals: user.code_operator_division_assignment() - mod: user.code_operator_modulo() - mod equals: user.code_operator_modulo_assignment() -( (power | exponent) | to the power [of]): user.code_operator_exponent() - -#comparison operators -( | is) equal: user.code_operator_equal() -( | is) not equal: user.code_operator_not_equal() -( | is) (greater | more): user.code_operator_greater_than() -( | is) (less | below) [than]: user.code_operator_less_than() -( | is) greater [than] or equal: user.code_operator_greater_than_or_equal_to() -( | is) less [than] or equal: user.code_operator_less_than_or_equal_to() -( | is) in: user.code_operator_in() - -#logical operators -( | logical) and: user.code_operator_and() -( | logical) or: user.code_operator_or() - -#bitwise operators -[] bitwise and: user.code_operator_bitwise_and() -( | logical | bitwise) and equals: user.code_operator_bitwise_and_equals() -[] bitwise or: user.code_operator_bitwise_or() -( | logical | bitwise) or equals: user.code_operator_bitwise_or_equals() -( | logical | bitwise) (ex | exclusive) or: user.code_operator_bitwise_exclusive_or() -( | logical | bitwise) (left shift | shift left): user.code_operator_bitwise_left_shift() -( | logical | bitwise) (right shift | shift right): user.code_operator_bitwise_right_shift() -( | logical | bitwise) (ex | exclusive) or equals: user.code_operator_bitwise_exclusive_or_equals() -[( | logical | bitwise)] (left shift | shift left) equals: user.code_operator_bitwise_left_shift_equals() -[( | logical | bitwise)] (left right | shift right) equals: user.code_operator_bitwise_right_shift_equals() - -#tbd \ No newline at end of file diff --git a/talon/community/community-cursorless-0.4.0/lang/programming.talon b/talon/community/community-cursorless-0.4.0/lang/programming.talon deleted file mode 100644 index 3bff1cd..0000000 --- a/talon/community/community-cursorless-0.4.0/lang/programming.talon +++ /dev/null @@ -1,67 +0,0 @@ -tag: user.code_generic -- -block: user.code_block() - -#todo should we have a keyword list? type list capture? stick with "word"? -state in: insert(" in ") -is not (none|null): user.code_is_not_null() -is (none|null): user.code_is_null() -#todo: types? -#word (dickt | dictionary): user.code_type_dictionary() -state if: user.code_state_if() -state else if: user.code_state_else_if() -state else: user.code_state_else() -state self: user.code_self() -#todo: this is valid for many languages, -# but probably not all -self dot: - user.code_self() - insert(".") -state while: user.code_state_while() -state for: user.code_state_for() -state for in: user.code_state_for_each() -state switch: user.code_state_switch() -state case: user.code_state_case() -state do: user.code_state_do() -state goto: user.code_state_go_to() -state return: user.code_state_return() -state import: user.code_import() -from import: user.code_from_import() -state class: user.code_type_class() -state include: user.code_include() -state include system: user.code_include_system() -state include local: user.code_include_local() -state type deaf: user.code_type_definition() -state type deaf struct: user.code_typedef_struct() -state (no | nil | null): user.code_null() -state break: user.code_break() -state next: user.code_next() -state true: user.code_true() -state false: user.code_false() - -# show and print functions and libraries -toggle funk: user.code_toggle_functions() -funk : - user.code_insert_function(code_functions, "") -funk cell : - user.code_select_function(number - 1, "") -funk wrap : - user.code_insert_function(code_functions, edit.selected_text()) -funk wrap : - user.code_select_function(number - 1, edit.selected_text()) -dock string: user.code_document_string() - -slider: - edit.line_end() - insert(",") - key(enter) - -breaker: - edit.line_end() - insert(" {") - key(enter) - -chronic: - edit.line_end() - insert(":") - key(enter) \ No newline at end of file diff --git a/talon/community/community-cursorless-0.4.0/lang/python/python.py b/talon/community/community-cursorless-0.4.0/lang/python/python.py deleted file mode 100644 index d8703cb..0000000 --- a/talon/community/community-cursorless-0.4.0/lang/python/python.py +++ /dev/null @@ -1,187 +0,0 @@ -import re - -from talon import Context, Module, actions, settings - -mod = Module() -ctx = Context() -ctx.matches = r""" -mode: user.python -mode: command -and code.language: python -""" -ctx.lists["user.code_functions"] = { - "enumerate": "enumerate", - "integer": "int", - "length": "len", - "list": "list", - "print": "print", - "range": "range", - "set": "set", - "split": "split", - "string": "str", - "update": "update", -} - -"""a set of fields used in python docstrings that will follow the -reStructuredText format""" -docstring_fields = { - "class": ":class:", - "function": ":func:", - "parameter": ":param:", - "raise": ":raise:", - "returns": ":return:", - "type": ":type:", - "return type": ":rtype:", - # these are sphinx-specific - "see also": ".. seealso:: ", - "notes": ".. notes:: ", - "warning": ".. warning:: ", - "todo": ".. todo:: ", -} - -mod.list("python_docstring_fields", desc="python docstring fields") -ctx.lists["user.python_docstring_fields"] = docstring_fields - -type_list = { - "boolean": "bool", - "integer": "int", - "string": "str", - "none": "None", - "dick": "Dict", - "float": "float", - "any": "Any", - "tuple": "Tuple", - "union": "UnionAny", - "iterable": "Iterable", - "vector": "Vector", - "bytes": "bytes", - "sequence": "Sequence", - "callable": "Callable", - "list": "List", - "no return": "NoReturn", -} - -mod.list("python_type_list", desc="python types") -ctx.lists["user.python_type_list"] = type_list - -exception_list = [ - "BaseException", - "SystemExit", - "KeyboardInterrupt", - "GeneratorExit", - "Exception", - "StopIteration", - "StopAsyncIteration", - "ArithmeticError", - "FloatingPointError", - "OverflowError", - "ZeroDivisionError", - "AssertionError", - "AttributeError", - "BufferError", - "EOFError", - "ImportError", - "ModuleNotFoundError", - "LookupError", - "IndexError", - "KeyError", - "MemoryError", - "NameError", - "UnboundLocalError", - "OSError", - "BlockingIOError", - "ChildProcessError", - "ConnectionError", - "BrokenPipeError", - "ConnectionAbortedError", - "ConnectionRefusedError", - "ConnectionResetError", - "FileExistsError", - "FileNotFoundError", - "InterruptedError", - "IsADirectoryError", - "NotADirectoryError", - "PermissionError", - "ProcessLookupError", - "TimeoutError", - "ReferenceError", - "RuntimeError", - "NotImplementedError", - "RecursionError", - "SyntaxError", - "IndentationError", - "TabError", - "SystemError", - "TypeError", - "ValueError", - "UnicodeError", - "UnicodeDecodeError", - "UnicodeEncodeError", - "UnicodeTranslateError", - "Warning", - "DeprecationWarning", - "PendingDeprecationWarning", - "RuntimeWarning", - "SyntaxWarning", - "UserWarning", - "FutureWarning", - "ImportWarning", - "UnicodeWarning", - "BytesWarning", - "ResourceWarning", -] -mod.list("python_exception", desc="python exceptions") -ctx.lists["user.python_exception"] = { - " ".join(re.findall("[A-Z][^A-Z]*", exception)).lower(): exception - for exception in exception_list -} - - -@ctx.action_class("user") -class user_actions: - def code_insert_function(text: str, selection: str): - if selection: - text = text + "({})".format(selection) - else: - text = text + "()" - actions.user.paste(text) - actions.edit.left() - - def code_default_function(text: str): - actions.user.code_public_function(text) - - def code_private_function(text: str): - """Inserts private function declaration""" - result = "def _{}():".format( - actions.user.formatted_text( - text, settings.get("user.code_private_function_formatter") - ) - ) - - actions.user.paste(result) - actions.edit.left() - actions.edit.left() - - def code_public_function(text: str): - result = "def {}():".format( - actions.user.formatted_text( - text, settings.get("user.code_public_function_formatter") - ) - ) - actions.user.paste(result) - actions.edit.left() - actions.edit.left() - - -@mod.action_class -class module_actions: - # TODO this could go somewhere else - def insert_cursor(text: str): - """Insert a string. Leave the cursor wherever [|] is in the text""" - if "[|]" in text: - end_pos = text.find("[|]") - s = text.replace("[|]", "") - actions.insert(s) - actions.key(f"left:{len(s) - end_pos}") - else: - actions.insert(text) diff --git a/talon/community/community-cursorless-0.4.0/lang/python/python.talon b/talon/community/community-cursorless-0.4.0/lang/python/python.talon deleted file mode 100644 index a4ae82d..0000000 --- a/talon/community/community-cursorless-0.4.0/lang/python/python.talon +++ /dev/null @@ -1,129 +0,0 @@ -mode: user.python -mode: command -and code.language: python -- -tag(): user.code_operators -tag(): user.code_comment -tag(): user.code_generic -settings(): - user.code_private_function_formatter = "SNAKE_CASE" - user.code_protected_function_formatter = "SNAKE_CASE" - user.code_public_function_formatter = "SNAKE_CASE" - user.code_private_variable_formatter = "SNAKE_CASE" - user.code_protected_variable_formatter = "SNAKE_CASE" - user.code_public_variable_formatter = "SNAKE_CASE" -action(user.code_operator_indirection): "" -action(user.code_operator_address_of): "" -action(user.code_operator_structure_dereference): "" -action(user.code_operator_lambda): "" -action(user.code_operator_subscript): - insert("[]") - key(left) -action(user.code_operator_assignment): " = " -action(user.code_operator_subtraction): " - " -action(user.code_operator_subtraction_assignment): " -= " -action(user.code_operator_addition): " + " -action(user.code_operator_addition_assignment): " += " -action(user.code_operator_multiplication): " * " -action(user.code_operator_multiplication_assignment): " *= " -action(user.code_operator_exponent): " ** " -action(user.code_operator_division): " / " -action(user.code_operator_division_assignment): " /= " -action(user.code_operator_modulo): " % " -action(user.code_operator_modulo_assignment): " %= " -action(user.code_operator_equal): " == " -action(user.code_operator_not_equal): " != " -action(user.code_operator_greater_than): " > " -action(user.code_operator_greater_than_or_equal_to): " >= " -action(user.code_operator_less_than): " < " -action(user.code_operator_less_than_or_equal_to): " <= " -action(user.code_operator_and): " and " -action(user.code_operator_or): " or " -action(user.code_operator_bitwise_and): " & " -action(user.code_operator_bitwise_and_assignment): " &= " -action(user.code_operator_bitwise_or): " | " -action(user.code_operator_bitwise_or_assignment): " |= " -action(user.code_operator_bitwise_exclusive_or): " ^ " -action(user.code_operator_bitwise_exclusive_or_assignment): " ^= " -action(user.code_operator_bitwise_left_shift): " << " -action(user.code_operator_bitwise_left_shift_assignment): " <<= " -action(user.code_operator_bitwise_right_shift): " >> " -action(user.code_operator_bitwise_right_shift_assignment): " >>= " -action(user.code_self): "self" -action(user.code_null): "None" -action(user.code_is_null): " is None" -action(user.code_is_not_null): " is not None" -action(user.code_state_if): - insert("if :") - key(left) -action(user.code_state_else_if): - insert("elif :") - key(left) -action(user.code_state_else): - insert("else:") - key(enter) -action(user.code_state_switch): - insert("switch ()") - edit.left() -action(user.code_state_case): - insert("case \nbreak;") - edit.up() -action(user.code_state_for): "for " -action(user.code_state_for_each): - insert("for in ") - key(left) - edit.word_left() - key(space) - edit.left() -action(user.code_state_while): - insert("while :") - edit.left() -action(user.code_type_class): "class " -action(user.code_import): "import " -action(user.code_from_import): - insert("from import ") - key(left) - edit.word_left() - key(space) - edit.left() -action(user.code_comment): "# " -action(user.code_state_return): - insert("return ") -action(user.code_true): "True" -action(user.code_false): "False" -action(user.code_document_string): user.insert_cursor("\"\"\"[|]\"\"\"") - -#python-specific grammars -dunder in it: "__init__" -state (def | deaf | deft): "def " -self taught: "self." -pie test: "pytest" -state past: "pass" - -^funky $: user.code_default_function(text) -#^pro funky $: user.code_protected_function(text) -^pub funky $: user.code_public_function(text) -#^static funky $: user.code_private_static_function(text) -#^pro static funky $: user.code_protected_static_function(text) -#^pub static funky $: user.code_public_static_function(text) -raise {user.python_exception}: user.insert_cursor("raise {python_exception}([|])") - -# for annotating function parameters -is type {user.python_type_list}: - insert(": {python_type_list}") -returns [type] {user.python_type_list}: - insert(" -> {python_type_list}") -# for generic reference of types -type {user.python_type_list}: - insert("{python_type_list}") -dock {user.python_docstring_fields}: - insert("{python_docstring_fields}") - edit.left() -dock type {user.python_type_list}: - user.insert_cursor(":type [|]: {python_type_list}") -dock returns type {user.python_type_list}: - user.insert_cursor(":rtype [|]: {python_type_list}") -toggle imports: user.code_toggle_libraries() -import : - user.code_insert_library(code_libraries, "") - key(end enter) diff --git a/talon/community/community-cursorless-0.4.0/lang/r/r.py b/talon/community/community-cursorless-0.4.0/lang/r/r.py deleted file mode 100644 index 7d0b2de..0000000 --- a/talon/community/community-cursorless-0.4.0/lang/r/r.py +++ /dev/null @@ -1,240 +0,0 @@ -from talon import Context, Module, actions, clip, imgui, settings, ui - -ctx = Context() - -ctx.matches = r""" -mode: user.r -mode: command -and code.language: r -""" - -ctx.lists["user.code_functions"] = { - # base R - "as character": "as.character", - "as data frame": "as.data.frame", - "as date": "as.Date", - "as double": "as.double", - "as factor": "as.factor", - "as integer": "as.integer", - "as numeric": "as.numeric", - "base read RDS": "readRDS", - "base save RDS": "saveRDS", - "cable": "kable", - "correlation": "cor", - "count": "count", - "covariance": "cov", - "describe": "describe", - "eigen": "eigen", - "ex table": "xtable", - "get working directory": "getwd", - "head": "head", - "if else": "ifelse", - "install packages": "install.packages", - "is NA": "is.na", - "is not NA": "!is.na", - "length": "length", - "library": "library", - "list files": "list.files", - "list": "list", - "lm": "lm", - "log": "log", - "make directory": "dir.create", - "margins": "margins", - "max": "max", - "mean": "mean", - "min": "min", - "names": "names", - "paste": "paste0", - "print": "print", - "reorder": "reorder", - "repeat": "rep", - "scale": "scale", - "sequence along": "seq_along", - "sequence length": "seq_len", - "sequence": "seq", - "set working directory": "setwd", - "sort": "sort", - "subset": "subset", - "sum": "sum", - "summary": "summary", - "tail": "tail", - "tidy": "tidy", - "trim white space": "trimws", - "type": "typeof", - "unique": "unique", - "vector": "c", - "vee table": "vtable", - "view": "View", - # dplyr - "anti join": "anti_join", - "arrange": "arrange", - "as tibble": "as_tibble", - "bind rows": "bind_rows", - "case when": "case_when", - "distinct": "distinct", - "everything": "everything", - "filter": "filter", - "full join": "full_join", - "glimpse": "glimpse", - "group by": "group_by", - "inner join": "inner_join", - "left join": "left_join", - "mutate": "mutate", - "pull": "pull", - "rename all": "rename_all", - "rename": "rename", - "right join": "right_join", - "select all": "select_all", - "select": "select", - "semi join": "semi_join", - "starts with": "starts_with", - "summarise": "summarise", - "tibble": "tibble", - "ungroup": "ungroup", - # ggplot2 - "coord cartesian": "coor_cartesian", - "element text": "element_text", - "element blank": "element_blank", - "facet grid": "facet_grid", - "facet wrap": "facet_wrap", - "geom A B line": "geom_abline", - "geom area": "geom_area", - "geom bar": "geom_bar", - "geom boxplot": "geom_boxplot", - "geom histogram": "geom_histogram", - "geom horizontal line": "geom_hline", - "geom line": "geom_line", - "geom point": "geom_point", - "geom pointrange": "geom_pointrange", - "geom polygon": "geom_polygon", - "geom ribbon": "geom_ribbon", - "geom segment": "geom_segment", - "geom smooth": "geom_smooth", - "geom vertical line": "geom_vline", - "geom violin": "geom_violin", - "labs": "labs", - "scale colour manual": "scale_colour_manual", - "scale fill manual": "scale_fill_manual", - "scale fill viridis": "scale_fill_viridis_c", - "scale colour viridis": "scale_colour_viridis_c", - "theme set": "theme_set", - # purrr - "map character": "map_chr", - "map data frame": "map_dfr", - "map double": "map_dbl", - "map": "map", - "P map": "pmap", - # stringr - "string contains": "str_detect", - "string detect": "str_detect", - "string replace all": "str_replace_all", - "string replace": "str_replace", - # tidyr - "drop NA": "drop_na", - "gather": "gather", - "nest": "nest", - "pivot longer": "pivot_longer", - "pivot wider": "pivot_wider", - "spread": "spread", - "un nest": "unnest", - # readr, readxl, and other non-base R reading/writing - "read E views": "readEViews", - "read CSV": "read_csv", - "read RDS": "read_rds", - "read excel": "read_xlsx", - "write CSV": "write_csv", - "write RDS": "write_rds", - # Shiny - "shine ui": "shinyUI", - "title panel": "titlePanel", - "main panel": "mainPanel", - "tab panel": "tabPanel", - "navigation list panel": "navlistPanel", - "conditional panel": "conditionalPanel", - "input panel": "inputPanel", - "ui output": "uiOutput", - "text output": "textOutput", - "table output": "tableOutput", - "data table output": "dataTableOutput", - "select size input": "selectizeInput", - "action button": "actionButton", - "download button": "downloadButton", - "render ui": "renderUI", - "observe event": "observeEvent", - # Base -} - -ctx.lists["user.code_libraries"] = { - "bayes plot": "bayesplot", - "BRMS": "brms", - "cable": "kable", - "car": "car", - "D plier": "dplyr", - "dev tools": "devtools", - "future": "future", - "furr": "furrr", - "gap minder": "gapminder", - "gee animate": "gganimate", - "gee highlight": "gghighlight", - "gee map": "ggmap", - "gee repel": "ggrepel", - "grid extra": "gridExtra", - "gee gee plot": "ggplot2", - "GLMM TMB": "glmmTMB", - "here": "here", - "knitter": "knitr", - "LME four": "lme4", - "LM test": "lmtest", - "lubridate": "lubridate", - "margins": "margins", - "inla": "INLA", - "NLME": "nlme", - "psych": "psych", - "purr": "purrr", - "R markdown": "rmarkdown", - "R stan": "rstan", - "R stan arm": "rstanarm", - "R color brewer": "RColorBrewer", - "read R": "readr", - "stargazer": "stargazer", - "tidy verse": "tidyverse", - "tidier": "tidyr", - "tidy bayes": "tidybayes", - "TMB": "TMB", - "vee table": "vtable", - "viridis": "viridis", - "viridis light": "viridisLite", - "shiny alert": "shinyalert", -} - - -@ctx.action_class("user") -class user_actions: - def code_insert_function(text: str, selection: str): - if selection: - text = text + "({})".format(selection) - else: - text = text + "()" - actions.user.paste(text) - actions.edit.left() - - def code_private_function(text: str): - result = "{} <- function () {{\n\n}}".format( - actions.user.formatted_text( - text, settings.get("user.code_private_function_formatter") - ) - ) - - actions.user.paste(result) - actions.edit.up() - actions.edit.up() - actions.edit.line_end() - actions.edit.left() - actions.edit.left() - actions.edit.left() - - def code_insert_library(text: str, selection: str): - actions.insert("library()") - actions.edit.left() - actions.clip.set_text(text + "{}".format(selection)) - actions.edit.paste() diff --git a/talon/community/community-cursorless-0.4.0/lang/r/r.talon b/talon/community/community-cursorless-0.4.0/lang/r/r.talon deleted file mode 100644 index 200e6ac..0000000 --- a/talon/community/community-cursorless-0.4.0/lang/r/r.talon +++ /dev/null @@ -1,74 +0,0 @@ -mode: user.r -mode: command -and code.language: r -- -# TODO: functions - -tag(): user.code_operators -tag(): user.code_comment -tag(): user.code_generic -settings(): - user.code_private_function_formatter = "SNAKE_CASE" - user.code_protected_function_formatter = "SNAKE_CASE" - user.code_public_function_formatter = "SNAKE_CASE" - user.code_private_variable_formatter = "SNAKE_CASE" - user.code_protected_variable_formatter = "SNAKE_CASE" - user.code_public_variable_formatter = "SNAKE_CASE" -action(user.code_operator_assignment): " <- " -action(user.code_operator_subtraction): " - " -action(user.code_operator_addition): " + " -action(user.code_operator_multiplication): " * " -action(user.code_operator_exponent): " ** " -action(user.code_operator_division): " / " -action(user.code_operator_modulo): " %% " -action(user.code_operator_equal): " == " -action(user.code_operator_not_equal): " != " -action(user.code_operator_greater_than): " > " -action(user.code_operator_greater_than_or_equal_to): " >= " -action(user.code_operator_less_than): " < " -action(user.code_operator_less_than_or_equal_to): " <= " -action(user.code_operator_in): " %in% " -action(user.code_operator_and): " & " -action(user.code_operator_or): " | " -action(user.code_operator_bitwise_and): " & " -action(user.code_null): "NULL" -action(user.code_state_if): - insert("if () {}") - key(left enter up end left:3) -action(user.code_state_else_if): - insert(" else if () {}") - key(left enter up end left:3) -action(user.code_state_else): - insert(" else {}") - key(left enter) -action(user.code_state_for): - insert("for ( in ) {}") - key(left enter up end left:7) -action(user.code_state_while): - insert("while () {}") - key(left enter up end left:3) -toggle library: user.code_toggle_libraries() -library : - user.code_insert_library(code_libraries, "") - key(end enter) -action(user.code_import): - insert("library()") - key(left) -action(user.code_comment): "#" -action(user.code_state_return): - insert("return()") - key(left) -action(user.code_break): "break" -action(user.code_next): "next" -action(user.code_true): "TRUE" -action(user.code_false): "FALSE" - -# R specific commands -(chain|pipe that): - key(end) - " %>%" - key(enter) -state na: - insert("NA") - -^function define $: user.code_private_function(text) diff --git a/talon/community/community-cursorless-0.4.0/lang/snippets.talon b/talon/community/community-cursorless-0.4.0/lang/snippets.talon deleted file mode 100644 index d31551f..0000000 --- a/talon/community/community-cursorless-0.4.0/lang/snippets.talon +++ /dev/null @@ -1,7 +0,0 @@ -tag: user.snippets -- -snip {user.snippets}: user.snippet_insert(user.snippets) -snip hunt : user.snippet_search(user.text) -snip hunt: user.snippet_search("") -snip create: user.snippet_create() -snip show: user.snippet_toggle() diff --git a/talon/community/community-cursorless-0.4.0/lang/sql.talon b/talon/community/community-cursorless-0.4.0/lang/sql.talon deleted file mode 100644 index 7ef80bd..0000000 --- a/talon/community/community-cursorless-0.4.0/lang/sql.talon +++ /dev/null @@ -1,20 +0,0 @@ -app: datagrip - -- -select: "SELECT " -star: "*" -from: "FROM " -select star from: "SELECT * FROM " -where: "WHERE " -order by: "ORDER BY " -descending: " DESC" -ascending: " ASC" -dot i d: ".id" -is not null: " IS NOT NULL" -is null: " IS NULL" -inner join: - insert("INNER JOIN ON ") - key(left) - key(left) - key(left) - key(left) diff --git a/talon/community/community-cursorless-0.4.0/lang/talon/talon.py b/talon/community/community-cursorless-0.4.0/lang/talon/talon.py deleted file mode 100644 index b8ea504..0000000 --- a/talon/community/community-cursorless-0.4.0/lang/talon/talon.py +++ /dev/null @@ -1,26 +0,0 @@ -from talon import Module, Context, actions, ui, imgui, clip, settings - -ctx = Context() -ctx.matches = r""" -mode: user.talon -mode: command -and code.language: talon -""" -ctx.lists["user.code_functions"] = { - "insert": "insert", - "key": "key", - "print": "print", - "repeat": "repeat", -} - - -@ctx.action_class("user") -class user_actions: - def code_insert_function(text: str, selection: str): - if selection: - text = text + "({})".format(selection) - else: - text = text + "()" - - actions.user.paste(text) - actions.edit.left() diff --git a/talon/community/community-cursorless-0.4.0/lang/talon/talon.talon b/talon/community/community-cursorless-0.4.0/lang/talon/talon.talon deleted file mode 100644 index f7c2a31..0000000 --- a/talon/community/community-cursorless-0.4.0/lang/talon/talon.talon +++ /dev/null @@ -1,51 +0,0 @@ -mode: user.talon -mode: command -and code.language: talon -- -tag(): user.code_operators -tag(): user.code_comment -action(user.code_operator_and): " and " -action(user.code_operator_or): " or " -action(user.code_operator_subtraction): " - " -action(user.code_operator_addition): " + " -action(user.code_operator_multiplication): " * " -action(user.code_operator_division): " / " -action(user.code_operator_assignment): " = " -action(user.code_comment): "#" - -dot talon: insert(".talon") -#defintion blocks for the context -action block: - insert("action():") - edit.left() - edit.left() -setting block: - insert("settings():\n\t") -#context requirements -win require: - insert("os: windows\n") -mac require: - insert("os: mac\n") -linux require: - insert("os: linux\n") -title require: - insert("win.title: ") -app require: - insert("app: ") -tag require: - insert("tag: ") -tag set: - insert("tag(): ") -#commands for dictating key combos -key over: "{keys}" -key over: "{modifiers}" -#funk commands, consistent with other languages -toggle funk: user.code_toggle_functions() -funk : - user.code_insert_function(code_functions, "") -funk cell : - user.code_select_function(number - 1, "") -funk wrap : - user.code_insert_function(code_functions, edit.selected_text()) -funk wrap : - user.code_select_function(number - 1, edit.selected_text()) diff --git a/talon/community/community-cursorless-0.4.0/lang/typescript/typescript.py b/talon/community/community-cursorless-0.4.0/lang/typescript/typescript.py deleted file mode 100644 index ea1598d..0000000 --- a/talon/community/community-cursorless-0.4.0/lang/typescript/typescript.py +++ /dev/null @@ -1,83 +0,0 @@ -from talon import Module, Context, actions, ui, imgui, settings - -ctx = Context() -ctx.matches = r""" -mode: user.typescript -mode: command -and code.language: typescript -""" -# tbd -ctx.lists["user.code_functions"] = { -# "integer": "int.TryParse", - "print": "console.log", -# "string": ".ToString", -} - - -@ctx.action_class("user") -class user_actions: - def code_insert_function(text: str, selection: str): - if selection: - text = text + "({})".format(selection) - else: - text = text + "()" - - actions.user.paste(text) - actions.edit.left() - - def code_private_function(text: str): - """Inserts private function declaration""" - result = "private function {}".format( - actions.user.formatted_text( - text, settings.get("user.code_private_function_formatter") - ) - ) - - actions.user.code_insert_function(result, None) - - # def code_private_static_function(text: str): - # """Inserts private static function""" - # result = "private static void {}".format( - # actions.user.formatted_text( - # text, settings.get("user.code_private_function_formatter") - # ) - # ) - - # actions.user.code_insert_function(result, None) - - def code_protected_function(text: str): - result = "protected function {}".format( - actions.user.formatted_text( - text, settings.get("user.code_protected_function_formatter") - ) - ) - - actions.user.code_insert_function(result, None) - - # def code_protected_static_function(text: str): - # result = "protected static void {}".format( - # actions.user.formatted_text( - # text, settings.get("user.code_protected_function_formatter") - # ) - # ) - - # actions.user.code_insert_function(result, None) - - def code_public_function(text: str): - result = "public function {}".format( - actions.user.formatted_text( - text, settings.get("user.code_public_function_formatter") - ) - ) - - actions.user.code_insert_function(result, None) - - # def code_public_static_function(text: str): - # result = "public static void {}".format( - # actions.user.formatted_text( - # text, settings.get("user.code_public_function_formatter") - # ) - # ) - - # actions.user.code_insert_function(result, None) - diff --git a/talon/community/community-cursorless-0.4.0/lang/typescript/typescript.talon b/talon/community/community-cursorless-0.4.0/lang/typescript/typescript.talon deleted file mode 100644 index fe042fb..0000000 --- a/talon/community/community-cursorless-0.4.0/lang/typescript/typescript.talon +++ /dev/null @@ -1,183 +0,0 @@ -mode: user.typescript -mode: command -and code.language: typescript -- -tag(): user.code_operators -tag(): user.code_comment -tag(): user.code_generic - -settings(): - user.code_private_function_formatter = "PRIVATE_CAMEL_CASE" - user.code_protected_function_formatter = "PRIVATE_CAMEL_CASE" - user.code_public_function_formatter = "PRIVATE_CAMEL_CASE" - user.code_private_variable_formatter = "PRIVATE_CAMEL_CASE" - user.code_protected_variable_formatter = "PRIVATE_CAMEL_CASE" - user.code_public_variable_formatter = "PRIVATE_CAMEL_CASE" - -action(user.code_is_not_null): " !== null" - -action(user.code_is_null): " === null" - -action(user.code_type_dictionary): - insert("{}") - key(left) - -action(user.code_state_if): - insert("if ()") - key(left) - -action(user.code_state_else_if): - insert(" else if ()") - key(left) - -action(user.code_state_else): - insert(" else {}") - key(left enter) - -action(user.code_block): - insert("{}") - key(left enter) - -action(user.code_self): "this" - -action(user.code_state_while): - insert("while ()") - key(left) - -action(user.code_state_do): - insert("do ") - -action(user.code_state_return): - insert("return ") - -action(user.code_state_for): - insert("for ()") - key(left) - -action(user.code_state_switch): - insert("switch ()") - key(left) - -action(user.code_state_case): - insert("case :") - key(left) - -action(user.code_state_go_to): "" - -action(user.code_import): "import " -state export: "export " - -action(user.code_from_import): - insert(" from \"\"") - key(left) - -action(user.code_type_class): "class " -state interface: "interface " -state type: "type " - -action(user.code_include): "" - -action(user.code_include_system): "" - -action(user.code_include_local): "" - -action(user.code_type_definition): "" - -action(user.code_typedef_struct): "" - -action(user.code_state_for_each): - insert(".forEach()") - key(left) - -action(user.code_break): "break;" -action(user.code_next): "continue;" -action(user.code_true): "true" -action(user.code_false): "false" - -action(user.code_null): "null" - -action(user.code_operator_indirection): "" -action(user.code_operator_address_of): "" -action(user.code_operator_structure_dereference): "" -action(user.code_operator_lambda): " => " -action(user.code_operator_subscript): - insert("[]") - key(left) -action(user.code_operator_assignment): " = " -action(user.code_operator_subtraction): " - " -action(user.code_operator_subtraction_assignment): " -= " -action(user.code_operator_addition): " + " -action(user.code_operator_addition_assignment): " += " -action(user.code_operator_multiplication): " * " -action(user.code_operator_multiplication_assignment): " *= " -action(user.code_operator_exponent): " ** " -action(user.code_operator_division): " / " -action(user.code_operator_division_assignment): " /= " -action(user.code_operator_modulo): " % " -action(user.code_operator_modulo_assignment): " %= " -action(user.code_operator_equal): " == " -action(user.code_operator_not_equal): " != " - treek: " === " - nottreek: " !== " -action(user.code_operator_greater_than): " > " -action(user.code_operator_greater_than_or_equal_to): " >= " -action(user.code_operator_less_than): " < " -action(user.code_operator_less_than_or_equal_to): " <= " -action(user.code_operator_and): " && " -action(user.code_operator_or): " || " - null coal: " ?? " -action(user.code_operator_bitwise_and): " & " -action(user.code_operator_bitwise_and_assignment): " &= " -action(user.code_operator_bitwise_or): " | " -action(user.code_operator_bitwise_or_assignment): " |= " -action(user.code_operator_bitwise_exclusive_or): " ^ " -action(user.code_operator_bitwise_exclusive_or_assignment): " ^= " -action(user.code_operator_bitwise_left_shift): " << " -action(user.code_operator_bitwise_left_shift_assignment): " <<= " -action(user.code_operator_bitwise_right_shift): " >> " -action(user.code_operator_bitwise_right_shift_assignment): " >>= " - cast: " as " - -state const: "const " - -state let: "let " - -state var: "var " - -state async: "async " - - await: "await " - -state map: - insert(".map()") - key(left) - -state filter: - insert(".filter()") - key(left) - -state reduce: - insert(".reduce()") - key(left) - -state concat: - insert(".concat()") - key(left) - -state length: insert(".length") - -state log: - insert("console.log()") - key(left) - -state quote var: - insert("${}") - key(left) - -state spread: "..." - -funky $: user.code_default_function(text) -pro funky $: user.code_protected_function(text) -pub funky $: user.code_public_function(text) - - new: insert("new ") \ No newline at end of file diff --git a/talon/community/community-cursorless-0.4.0/lang/vimscript/vimscript.py b/talon/community/community-cursorless-0.4.0/lang/vimscript/vimscript.py deleted file mode 100644 index 1b78e95..0000000 --- a/talon/community/community-cursorless-0.4.0/lang/vimscript/vimscript.py +++ /dev/null @@ -1,39 +0,0 @@ -from talon import Context, Module, actions, settings - -mod = Module() -ctx = Context() -ctx.lists["self.vimscript_functions"] = { - "string len": "strlen", - "get line": "getline", - "set line": "setline", - "length": "len", -} - -ctx.lists["self.vimscript_scope"] = { - "argument": "a:", - "arg": "a:", - "buffer": "b:", - "buf": "b:", - "window": "w:", - "win": "w:", - "tab": "t:", - "special": "v:", - "global": "g:", - "local": "l:", - "script local": "s:", -} - -mod.list("vimscript_functions", desc="Standard built-in vimscript functions") -mod.list("vimscript_scope", desc="vimscript scoping types for functions and variables") - - -@mod.capture(rule="{self.vimscript_functions}") -def vimscript_functions(m) -> str: - "Returns a string" - return m.vimscript_functions - - -@mod.capture(rule="{self.vimscript_scope}") -def vimscript_scope(m) -> str: - "Returns a string" - return m.vimscript_scope diff --git a/talon/community/community-cursorless-0.4.0/lang/vimscript/vimscript.talon b/talon/community/community-cursorless-0.4.0/lang/vimscript/vimscript.talon deleted file mode 100644 index 5af723c..0000000 --- a/talon/community/community-cursorless-0.4.0/lang/vimscript/vimscript.talon +++ /dev/null @@ -1,72 +0,0 @@ - -mode: user.vimscript -mode: command -and code.language: vimscript -- -tag(): user.code_operators -tag(): user.code_comment -tag(): user.code_generic -# XXX - revisit these -settings(): - user.code_private_function_formatter = "SNAKE_CASE" - user.code_protected_function_formatter = "SNAKE_CASE" - user.code_public_function_formatter = "SNAKE_CASE" - user.code_private_variable_formatter = "SNAKE_CASE" - user.code_protected_variable_formatter = "SNAKE_CASE" - user.code_public_variable_formatter = "SNAKE_CASE" - - -### -# Generic Actions - see appropriate generic talon file for spoken command -### - -# operators - see lang/operators.talon -action(user.code_operator_assignment): " = " -action(user.code_operator_subtraction): " - " -action(user.code_operator_subtraction_assignment): " -= " -action(user.code_operator_addition): " + " -action(user.code_operator_addition_assignment): " += " -action(user.code_operator_multiplication): " * " -action(user.code_operator_multiplication_assignment): " *= " -action(user.code_operator_division): " / " -action(user.code_operator_division_assignment): " /= " - -# comments - see lang/code_comment.talon -action(user.code_comment): "\"" - -# conditionals - see lang/programming.talon -action(user.code_state_if): - insert("if ") -action(user.code_state_else_if): - insert("elseif ") -action(user.code_state_else): - insert("else") - -action(user.code_private_function): "function " -action(user.code_protected_function): "function " -action(user.code_public_function): "function " - - -### -# VIM Script Specific -### -assign [] (variable|var) [] [over]: - insert("let ") - insert(vimscript_scope or '') - user.code_private_variable_formatter(text) - -[] (variable|var) [] [over]: - insert(vimscript_scope or '') - user.code_private_variable_formatter(text) - -# see lang/vimscript/vimscript.py for list -: - insert("{vimscript_functions} ") - -# XXX - possibly overlap with some programming.talon -state command: "command! " -state end if: "endif" -state end for: "endfor" -state end while: "endwhile" -state end function: "endfunction" -state continue: "continue" diff --git a/talon/community/community-cursorless-0.4.0/misc/abbreviate.talon b/talon/community/community-cursorless-0.4.0/misc/abbreviate.talon deleted file mode 100644 index 47004b9..0000000 --- a/talon/community/community-cursorless-0.4.0/misc/abbreviate.talon +++ /dev/null @@ -1,2 +0,0 @@ -- -(abbreviate|abreviate|brief) {user.abbreviation}: "{abbreviation}" diff --git a/talon/community/community-cursorless-0.4.0/misc/extensions.talon b/talon/community/community-cursorless-0.4.0/misc/extensions.talon deleted file mode 100644 index 99bab02..0000000 --- a/talon/community/community-cursorless-0.4.0/misc/extensions.talon +++ /dev/null @@ -1 +0,0 @@ -{user.file_extension}: "{file_extension}" \ No newline at end of file diff --git a/talon/community/community-cursorless-0.4.0/misc/formatters.talon b/talon/community/community-cursorless-0.4.0/misc/formatters.talon deleted file mode 100644 index b7b646c..0000000 --- a/talon/community/community-cursorless-0.4.0/misc/formatters.talon +++ /dev/null @@ -1,17 +0,0 @@ -#provide both anchored and unachored commands via 'over' -phrase $: user.insert_formatted(text, "NOOP") -phrase halt: user.insert_formatted(text, "NOOP") -{user.prose_formatter} $: user.insert_formatted(prose, prose_formatter) -{user.prose_formatter} halt: user.insert_formatted(prose, prose_formatter) -+$: user.insert_many(format_text_list) -+ halt: user.insert_many(format_text_list) - that: user.formatters_reformat_selection(user.formatters) -word : user.insert_formatted(user.word, "NOOP") -format help: user.formatters_help_toggle() -recent list: user.toggle_phrase_history() -recent repeat : insert(user.get_recent_phrase(number_small)) -recent copy : clip.set_text(user.get_recent_phrase(number_small)) -select that: user.select_last_phrase() -nope that | scratch that: user.clear_last_phrase() -nope that was : user.formatters_reformat_last(formatters) -trot : "{word} " \ No newline at end of file diff --git a/talon/community/community-cursorless-0.4.0/misc/git.talon b/talon/community/community-cursorless-0.4.0/misc/git.talon deleted file mode 100644 index 4c26050..0000000 --- a/talon/community/community-cursorless-0.4.0/misc/git.talon +++ /dev/null @@ -1,101 +0,0 @@ -tag: terminal -and tag: user.git -- -# Standard commands -git add patch: "git add . -p\n" -git add: "git add " -git add everything: "git add -u\n" -git bisect: "git bisect " -git blame: "git blame " -git branch: "git branch " -git remote branches: "git branch --remote\n" -git branch : "git branch {text}" -git checkout: "git checkout " -git checkout master: "git checkout master\n" -git checkout main: "git checkout main\n" -git checkout : "git checkout {text}" -git cherry pick: "git cherry-pick " -git cherry pick continue: "git cherry-pick --continue " -git cherry pick abort: "git cherry-pick --abort " -git cherry pick skip: "git cherry-pick --skip " -git clone: "git clone " -git commit message : "git commit -m '{text}'" -git commit: "git commit\n" -git diff (colour|color) words: "git diff --color-words " -git diff: "git diff " -git diff cached: "git diff --cached\n" -git fetch: "git fetch\n" -git fetch : "git fetch {text}" -git fetch prune: "git fetch --prune\n" -git in it: "git init\n" -git log all: "git log\n" -git log all changes: "git log -c\n" -git log: "git log " -git log changes: "git log -c " -git merge: "git merge " -git merge :"git merge {text}" -git move: "git mv " -git new branch: "git checkout -b " -git pull: "git pull\n" -git pull origin: "git pull origin " -git pull rebase: "git pull --rebase\n" -git pull fast forward: "git pull --ff-only\n" -git pull : "git pull {text} " -git push: "git push\n" -git push origin: "git push origin " -git push up stream origin: "git push -u origin" -git push : "git push {text} " -git push tags: "git push --tags\n" -git rebase: "git rebase\n" -git rebase continue: "git rebase --continue" -git rebase skip: "git rebase --skip" -git remove: "git rm " -git (remove|delete) branch: "git branch -d " -git (remove|delete) remote branch: "git push --delete origin " -git reset: "git reset " -git reset soft: "git reset --soft " -git reset hard: "git reset --hard " -git restore: "git restore " -git restore staged: "git restore --staged " -git remote show origin: "git remote show origin\n" -git remote add upstream: "git remote add upstream " -git show: "git show " -git stash pop: "git stash pop\n" -git stash: "git stash\n" -git stash apply: "git stash apply\n" -git stash list: "git stash list\n" -git stash show: "git stash show" -git status: "git status\n" -git submodule add: "git submodule add " -git tag: "git tag " - -# Convenience -git edit config: "git config --local -e\n" - -git clone clipboard: - insert("git clone ") - edit.paste() - key(enter) -git diff highlighted: - edit.copy() - insert("git diff ") - edit.paste() - key(enter) -git diff clipboard: - insert("git diff ") - edit.paste() - key(enter) -git add highlighted: - edit.copy() - insert("git add ") - edit.paste() - key(enter) -git add clipboard: - insert("git add ") - edit.paste() - key(enter) -git commit highlighted: - edit.copy() - insert("git add ") - edit.paste() - insert("\ngit commit\n") diff --git a/talon/community/community-cursorless-0.4.0/misc/git_add_patch.talon b/talon/community/community-cursorless-0.4.0/misc/git_add_patch.talon deleted file mode 100644 index 78acb22..0000000 --- a/talon/community/community-cursorless-0.4.0/misc/git_add_patch.talon +++ /dev/null @@ -1,19 +0,0 @@ -tag: terminal -and tag: user.git -title: /git add .*\-p/ -- -yank: - key(y) - key(enter) -near: - key(n) - key(enter) -quench: - key(q) - key(enter) -drum: - key(d) - key(enter) -air: - key(a) - key(enter) diff --git a/talon/community/community-cursorless-0.4.0/misc/help.talon b/talon/community/community-cursorless-0.4.0/misc/help.talon deleted file mode 100644 index 290ae06..0000000 --- a/talon/community/community-cursorless-0.4.0/misc/help.talon +++ /dev/null @@ -1,7 +0,0 @@ -help alphabet: user.help_alphabet(user.get_alphabet()) -help context$: user.help_context() -help active$: user.help_context_enabled() -help search $: user.help_search(text) -help context {user.help_contexts}$: user.help_selected_context(help_contexts) - - diff --git a/talon/community/community-cursorless-0.4.0/misc/help_open.talon b/talon/community/community-cursorless-0.4.0/misc/help_open.talon deleted file mode 100644 index 94bd674..0000000 --- a/talon/community/community-cursorless-0.4.0/misc/help_open.talon +++ /dev/null @@ -1,7 +0,0 @@ -mode: user.help -- -help next: user.help_next() -help previous: user.help_previous() -help : user.help_select_index(number - 1) -help return: user.help_return() -help close: user.help_hide() \ No newline at end of file diff --git a/talon/community/community-cursorless-0.4.0/misc/history.talon b/talon/community/community-cursorless-0.4.0/misc/history.talon deleted file mode 100644 index a1aac23..0000000 --- a/talon/community/community-cursorless-0.4.0/misc/history.talon +++ /dev/null @@ -1,4 +0,0 @@ -command history: user.history_toggle() -command history clear: user.history_clear() -command history less: user.history_less() -command history more: user.history_more() diff --git a/talon/community/community-cursorless-0.4.0/misc/keeper.talon b/talon/community/community-cursorless-0.4.0/misc/keeper.talon deleted file mode 100644 index 4b3ba9a..0000000 --- a/talon/community/community-cursorless-0.4.0/misc/keeper.talon +++ /dev/null @@ -1 +0,0 @@ -^keeper: skip() \ No newline at end of file diff --git a/talon/community/community-cursorless-0.4.0/misc/keys.talon b/talon/community/community-cursorless-0.4.0/misc/keys.talon deleted file mode 100644 index 552b771..0000000 --- a/talon/community/community-cursorless-0.4.0/misc/keys.talon +++ /dev/null @@ -1,8 +0,0 @@ -: key(letter) -uppercase [(lowercase | sunk)]: - user.insert_formatted(letters, "ALL_CAPS") -: key(symbol_key) -: key(function_key) -: key(special_key) - : key("{modifiers}-{unmodified_key}") -flay: key(escape:5) \ No newline at end of file diff --git a/talon/community/community-cursorless-0.4.0/misc/macro.talon b/talon/community/community-cursorless-0.4.0/misc/macro.talon deleted file mode 100644 index 08a44c3..0000000 --- a/talon/community/community-cursorless-0.4.0/misc/macro.talon +++ /dev/null @@ -1,4 +0,0 @@ -macro record: user.macro_record() -macro stop: user.macro_stop() -macro play: user.macro_play() -[macro] sleep [] [seconds]: user.macro_insert_wait(number_small or 0) \ No newline at end of file diff --git a/talon/community/community-cursorless-0.4.0/misc/media.talon b/talon/community/community-cursorless-0.4.0/misc/media.talon deleted file mode 100644 index 9aed77f..0000000 --- a/talon/community/community-cursorless-0.4.0/misc/media.talon +++ /dev/null @@ -1,7 +0,0 @@ -volume up: key(volup) -volume down: key(voldown) -set volume : user.media_set_volume(number) -(volume|media) mute: key(mute) -[media] play next: key(next) -[media] play previous: key(prev) -media (play | pause): key(play) diff --git a/talon/community/community-cursorless-0.4.0/misc/messaging.talon b/talon/community/community-cursorless-0.4.0/misc/messaging.talon deleted file mode 100644 index dc60ec2..0000000 --- a/talon/community/community-cursorless-0.4.0/misc/messaging.talon +++ /dev/null @@ -1,23 +0,0 @@ -tag: user.messaging -- -# Navigation -previous (workspace | server): user.messaging_workspace_previous() -next (workspace | server): user.messaging_workspace_next() -channel: user.messaging_open_channel_picker() -channel : - user.messaging_open_channel_picker() - insert(user.formatted_text(user.text, "ALL_LOWERCASE")) - sleep(100ms) - chan : - user.messaging_open_channel_picker() - insert(user.formatted_text(user.text, "ALL_LOWERCASE")) - sleep(100ms) - key(enter) -channel up: user.messaging_channel_previous() -channel down: user.messaging_channel_next() -([channel] unread last | gopreev): user.messaging_unread_previous() -([channel] unread next | goneck): user.messaging_unread_next() -go (find | search): user.messaging_open_search() -mark (all | workspace | server) read: user.messaging_mark_workspace_read() -mark channel read: user.messaging_mark_channel_read() -upload file: user.messaging_upload_file() diff --git a/talon/community/community-cursorless-0.4.0/misc/microphone_selection.talon b/talon/community/community-cursorless-0.4.0/misc/microphone_selection.talon deleted file mode 100644 index b12ef8d..0000000 --- a/talon/community/community-cursorless-0.4.0/misc/microphone_selection.talon +++ /dev/null @@ -1,2 +0,0 @@ -^microphone show$: user.microphone_selection_toggle() -^microphone pick $: user.microphone_select(number_small) \ No newline at end of file diff --git a/talon/community/community-cursorless-0.4.0/misc/momentary.talon b/talon/community/community-cursorless-0.4.0/misc/momentary.talon deleted file mode 100644 index e12522f..0000000 --- a/talon/community/community-cursorless-0.4.0/misc/momentary.talon +++ /dev/null @@ -1,4 +0,0 @@ -# mode: sleep -mode: dictation -- -^listen $: user.momentary() diff --git a/talon/community/community-cursorless-0.4.0/misc/momentary_command.talon b/talon/community/community-cursorless-0.4.0/misc/momentary_command.talon deleted file mode 100644 index 075df26..0000000 --- a/talon/community/community-cursorless-0.4.0/misc/momentary_command.talon +++ /dev/null @@ -1 +0,0 @@ -^listen: skip() diff --git a/talon/community/community-cursorless-0.4.0/misc/mouse.talon b/talon/community/community-cursorless-0.4.0/misc/mouse.talon deleted file mode 100644 index ac3755b..0000000 --- a/talon/community/community-cursorless-0.4.0/misc/mouse.talon +++ /dev/null @@ -1,103 +0,0 @@ -control mouse: user.mouse_toggle_control_mouse() -zoom mouse: user.mouse_toggle_zoom_mouse() -camera overlay: user.mouse_toggle_camera_overlay() -run calibration: user.mouse_calibrate() -touch: - mouse_click(0) - # close the mouse grid if open - user.grid_close() - -right click: - mouse_click(1) - # close the mouse grid if open - user.grid_close() - -midclick: - mouse_click(2) - # close the mouse grid - user.grid_close() - -#see keys.py for modifiers. -#defaults -#command -#control -#option = alt -#shift -#super = windows key - touch: - key("{modifiers}:down") - mouse_click(0) - key("{modifiers}:up") - # close the mouse grid - user.grid_close() - righty: - key("{modifiers}:down") - mouse_click(1) - key("{modifiers}:up") - # close the mouse grid - user.grid_close() -dubclick: - mouse_click() - mouse_click() - # close the mouse grid - user.grid_close() -(tripclick | triplick): - mouse_click() - mouse_click() - mouse_click() - # close the mouse grid - user.grid_close() -drag: - user.mouse_drag() - # close the mouse grid - user.grid_close() -(scroll | school) down: user.mouse_scroll_down() -(scroll | school) down here: - user.mouse_move_center_active_window() - user.mouse_scroll_down() -(scroll | school) tiny [down]: mouse_scroll(20) -(scroll | school) tiny [down] here: - user.mouse_move_center_active_window() - mouse_scroll(20) -(scroll | school) downer: user.mouse_scroll_down_continuous() -(scroll | school) downer here: - user.mouse_move_center_active_window() - user.mouse_scroll_down_continuous() -(scroll | school) up: user.mouse_scroll_up() -(scroll | school) up here: - user.mouse_scroll_up() -(scroll | school) tiny up: mouse_scroll(-20) -(scroll | school) tiny up here: - user.mouse_move_center_active_window() - mouse_scroll(-20) -(scroll | school) upper: user.mouse_scroll_up_continuous() -(scroll | school) upper here: - user.mouse_move_center_active_window() - user.mouse_scroll_up_continuous() -(scroll | school) gaze: user.mouse_gaze_scroll() -(scroll | school) gaze here: - user.mouse_move_center_active_window() - user.mouse_gaze_scroll() -(scroll | school) stop: user.mouse_scroll_stop() -(scroll | school) stop here: - user.mouse_move_center_active_window() - user.mouse_scroll_stop() -(scroll | school) left: mouse_scroll(0, -40) -(scroll | school) left here: - user.mouse_move_center_active_window() - mouse_scroll(0, -40) -(scroll | school) tiny left: mouse_scroll(0, -20) -(scroll | school) tiny left here: - user.mouse_move_center_active_window() - mouse_scroll(0, -20) -(scroll | school) right: mouse_scroll(0, 40) -(scroll | school) right here: - user.mouse_move_center_active_window() - mouse_scroll(0, 40) -(scroll | school) tiny right: mouse_scroll(0, 20) -(scroll | school) tiny right here: - user.mouse_move_center_active_window() - mouse_scroll(0, 20) -curse yes: user.mouse_show_cursor() -curse no: user.mouse_hide_cursor() -copy mouse position: user.copy_mouse_position() \ No newline at end of file diff --git a/talon/community/community-cursorless-0.4.0/misc/multiple_cursors.talon b/talon/community/community-cursorless-0.4.0/misc/multiple_cursors.talon deleted file mode 100644 index 32d9efe..0000000 --- a/talon/community/community-cursorless-0.4.0/misc/multiple_cursors.talon +++ /dev/null @@ -1,10 +0,0 @@ -tag: user.multiple_cursors -- -cursor multiple: user.multi_cursor_enable() -cursor stop: user.multi_cursor_disable() -cursor up: user.multi_cursor_add_above() -cursor down: user.multi_cursor_add_below() -cursor less: user.multi_cursor_select_fewer_occurrences() -cursor more: user.multi_cursor_select_more_occurrences() -cursor all: user.multi_cursor_select_all_occurrences() -cursor lines: user.multi_cursor_add_to_line_ends() diff --git a/talon/community/community-cursorless-0.4.0/misc/repeater.talon b/talon/community/community-cursorless-0.4.0/misc/repeater.talon deleted file mode 100644 index e1e4605..0000000 --- a/talon/community/community-cursorless-0.4.0/misc/repeater.talon +++ /dev/null @@ -1,5 +0,0 @@ -# -1 because we are repeating, so the initial command counts as one - now: core.repeat_command(number-1) -twice: core.repeat_command(1) -(repeat that|again): core.repeat_phrase(1) -repeat that [times]: core.repeat_phrase(number_small) diff --git a/talon/community/community-cursorless-0.4.0/misc/screenshot.talon b/talon/community/community-cursorless-0.4.0/misc/screenshot.talon deleted file mode 100644 index 0a484d3..0000000 --- a/talon/community/community-cursorless-0.4.0/misc/screenshot.talon +++ /dev/null @@ -1,5 +0,0 @@ -^grab window$: user.screenshot_window() -^grab screen$: user.screenshot() -^grab selection$: user.screenshot_selection() -^grab window clip$: user.screenshot_window_clipboard() -^grab screen clip$: user.screenshot_clipboard() \ No newline at end of file diff --git a/talon/community/community-cursorless-0.4.0/misc/search_engines.talon b/talon/community/community-cursorless-0.4.0/misc/search_engines.talon deleted file mode 100644 index fba69ec..0000000 --- a/talon/community/community-cursorless-0.4.0/misc/search_engines.talon +++ /dev/null @@ -1,4 +0,0 @@ -{user.search_engine} hunt : user.search_with_search_engine(search_engine, user.text) -{user.search_engine} (that|this): - text = edit.selected_text() - user.search_with_search_engine(search_engine, text) \ No newline at end of file diff --git a/talon/community/community-cursorless-0.4.0/misc/slow_mode.talon b/talon/community/community-cursorless-0.4.0/misc/slow_mode.talon deleted file mode 100644 index b8e86ad..0000000 --- a/talon/community/community-cursorless-0.4.0/misc/slow_mode.talon +++ /dev/null @@ -1,6 +0,0 @@ -mode: user.slow -- -settings(): - speech.timeout = 0.3 - -fast mode: mode.disable("user.slow") \ No newline at end of file diff --git a/talon/community/community-cursorless-0.4.0/misc/splits.talon b/talon/community/community-cursorless-0.4.0/misc/splits.talon deleted file mode 100644 index 8326235..0000000 --- a/talon/community/community-cursorless-0.4.0/misc/splits.talon +++ /dev/null @@ -1,15 +0,0 @@ -tag: user.splits -- -split right: user.split_window_right() -split left: user.split_window_left() -split down: user.split_window_down() -split up: user.split_window_up() -split (vertically | vertical): user.split_window_vertically() -split (horizontally | horizontal): user.split_window_horizontally() -split flip: user.split_flip() -split window: user.split_window() -split clear: user.split_clear() -split clear all: user.split_clear_all() -split next: user.split_next() -split last: user.split_last() -go split : user.split_number(number) diff --git a/talon/community/community-cursorless-0.4.0/misc/standard.talon b/talon/community/community-cursorless-0.4.0/misc/standard.talon deleted file mode 100644 index 6c75186..0000000 --- a/talon/community/community-cursorless-0.4.0/misc/standard.talon +++ /dev/null @@ -1,44 +0,0 @@ -#(jay son | jason ): "json" -#(http | htp): "http" -#tls: "tls" -#M D five: "md5" -#word (regex | rejex): "regex" -#word queue: "queue" -#word eye: "eye" -#word iter: "iter" -#word no: "NULL" -#word cmd: "cmd" -#word dup: "dup" -#word shell: "shell". -zoom in: edit.zoom_in() -zoom out: edit.zoom_out() -scroll up: edit.page_up() -scroll down: edit.page_down() -copy that: edit.copy() -cut that: edit.cut() -pace that: edit.paste() -show clip: key(cmd-shift-v) -(undo that | nope): edit.undo() -(redo that | yes indeed): edit.redo() -paste match: edit.paste_match_style() -disc: edit.save() -padding: - insert(" ") - key(left) -pour this: user.new_line_below() -drink this: user.new_line_above() - -slow mode: mode.enable("user.slow") - -emoji hunt []: - key(cmd-ctrl-space) - sleep(100ms) - insert(user.text or "") - -^dictate $: - auto_insert(text) - mode.disable("sleep") - mode.disable("command") - mode.enable("dictation") - user.code_clear_language_mode() - mode.disable("user.gdb") \ No newline at end of file diff --git a/talon/community/community-cursorless-0.4.0/misc/tabs.talon b/talon/community/community-cursorless-0.4.0/misc/tabs.talon deleted file mode 100644 index 6e4ea5f..0000000 --- a/talon/community/community-cursorless-0.4.0/misc/tabs.talon +++ /dev/null @@ -1,9 +0,0 @@ -tag: user.tabs -- -tab make: app.tab_open() -tab last: app.tab_previous() -tab next: app.tab_next() -tab close: app.tab_close() -tab reopen: app.tab_reopen() -tab : user.tab_jump(ordinals) -tab final: user.tab_final() diff --git a/talon/community/community-cursorless-0.4.0/misc/talon_helpers.talon b/talon/community/community-cursorless-0.4.0/misc/talon_helpers.talon deleted file mode 100644 index a40fb27..0000000 --- a/talon/community/community-cursorless-0.4.0/misc/talon_helpers.talon +++ /dev/null @@ -1,14 +0,0 @@ -talon copy context pie: user.talon_add_context_clipboard_python() -talon copy context: user.talon_add_context_clipboard() -talon copy title: - title = win.title() - clip.set_text(title) -talon dump context: - name = app.name() - executable = app.executable() - bundle = app.bundle() - title = win.title() - print("Name: {name}") - print("Executable: {executable}") - print("Bundle: {bundle}") - print("Title: {title}") diff --git a/talon/community/community-cursorless-0.4.0/misc/todo_list.talon b/talon/community/community-cursorless-0.4.0/misc/todo_list.talon deleted file mode 100644 index 1e161d1..0000000 --- a/talon/community/community-cursorless-0.4.0/misc/todo_list.talon +++ /dev/null @@ -1,11 +0,0 @@ -tag: user.todo_list -- -done this: user.mark_complete() -cancel this: user.mark_cancelled() - -show inbox: user.show_inbox() -show today: user.show_today() -show upcoming: user.show_upcoming() -show anytime: user.show_anytime() -show someday: user.show_someday() -show logbook: user.show_logbook() \ No newline at end of file diff --git a/talon/community/community-cursorless-0.4.0/misc/toggles.talon b/talon/community/community-cursorless-0.4.0/misc/toggles.talon deleted file mode 100644 index 139597f..0000000 --- a/talon/community/community-cursorless-0.4.0/misc/toggles.talon +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/talon/community/community-cursorless-0.4.0/misc/window_management.talon b/talon/community/community-cursorless-0.4.0/misc/window_management.talon deleted file mode 100644 index 56bfdc2..0000000 --- a/talon/community/community-cursorless-0.4.0/misc/window_management.talon +++ /dev/null @@ -1,42 +0,0 @@ -window (new|open): app.window_open() -window next: app.window_next() -window last: app.window_previous() -window close: app.window_close() -focus : user.switcher_focus(running_applications) -running list: user.switcher_toggle_running() -launch : user.switcher_launch(launch_applications) - -snap : user.snap_window(window_snap_position) -snap next [screen]: user.move_window_next_screen() -snap last [screen]: user.move_window_previous_screen() -snap screen : user.move_window_to_screen(number) -snap : - user.snap_app(running_applications, window_snap_position) -snap [screen] : - user.move_app_to_screen(running_applications, number) -browser: user.switcher_focus("Google Chrome") -coder: user.switcher_focus("Code") -voice code: - user.switcher_focus("Code") - user.vscode("workbench.action.openRecent") - sleep(50ms) - insert("pokey_talon") - key(enter) - sleep(250ms) - -slacker: user.switcher_focus("Slack") -folk things: user.switcher_focus("Things") -folk sim: user.switcher_focus("Simulator") - site [] [{user.file_extension}]: - user.switcher_focus("Google Chrome") - key(cmd-t l p space) - insert(text or "") - insert(file_extension or "") - sleep(500ms) - key(down enter) - site [] [{user.file_extension}]: - user.switcher_focus("Google Chrome") - key(cmd-t l p space) - insert(text or "") - insert(file_extension or "") - sleep(500ms) \ No newline at end of file diff --git a/talon/community/community-cursorless-0.4.0/modes/dictation_mode.talon b/talon/community/community-cursorless-0.4.0/modes/dictation_mode.talon deleted file mode 100644 index e5607ad..0000000 --- a/talon/community/community-cursorless-0.4.0/modes/dictation_mode.talon +++ /dev/null @@ -1,86 +0,0 @@ -mode: dictation -- -^press $: key("{keys}") - -# Everything here should call auto_insert to preserve the state to correctly auto-capitalize/auto-space. -: auto_insert(prose) -new line: "\n" -new paragraph: "\n\n" -cap : - result = user.formatted_text(word, "CAPITALIZE_FIRST_WORD") - auto_insert(result) - -# Navigation -go up (line|lines): - edit.up() - repeat(number_small - 1) -go down (line|lines): - edit.down() - repeat(number_small - 1) -go left (word|words): - edit.word_left() - repeat(number_small - 1) -go right (word|words): - edit.word_right() - repeat(number_small - 1) -go line start: edit.line_start() -go line end: edit.line_end() - -# Selection -select left (word|words): - edit.extend_word_left() - repeat(number_small - 1) -select right (word|words): - edit.extend_word_right() - repeat(number_small - 1) -select left (character|characters): - edit.extend_left() - repeat(number_small - 1) -select right (character|characters): - edit.extend_right() - repeat(number_small - 1) -clear left (word|words): - edit.extend_word_left() - repeat(number_small - 1) - edit.delete() -clear right (word|words): - edit.extend_word_right() - repeat(number_small - 1) - edit.delete() -clear left (character|characters): - edit.extend_left() - repeat(number_small - 1) - edit.delete() -clear right (character|characters): - edit.extend_right() - repeat(number_small - 1) - edit.delete() - -# Formatting -formatted : - user.dictation_insert_raw(format_text) -^format selection $: - user.formatters_reformat_selection(formatters) - -# Corrections -scratch that: user.clear_last_phrase() -scratch selection: edit.delete() -select that: user.select_last_phrase() -spell that : auto_insert(letters) -spell that : - result = user.formatted_text(letters, formatters) - user.auto_format_pause() - auto_insert(result) - user.auto_format_resume() - -# Escape, type things that would otherwise be commands -^escape $: - auto_insert(user.text) - -numb : "{number_string}" -numb (dot | point) : "{number_string}.{digit_string}" - -^commander$: - mode.disable("sleep") - mode.disable("dictation") - mode.enable("command") \ No newline at end of file diff --git a/talon/community/community-cursorless-0.4.0/modes/dragon_modes.talon b/talon/community/community-cursorless-0.4.0/modes/dragon_modes.talon deleted file mode 100644 index 295b3a4..0000000 --- a/talon/community/community-cursorless-0.4.0/modes/dragon_modes.talon +++ /dev/null @@ -1,8 +0,0 @@ -#defines modes specific to Dragon. -speech.engine: dragon -mode: all -- -# wakes Dragon on Mac, deactivates talon speech commands -dragon mode: user.dragon_mode() -#sleep dragon on Mac, activates talon speech commands -talon mode: user.talon_mode() \ No newline at end of file diff --git a/talon/community/community-cursorless-0.4.0/modes/language_modes.talon b/talon/community/community-cursorless-0.4.0/modes/language_modes.talon deleted file mode 100644 index 413df57..0000000 --- a/talon/community/community-cursorless-0.4.0/modes/language_modes.talon +++ /dev/null @@ -1,16 +0,0 @@ -^force see sharp$: user.code_set_language_mode("csharp") -^force see plus plus$: user.code_set_language_mode("cplusplus") -^force go (lang|language)$: user.code_set_language_mode("go") -^force java$: user.code_set_language_mode("java") -^force java script$: user.code_set_language_mode("javascript") -^force type script$: user.code_set_language_mode("typescript") -^force markdown$: user.code_set_language_mode("markdown") -^force python$: user.code_set_language_mode("python") -^force are language$: user.code_set_language_mode("r") -^force talon [language]$: user.code_set_language_mode("talon") -^clear language modes$: user.code_clear_language_mode() -[enable] debug mode: - mode.enable("user.gdb") -disable debug mode: - mode.disable("user.gdb") - \ No newline at end of file diff --git a/talon/community/community-cursorless-0.4.0/modes/modes.py b/talon/community/community-cursorless-0.4.0/modes/modes.py deleted file mode 100644 index dbfe27e..0000000 --- a/talon/community/community-cursorless-0.4.0/modes/modes.py +++ /dev/null @@ -1,47 +0,0 @@ -from talon import Context, Module, app, actions, speech_system - -mod = Module() - -modes = { - "admin": "enable extra administration commands terminal (docker, etc)", - "debug": "a way to force debugger commands to be loaded", - "gdb": "a way to force gdb commands to be loaded", - "ida": "a way to force ida commands to be loaded", - "presentation": "a more strict form of sleep where only a more strict wake up command works", - "windbg": "a way to force windbg commands to be loaded", -} - -for key, value in modes.items(): - mod.mode(key, value) - - -@mod.action_class -class Actions: - def talon_mode(): - """For windows and Mac with Dragon, enables Talon commands and Dragon's command mode.""" - actions.speech.enable() - - engine = speech_system.engine.name - # app.notify(engine) - if "dragon" in engine: - if app.platform == "mac": - actions.user.engine_sleep() - elif app.platform == "windows": - actions.user.engine_wake() - # note: this may not do anything for all versions of Dragon. Requires Pro. - actions.user.engine_mimic("switch to command mode") - - def dragon_mode(): - """For windows and Mac with Dragon, disables Talon commands and exits Dragon's command mode""" - engine = speech_system.engine.name - # app.notify(engine) - - if "dragon" in engine: - # app.notify("dragon mode") - actions.speech.disable() - if app.platform == "mac": - actions.user.engine_wake() - elif app.platform == "windows": - actions.user.engine_wake() - # note: this may not do anything for all versions of Dragon. Requires Pro. - actions.user.engine_mimic("start normal mode") diff --git a/talon/community/community-cursorless-0.4.0/modes/sleep_mode.talon b/talon/community/community-cursorless-0.4.0/modes/sleep_mode.talon deleted file mode 100644 index 6f478f8..0000000 --- a/talon/community/community-cursorless-0.4.0/modes/sleep_mode.talon +++ /dev/null @@ -1,9 +0,0 @@ -mode: sleep -- -settings(): - #stop continuous scroll/gaze scroll with a pop - user.mouse_enable_pop_stops_scroll = 0 - #enable pop click with 'control mouse' mode - user.mouse_enable_pop_click = 0 -#this exists solely to prevent talon from walking up super easily in sleep mode at the moment with wav2letter -: skip() diff --git a/talon/community/community-cursorless-0.4.0/modes/sleep_mode_wav2letter.talon b/talon/community/community-cursorless-0.4.0/modes/sleep_mode_wav2letter.talon deleted file mode 100644 index ea61486..0000000 --- a/talon/community/community-cursorless-0.4.0/modes/sleep_mode_wav2letter.talon +++ /dev/null @@ -1,6 +0,0 @@ -mode: sleep -speech.engine: wav2letter -- -#this exists solely to prevent talon from waking up super easily in sleep mode at the moment with wav2letter -#you probably shouldn't have any other commands here -: skip() \ No newline at end of file diff --git a/talon/community/community-cursorless-0.4.0/modes/wake_up.talon b/talon/community/community-cursorless-0.4.0/modes/wake_up.talon deleted file mode 100644 index 5fdba8b..0000000 --- a/talon/community/community-cursorless-0.4.0/modes/wake_up.talon +++ /dev/null @@ -1,18 +0,0 @@ -#defines the commands that sleep/wake Talon -mode: all -- -^welcome back$: - user.mouse_wake() - user.history_enable() - user.talon_mode() -^sleep all$: - user.switcher_hide_running() - user.history_disable() - user.homophones_hide() - user.help_hide() - user.mouse_sleep() - speech.disable() - user.engine_sleep() -^talon sleep$: speech.disable() -^talon wake$: speech.enable() - diff --git a/talon/community/community-cursorless-0.4.0/mouse_grid/mouse_grid.py b/talon/community/community-cursorless-0.4.0/mouse_grid/mouse_grid.py deleted file mode 100644 index 7087014..0000000 --- a/talon/community/community-cursorless-0.4.0/mouse_grid/mouse_grid.py +++ /dev/null @@ -1,295 +0,0 @@ -# courtesy of https://github.com/timo/ -# see https://github.com/timo/talon_scripts -from talon import Module, Context, app, canvas, screen, settings, ui, ctrl, cron -from talon.skia import Shader, Color, Paint, Rect -from talon.types.point import Point2d -from talon_plugins import eye_mouse, eye_zoom_mouse -from typing import Union - -import math, time - -import typing - -mod = Module() -narrow_expansion = mod.setting( - "grid_narrow_expansion", - type=int, - default=0, - desc="""After narrowing, grow the new region by this many pixels in every direction, to make things immediately on edges easier to hit, and when the grid is at its smallest, it allows you to still nudge it around""", -) - -mod.tag("mouse_grid_showing", desc="Tag indicates whether the mouse grid is showing") -mod.tag("mouse_grid_enabled", desc="Tag enables the mouse grid commands.") -ctx = Context() - - -class MouseSnapNine: - def __init__(self): - self.screen = None - self.rect = None - self.history = [] - self.img = None - self.mcanvas = None - self.active = False - self.count = 0 - self.was_control_mouse_active = False - self.was_zoom_mouse_active = False - - def setup(self, *, rect: Rect = None, screen_num: int = None): - screens = ui.screens() - # each if block here might set the rect to None to indicate failure - if rect is not None: - try: - screen = ui.screen_containing(*rect.center) - except Exception: - rect = None - if rect is None and screen_num is not None: - screen = screens[screen_num % len(screens)] - rect = screen.rect - if rect is None: - screen = screens[0] - rect = screen.rect - self.rect = rect.copy() - self.screen = screen - self.count = 0 - self.img = None - if self.mcanvas is not None: - self.mcanvas.close() - self.mcanvas = canvas.Canvas.from_screen(screen) - if self.active: - self.mcanvas.register("draw", self.draw) - self.mcanvas.freeze() - - def show(self): - if self.active: - return - # noinspection PyUnresolvedReferences - if eye_zoom_mouse.zoom_mouse.enabled: - self.was_zoom_mouse_active = True - eye_zoom_mouse.toggle_zoom_mouse(False) - if eye_mouse.control_mouse.enabled: - self.was_control_mouse_active = True - eye_mouse.control_mouse.toggle() - self.mcanvas.register("draw", self.draw) - self.mcanvas.freeze() - self.active = True - return - - def close(self): - if not self.active: - return - self.mcanvas.unregister("draw", self.draw) - self.mcanvas.close() - self.mcanvas = None - self.img = None - - self.active = False - if self.was_control_mouse_active and not eye_mouse.control_mouse.enabled: - eye_mouse.control_mouse.toggle() - if self.was_zoom_mouse_active and not eye_zoom_mouse.zoom_mouse.enabled: - eye_zoom_mouse.toggle_zoom_mouse(True) - - self.was_zoom_mouse_active = False - self.was_control_mouse_active = False - - def draw(self, canvas): - paint = canvas.paint - - def draw_grid(offset_x, offset_y, width, height): - canvas.draw_line( - offset_x + width // 3, - offset_y, - offset_x + width // 3, - offset_y + height, - ) - canvas.draw_line( - offset_x + 2 * width // 3, - offset_y, - offset_x + 2 * width // 3, - offset_y + height, - ) - - canvas.draw_line( - offset_x, - offset_y + height // 3, - offset_x + width, - offset_y + height // 3, - ) - canvas.draw_line( - offset_x, - offset_y + 2 * height // 3, - offset_x + width, - offset_y + 2 * height // 3, - ) - - def draw_crosses(offset_x, offset_y, width, height): - for row in range(0, 2): - for col in range(0, 2): - cx = offset_x + width / 6 + (col + 0.5) * width / 3 - cy = offset_y + height / 6 + (row + 0.5) * height / 3 - - canvas.draw_line(cx - 10, cy, cx + 10, cy) - canvas.draw_line(cx, cy - 10, cx, cy + 10) - - grid_stroke = 1 - - def draw_text(offset_x, offset_y, width, height): - canvas.paint.text_align = canvas.paint.TextAlign.CENTER - for row in range(3): - for col in range(3): - text_string = "" - if settings["user.grids_put_one_bottom_left"]: - text_string = f"{(2 - row)*3+col+1}" - else: - text_string = f"{row*3+col+1}" - text_rect = canvas.paint.measure_text(text_string)[1] - background_rect = text_rect.copy() - background_rect.center = Point2d( - offset_x + width / 6 + col * width / 3, - offset_y + height / 6 + row * height / 3, - ) - background_rect = background_rect.inset(-4) - paint.color = "9999995f" - paint.style = Paint.Style.FILL - canvas.draw_rect(background_rect) - paint.color = "00ff00ff" - canvas.draw_text( - text_string, - offset_x + width / 6 + col * width / 3, - offset_y + height / 6 + row * height / 3 + text_rect.height / 2, - ) - - if self.count < 2: - paint.color = "00ff007f" - for which in range(1, 10): - gap = 35 - self.count * 10 - if not self.active: - gap = 45 - draw_crosses(*self.calc_narrow(which, self.rect)) - - paint.stroke_width = grid_stroke - if self.active: - paint.color = "ff0000ff" - else: - paint.color = "000000ff" - if self.count >= 2: - aspect = self.rect.width / self.rect.height - if aspect >= 1: - w = self.screen.width / 3 - h = w / aspect - else: - h = self.screen.height / 3 - w = h * aspect - x = self.screen.x + (self.screen.width - w) / 2 - y = self.screen.y + (self.screen.height - h) / 2 - self.draw_zoom(canvas, x, y, w, h) - draw_grid(x, y, w, h) - draw_text(x, y, w, h) - else: - draw_grid(self.rect.x, self.rect.y, self.rect.width, self.rect.height) - - paint.textsize += 12 - self.count * 3 - draw_text(self.rect.x, self.rect.y, self.rect.width, self.rect.height) - - def calc_narrow(self, which, rect): - rect = rect.copy() - bdr = narrow_expansion.get() - row = int(which - 1) // 3 - col = int(which - 1) % 3 - if settings["user.grids_put_one_bottom_left"]: - row = 2 - row - rect.x += int(col * rect.width // 3) - bdr - rect.y += int(row * rect.height // 3) - bdr - rect.width = (rect.width // 3) + bdr * 2 - rect.height = (rect.height // 3) + bdr * 2 - return rect - - def narrow(self, which, move=True): - if which < 1 or which > 9: - return - self.save_state() - rect = self.calc_narrow(which, self.rect) - # check count so we don't bother zooming in _too_ far - if self.count < 5: - self.rect = rect.copy() - self.count += 1 - if move: - ctrl.mouse_move(*rect.center) - if self.count >= 2: - self.update_screenshot() - else: - self.mcanvas.freeze() - - def update_screenshot(self): - def finish_capture(): - self.img = screen.capture_rect(self.rect) - self.mcanvas.freeze() - - self.mcanvas.hide() - cron.after("16ms", finish_capture) - - def draw_zoom(self, canvas, x, y, w, h): - if self.img: - src = Rect(0, 0, self.img.width, self.img.height) - dst = Rect(x, y, w, h) - canvas.draw_image_rect(self.img, src, dst) - - def narrow_to_pos(self, x, y): - col_size = int(self.width // 3) - row_size = int(self.height // 3) - col = math.floor((x - self.rect.x) / col_size) - row = math.floor((y - self.rect.x) / row_size) - self.narrow(1 + col + 3 * row, move=False) - - def save_state(self): - self.history.append((self.count, self.rect.copy())) - - def go_back(self): - # FIXME: need window and screen tracking - self.count, self.rect = self.history.pop() - self.mcanvas.freeze() - - -mg = MouseSnapNine() - - -@mod.action_class -class GridActions: - def grid_activate(): - """Show mouse grid""" - if not mg.mcanvas: - mg.setup() - mg.show() - ctx.tags = ["user.mouse_grid_showing"] - - def grid_place_window(): - """Places the grid on the currently active window""" - mg.setup(rect=ui.active_window().rect) - - def grid_reset(): - """Resets the grid to fill the whole screen again""" - if mg.active: - mg.setup() - - def grid_select_screen(screen: int): - """Brings up mouse grid""" - mg.setup(screen_num=screen - 1) - mg.show() - - def grid_narrow_list(digit_list: typing.List[str]): - """Choose fields multiple times in a row""" - for d in digit_list: - GridActions.grid_narrow(int(d)) - - def grid_narrow(digit: Union[int, str]): - """Choose a field of the grid and narrow the selection down""" - mg.narrow(int(digit)) - - def grid_go_back(): - """Sets the grid state back to what it was before the last command""" - mg.go_back() - - def grid_close(): - """Close the active grid""" - ctx.tags = [] - mg.close() diff --git a/talon/community/community-cursorless-0.4.0/mouse_grid/mouse_grid.talon b/talon/community/community-cursorless-0.4.0/mouse_grid/mouse_grid.talon deleted file mode 100644 index 3191a18..0000000 --- a/talon/community/community-cursorless-0.4.0/mouse_grid/mouse_grid.talon +++ /dev/null @@ -1,17 +0,0 @@ -tag: user.mouse_grid_enabled -- -M grid: - user.grid_select_screen(1) - user.grid_activate() - -grid win: - user.grid_place_window() - user.grid_activate() - -grid +: - user.grid_activate() - user.grid_narrow_list(number_key_list) - -grid screen []: - user.grid_select_screen(number or 1) - user.grid_activate() diff --git a/talon/community/community-cursorless-0.4.0/mouse_grid/mouse_grid_open.talon b/talon/community/community-cursorless-0.4.0/mouse_grid/mouse_grid_open.talon deleted file mode 100644 index d730011..0000000 --- a/talon/community/community-cursorless-0.4.0/mouse_grid/mouse_grid_open.talon +++ /dev/null @@ -1,12 +0,0 @@ -tag: user.mouse_grid_showing -- -: - user.grid_narrow(number_key) -grid off: - user.grid_close() - -grid reset: - user.grid_reset() - -grid back: - user.grid_go_back() diff --git a/talon/community/community-cursorless-0.4.0/settings.talon b/talon/community/community-cursorless-0.4.0/settings.talon deleted file mode 100644 index 551da0a..0000000 --- a/talon/community/community-cursorless-0.4.0/settings.talon +++ /dev/null @@ -1,42 +0,0 @@ -- -settings(): - speech.record_all = 1 - speech.debug = 1 - speech.timeout = 0.5 - #adjust the scale of the imgui to my liking - imgui.scale = 1.3 - # enable if you'd like the picker gui to automatically appear when explorer has focus - user.file_manager_auto_show_pickers = 0 - #set the max number of command lines per page in help - user.help_max_command_lines_per_page = 50 - # set the max number of contexts display per page in help - user.help_max_contexts_per_page = 20 - # The default amount used when scrolling continuously - user.mouse_continuous_scroll_amount = 80 - #stop continuous scroll/gaze scroll with a pop - user.mouse_enable_pop_stops_scroll = 1 - #enable pop click with 'control mouse' mode - user.mouse_enable_pop_click = 1 - #When enabled, the 'Scroll Mouse' GUI will not be shown. - user.mouse_hide_mouse_gui = 0 - #hide cursor when mouse_wake is called to enable zoom mouse - user.mouse_wake_hides_cursor = 0 - #the amount to scroll up/down (equivalent to mouse wheel on Windows by default) - user.mouse_wheel_down_amount = 120 - #mouse grid and friends put the number one on the bottom left (vs on the top left) - user.grids_put_one_bottom_left = 1 - # the number of lines of command history to display by default - user.command_history_display = 2 - # the number of lines of command history to keep in total; - # "command history more" to display all of them, "command history less" to restore - user.command_history_size = 50 - - # Uncomment the below to enable context-sensitive dictation. This determines - # how to format (capitalize, space) dictation-mode speech by selecting & - # copying surrounding text before inserting. This can be slow and may not - # work in some applications. You may wish to enable this on a - # per-application basis. - user.context_sensitive_dictation = 1 - -# uncomment tag to enable mouse grid -tag(): user.mouse_grid_enabled diff --git a/talon/community/community-cursorless-0.4.0/settings/additional_words.csv b/talon/community/community-cursorless-0.4.0/settings/additional_words.csv deleted file mode 100644 index e9d116f..0000000 --- a/talon/community/community-cursorless-0.4.0/settings/additional_words.csv +++ /dev/null @@ -1,47 +0,0 @@ -Word(s),Spoken Form (If Different) -nmap,N map -under-documented,under documented -nmap -admin -Cisco -Citrix -VPN -DNS -Minecraft -fontello -git -Github -app -vscode,van cake -Pokey -json,jason -config -meta -Schwab -lodash -debounced -debounce -timeout -fifo -mkfifo,make fifo -args -arg -node.js,node jay yes -enum,eenum -todo,to do -flashcard,flash card -flashcards,flash cards -pytorch,pie torch -HSBC -subword -subwords -nth,enth -karabiner -URL, U R L -Gmail -min -cursorless -synology -API,A P I -infer -null \ No newline at end of file diff --git a/talon/community/community-cursorless-0.4.0/settings/file_extensions.csv b/talon/community/community-cursorless-0.4.0/settings/file_extensions.csv deleted file mode 100644 index 7d081f1..0000000 --- a/talon/community/community-cursorless-0.4.0/settings/file_extensions.csv +++ /dev/null @@ -1,27 +0,0 @@ -File extension,Name -.py,dot pie -.talon,dot talon -.md,dot mark down -.sh,dot shell -.vim,dot vim -.c,dot see -.cs,dot see sharp -.com,dot com -.net,dot net -.org,dot org -.us,dot us -.us,dot U S -.exe,dot exe -.bin,dot bin -.bin,dot bend -.json,dot jason -.json,dot jay son -.js,dot J S -.js,dot java script -.ts,dot TS -.ts,dot type script -.csv,dot csv -.csv,totssv -.csv,tot csv -.csv,dot cassie -.txt,dot text diff --git a/talon/community/community-cursorless-0.4.0/settings/search_engines.csv b/talon/community/community-cursorless-0.4.0/settings/search_engines.csv deleted file mode 100644 index 038433e..0000000 --- a/talon/community/community-cursorless-0.4.0/settings/search_engines.csv +++ /dev/null @@ -1,6 +0,0 @@ -URL Template,Name -https://smile.amazon.co.uk/s/?field-keywords=%s,amazon -https://www.google.com/search?q=%s,google -https://maps.google.com/maps?q=%s,map -https://scholar.google.com/scholar?q=%s,scholar -https://en.wikipedia.org/w/index.php?search=%s,wiki diff --git a/talon/community/community-cursorless-0.4.0/settings/words_to_replace.csv b/talon/community/community-cursorless-0.4.0/settings/words_to_replace.csv deleted file mode 100644 index ec470f1..0000000 --- a/talon/community/community-cursorless-0.4.0/settings/words_to_replace.csv +++ /dev/null @@ -1,37 +0,0 @@ -Replacement,Original -I,i -I'm,i'm -I've,i've -I'll,i'll -I'd,i'd -Monday,monday -Mondays,mondays -Tuesday,tuesday -Tuesdays,tuesdays -Wednesday,wednesday -Wednesdays,wednesdays -Thursday,thursday -Thursdays,thursdays -Friday,friday -Fridays,fridays -Saturday,saturday -Saturdays,saturdays -Sunday,sunday -Sundays,sundays -January,january -February,february -April,april -June,june -July,july -August,august -September,september -October,october -November,november -December,december -talon,talent -jupyter,jupiter -firebase,fire base -karabiner,carabiner -queue,cue -queue,cu -Debbie,debby \ No newline at end of file diff --git a/talon/community/community-cursorless-0.4.0/shared_settings_module.py b/talon/community/community-cursorless-0.4.0/shared_settings_module.py deleted file mode 100644 index 5754297..0000000 --- a/talon/community/community-cursorless-0.4.0/shared_settings_module.py +++ /dev/null @@ -1,9 +0,0 @@ -from talon import Module - -mod = Module() -grids_put_one_bottom_left = mod.setting( - "grids_put_one_bottom_left", - type=bool, - default=False, - desc="""Allows you to switch mouse grid and friends between a computer numpad and a phone numpad (the number one goes on the bottom left or the top left)""", -) diff --git a/talon/community/community-cursorless-0.4.0/talon_draft_window/LICENSE b/talon/community/community-cursorless-0.4.0/talon_draft_window/LICENSE deleted file mode 100644 index c1e8d95..0000000 --- a/talon/community/community-cursorless-0.4.0/talon_draft_window/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2021 Stefan Schneider - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/talon/community/community-cursorless-0.4.0/talon_draft_window/README.md b/talon/community/community-cursorless-0.4.0/talon_draft_window/README.md deleted file mode 100644 index 5af0e93..0000000 --- a/talon/community/community-cursorless-0.4.0/talon_draft_window/README.md +++ /dev/null @@ -1,37 +0,0 @@ -This reposiory is a [Talon](https://talonvoice.com/) script that allows you to more easily edit prose style text via a task-specific UI. - -# Usage - -The main idea is that we have a Talon controlled text area where each word is labelled with a letter (called an anchor). You can use the anchors to indicate which word you want to operate on. - -An session might go like this for example: - - # Start with the text "this is a sentence with an elephant." in your editor or other textbox - draft edit all # Select all the text in your editor and moves it to the draft window - replace gust with error # Replaces the word corresponding with the red anchor 'g' (gust in knausj_talon) with the word 'error' - period # Add a full stop - select each through fine # Select the words starting at the 'e' anchor and ending at 'f' - say without # Insert the word 'without' (knausj_talon) - title word air # Make the word corresponding to the 'a' anchor capitalised - draft submit # Type the text in your draft window back into your editor - # End with the text "This is a sentence without error." in your editor or other textbox - -Here's a video of me going through the above commands: - -![Video of talon draft window in action](doc/talon-draft-demo.gif) - -# Installation - -The `draft_window.talon` file depends on functions and lists defined by the [knausj\_talon](https://github.com/knausj85/knausj_talon) repo. Once you have knausj set up you can just drop this folder in next to it in the Talon user scripts directory (~/.talon/user/ under Linux). So you might end up with ~/.talon/user/ containing a `knausj_talon` folder, a `talon_draft_window` folder, and an engines.py. - -# Customising - -If you want to change the display of the window you can do by adding some settings to one of your .talon files. See `settings.talon.example` for more details. - -# Running tests - -There are unit tests that you can run from the repository root like this (assuming your directory is called talon\_draft\_window): - - (cd ../ && python -m unittest talon_draft_window.test_draft_ui) - -The reason for the weirdness is because we have everything in the same directory and are doing relative imports. diff --git a/talon/community/community-cursorless-0.4.0/talon_draft_window/doc/talon-draft-demo.gif b/talon/community/community-cursorless-0.4.0/talon_draft_window/doc/talon-draft-demo.gif deleted file mode 100644 index 876e18d..0000000 Binary files a/talon/community/community-cursorless-0.4.0/talon_draft_window/doc/talon-draft-demo.gif and /dev/null differ diff --git a/talon/community/community-cursorless-0.4.0/talon_draft_window/draft_global.talon b/talon/community/community-cursorless-0.4.0/talon_draft_window/draft_global.talon deleted file mode 100644 index 2d8a10c..0000000 --- a/talon/community/community-cursorless-0.4.0/talon_draft_window/draft_global.talon +++ /dev/null @@ -1,38 +0,0 @@ -# These are available globally (in command mode) -mode: command -- -^draft show: - # Do this toggle so we can have focus when saying 'draft show' - user.draft_hide() - user.draft_show() - -^draft show : - # Do this toggle so we can have focus when saying 'draft show' - user.draft_hide() - user.draft_show() - user.draft_named_move(draft_window_position) - -^draft show small: - # Do this toggle so we can have focus when saying 'draft show' - user.draft_hide() - user.draft_show() - user.draft_resize(600, 200) - -^draft show large: - # Do this toggle so we can have focus when saying 'draft show' - user.draft_hide() - user.draft_show() - user.draft_resize(800, 500) - -^draft empty: user.draft_show("") - -^draft edit: - text = edit.selected_text() - key(backspace) - user.draft_show(text) - -^draft edit all: - edit.select_all() - text = edit.selected_text() - key(backspace) - user.draft_show(text) diff --git a/talon/community/community-cursorless-0.4.0/talon_draft_window/draft_talon_helpers.py b/talon/community/community-cursorless-0.4.0/talon_draft_window/draft_talon_helpers.py deleted file mode 100644 index 549626b..0000000 --- a/talon/community/community-cursorless-0.4.0/talon_draft_window/draft_talon_helpers.py +++ /dev/null @@ -1,320 +0,0 @@ -from typing import Optional -from talon import ui, settings, Module, Context, actions -from .draft_ui import DraftManager - -mod = Module() - -# ctx is for toggling the draft_window_showing variable -# which lets you execute actions whenever the window is visible. -ctx = Context() - -# ctx_focused is active only when the draft window is focussed. This -# lets you execute actions under that condition. -ctx_focused = Context() -ctx_focused.matches = r""" -title: Talon Draft -""" - -mod.tag("draft_window_showing", desc="Tag set when draft window showing") -setting_theme = mod.setting( - "draft_window_theme", - type=str, - default="dark", - desc="Sets the main colors of the window, one of 'dark' or 'light'", -) -setting_label_size = mod.setting( - "draft_window_label_size", - type=int, - default=20, - desc="Sets the size of the word labels used in the draft window", -) -setting_label_color = mod.setting( - "draft_window_label_color", - type=str, - default=None, - desc=( - "Sets the color of the word labels used in the draft window. " - "E.g. 00ff00 would be green" - ), -) -setting_text_size = mod.setting( - "draft_window_text_size", - type=int, - default=20, - desc="Sets the size of the text used in the draft window", -) - - -draft_manager = DraftManager() - -# Update the styling of the draft window dynamically as user settings change -def _update_draft_style(*args): - draft_manager.set_styling( - **{ - arg: setting.get() - for setting, arg in ( - (setting_theme, "theme"), - (setting_label_size, "label_size"), - (setting_label_color, "label_color"), - (setting_text_size, "text_size"), - ) - } - ) - - -settings.register("", _update_draft_style) - - -@ctx_focused.action_class("user") -class ContextSensitiveDictationActions: - """ - Override these actions to assist 'Smart dictation mode'. - see https://github.com/knausj85/knausj_talon/pull/356 - """ - - def dictation_peek_left(clobber=False): - area = draft_manager.area - return area[max(0, area.sel.left - 50) : area.sel.left] - - def dictation_peek_right(): - area = draft_manager.area - return area[area.sel.right : area.sel.right + 50] - - def paste(text: str): - # todo: remove once user.paste works reliably with the draft window - actions.insert(text) - - -@ctx_focused.action_class("edit") -class EditActions: - """ - Make default edit actions more efficient. - """ - - def selected_text() -> str: - area = draft_manager.area - if area.sel: - result = area[area.sel.left : area.sel.right] - return result - return "" - - -from talon import cron - - -class UndoWorkaround: - """ - Workaround for the experimental textarea's undo being character by character. - This keeps a debounced undo history. Can be deleted once this todo item is - fixed: https://github.com/talonvoice/talon/issues/254#issuecomment-789149734 - """ - - # Set this to False if you want to turn it off, or just delete all references - # to this class - enable_workaround = True - - # Stack of (text_value, selection) tuples representing the undo stack - undo_stack = [] - # Stack of (text_value, selection) tuples representing the redo stack - redo_stack = [] - # Used by the timer to check when the text has stopped changing - pending_undo = None - - # timer handle - timer_handle = None - - @classmethod - def start_logger(cls, reset_undo_stack: bool): - if reset_undo_stack: - cls.undo_stack = [] - cls.redo_stack = [] - - cls.stop_logger() - cls.timer_handle = cron.interval("500ms", cls._log_changes) - - @classmethod - def stop_logger(cls): - if cls.timer_handle is not None: - cron.cancel(cls.timer_handle) - cls.timer_handle = None - cls.pending_undo = None - - @classmethod - def perform_undo(cls): - if len(cls.undo_stack) == 0: - return - - curr_text = draft_manager.area.value - curr_sel = (draft_manager.area.sel.left, draft_manager.area.sel.right) - text, sel = cls.undo_stack[-1] - if text == curr_text: - cls.undo_stack.pop() - if len(cls.undo_stack) == 0: - return - - # Most of the time (unless user has only just finished updating) the - # top of the stack will have the same contents as the text area. In - # this case pop again to get a bit lower. We should never have the - # same text twice, hence we don't need a loop. - text, sel = cls.undo_stack[-1] - - # Remember the current state in the redo stack - cls.redo_stack.append((curr_text, curr_sel)) - draft_manager.area.value = text - draft_manager.area.sel = sel - - cls.pending_undo = (text, sel) - - @classmethod - def perform_redo(cls): - if len(cls.redo_stack) == 0: - return - - text, sel = cls.redo_stack.pop() - - draft_manager.area.value = text - draft_manager.area.sel = sel - - cls.pending_undo = (text, sel) - cls.undo_stack.append((text, sel)) - - @classmethod - def _log_changes(cls): - """ - If the text and cursor position hasn't changed for two interval iterations - (1s) and the undo stack doesn't match the current state, then add to the stack. - """ - - curr_val = draft_manager.area.value - # Turn the Span into a tuple, because we can't == Spans - curr_sel = (draft_manager.area.sel.left, draft_manager.area.sel.right) - curr_state = (curr_val, curr_sel) - - state_stack_mismatch = ( - len(cls.undo_stack) == 0 - or - # Only want to update the undo stack if the value has changed, not just - # the selection - curr_state[0] != cls.undo_stack[-1][0] - ) - - if cls.pending_undo == curr_state and state_stack_mismatch: - cls.undo_stack.append(curr_state) - # Clear out the redo stack because we've changed the text - cls.redo_stack = [] - elif cls.pending_undo != curr_state: - cls.pending_undo = curr_state - elif not state_stack_mismatch and len(cls.undo_stack) > 0: - # Remember the cursor position in the undo stack for the current text value - cls.undo_stack[-1] = (cls.undo_stack[-1][0], curr_sel) - else: - # The text area text is not changing, do nothing - pass - - -if UndoWorkaround.enable_workaround: - ctx_focused.action("edit.undo")(UndoWorkaround.perform_undo) - ctx_focused.action("edit.redo")(UndoWorkaround.perform_redo) - - -@mod.action_class -class Actions: - def draft_show(text: Optional[str] = None): - """ - Shows draft window - """ - - draft_manager.show(text) - UndoWorkaround.start_logger(text is not None) - ctx.tags = ["user.draft_window_showing"] - - def draft_hide(): - """ - Hides draft window - """ - - draft_manager.hide() - UndoWorkaround.stop_logger() - ctx.tags = [] - - def draft_select( - start_anchor: str, end_anchor: str = "", include_trailing_whitespace: int = 0 - ): - """ - Selects text in the draft window - """ - - draft_manager.select_text( - start_anchor, - end_anchor=None if end_anchor == "" else end_anchor, - include_trailing_whitespace=include_trailing_whitespace == 1, - ) - - def draft_position_caret(anchor: str, after: int = 0): - """ - Positions the caret in the draft window - """ - - draft_manager.position_caret(anchor, after=after == 1) - - def draft_get_text() -> str: - """ - Returns the text in the draft window - """ - - return draft_manager.get_text() - - def draft_resize(width: int, height: int): - """ - Resize the draft window. - """ - - draft_manager.reposition(width=width, height=height) - - def draft_named_move(name: str, screen_number: Optional[int] = None): - """ - Lets you move the window to the top, bottom, left, right, or middle - of the screen. - """ - - screen = ui.screens()[screen_number or 0] - window_rect = draft_manager.get_rect() - xpos = (screen.width - window_rect.width) / 2 - ypos = (screen.height - window_rect.height) / 2 - - if name == "top": - ypos = 50 - elif name == "bottom": - ypos = screen.height - window_rect.height - 50 - elif name == "left": - xpos = 50 - elif name == "right": - xpos = screen.width - window_rect.width - 50 - elif name == "middle": - # That's the default values - pass - - # Adjust for the fact that the screen may not be at 0,0. - xpos += screen.x - ypos += screen.y - draft_manager.reposition(xpos=xpos, ypos=ypos) - - -# Some capture groups we need - - -@mod.capture(rule="{self.letter}+") -def draft_anchor(m) -> str: - """ - An anchor (string of letters) - """ - return "".join(m) - - -@mod.capture(rule="(top|bottom|left|right|middle)") -def draft_window_position(m) -> str: - """ - One of the named positions you can move the window to - """ - - return "".join(m) diff --git a/talon/community/community-cursorless-0.4.0/talon_draft_window/draft_ui.py b/talon/community/community-cursorless-0.4.0/talon_draft_window/draft_ui.py deleted file mode 100644 index 2d316be..0000000 --- a/talon/community/community-cursorless-0.4.0/talon_draft_window/draft_ui.py +++ /dev/null @@ -1,213 +0,0 @@ -from typing import Optional -import re - -from talon.experimental.textarea import ( - TextArea, - Span, - DarkThemeLabels, - LightThemeLabels -) - - -word_matcher = re.compile(r"([^\s]+)(\s*)") -def calculate_text_anchors(text, cursor_position, anchor_labels=None): - """ - Produces an iterator of (anchor, start_word_index, end_word_index, last_space_index) - tuples from the given text. Each tuple indicates a particular point you may want to - reference when editing along with some useful ranges you may want to operate on. - - - text is the text you want to process. - - cursor_position is the current position of the cursor, anchors will be placed around - this. - - anchor_labels is a list of characters you want to use for your labels. - - *index is just a character offset from the start of the string (e.g. the first character is at index 0) - - end_word_index is the index of the character after the last one included in the - anchor. That is, you can use it with a slice directly like [start:end] - - anchor is a short piece of text you can use to identify it (e.g. 'a', or '1'). - """ - anchor_labels = anchor_labels or "abcdefghijklmnopqrstuvwxyz" - - if len(text) == 0: - return [] - - # Find all the word spans - matches = [] - cursor_idx = None - for match in word_matcher.finditer(text): - matches.append(( - match.start(), - match.end() - len(match.group(2)), - match.end() - )) - if matches[-1][0] <= cursor_position and matches[-1][2] >= cursor_position: - cursor_idx = len(matches) - 1 - - # Now work out what range of those matches are getting an anchor. The aim is - # to centre the anchors around the cursor position, but also to use all the - # anchors. - anchors_before_cursor = len(anchor_labels) // 2 - anchor_start_idx = max(0, cursor_idx - anchors_before_cursor) - anchor_end_idx = min(len(matches), anchor_start_idx + len(anchor_labels)) - anchor_start_idx = max(0, anchor_end_idx - len(anchor_labels)) - - # Now add anchors to the selected matches - for i, anchor in zip(range(anchor_start_idx, anchor_end_idx), anchor_labels): - word_start, word_end, whitespace_end = matches[i] - yield ( - anchor, - word_start, - word_end, - whitespace_end - ) - - -class DraftManager: - """ - API to the draft window - """ - - def __init__(self): - self.area = TextArea() - self.area.title = "Talon Draft" - self.area.value = "" - self.area.register("label", self._update_labels) - self.set_styling() - - def set_styling( - self, - theme="dark", - text_size=20, - label_size=20, - label_color=None - ): - """ - Allow settings the style of the draft window. Will dynamically - update the style based on the passed in parameters. - """ - - area_theme = DarkThemeLabels if theme == "dark" else LightThemeLabels - theme_changes = { - "text_size": text_size, - "label_size": label_size, - } - if label_color is not None: - theme_changes["label"] = label_color - self.area.theme = area_theme(**theme_changes) - - def show(self, text: Optional[str] = None): - """ - Show the window. If text is None then keep the old contents, - otherwise set the text to the given value. - """ - - if text is not None: - self.area.value = text - self.area.show() - - def hide(self): - """ - Hide the window. - """ - - self.area.hide() - - def get_text(self) -> str: - """ - Gets the context of the text area - """ - - return self.area.value - - def get_rect(self) -> "talon.types.Rect": - """ - Get the Rect for the window - """ - - return self.area.rect - - def reposition( - self, - xpos: Optional[int] = None, - ypos: Optional[int] = None, - width: Optional[int] = None, - height: Optional[int] = None, - ): - """ - Move the window or resize it without having to change all properties. - """ - - rect = self.area.rect - if xpos is not None: - rect.x = xpos - - if ypos is not None: - rect.y = ypos - - if width is not None: - rect.width = width - - if height is not None: - rect.height = height - - self.area.rect = rect - - def select_text( - self, start_anchor, end_anchor=None, include_trailing_whitespace=False - ): - """ - Selects the word corresponding to start_anchor. If end_anchor supplied, selects - from start_anchor to the end of end_anchor. If include_trailing_whitespace=True - then also selects trailing space characters (useful for delete). - """ - - start_index, end_index, last_space_index = self.anchor_to_range(start_anchor) - if end_anchor is not None: - _, end_index, last_space_index = self.anchor_to_range(end_anchor) - - if include_trailing_whitespace: - end_index = last_space_index - - self.area.sel = Span(start_index, end_index) - - def position_caret(self, anchor, after=False): - """ - Positions the caret before the given anchor. If after=True position it directly after. - """ - - start_index, end_index, _ = self.anchor_to_range(anchor) - index = end_index if after else start_index - - self.area.sel = index - - def anchor_to_range(self, anchor): - anchors_data = calculate_text_anchors(self._get_visible_text(), self.area.sel.left) - for loop_anchor, start_index, end_index, last_space_index in anchors_data: - if anchor == loop_anchor: - return (start_index, end_index, last_space_index) - - raise RuntimeError(f"Couldn't find anchor {anchor}") - - def _update_labels(self, _visible_text): - """ - Updates the position of the labels displayed on top of each word - """ - - anchors_data = calculate_text_anchors(self._get_visible_text(), self.area.sel.left) - return [ - (Span(start_index, end_index), anchor) - for anchor, start_index, end_index, _ in anchors_data - ] - - def _get_visible_text(self): - # Placeholder for a future method of getting this - return self.area.value - - -if False: - # Some code for testing, change above False to True and edit as desired - draft_manager = DraftManager() - draft_manager.show( - "This is a line of text\nand another line of text and some more text so that the line gets so long that it wraps a bit.\nAnd a final sentence" - ) - draft_manager.reposition(xpos=100, ypos=100) - draft_manager.select_text("c") diff --git a/talon/community/community-cursorless-0.4.0/talon_draft_window/draft_window.talon b/talon/community/community-cursorless-0.4.0/talon_draft_window/draft_window.talon deleted file mode 100644 index 52bbf9a..0000000 --- a/talon/community/community-cursorless-0.4.0/talon_draft_window/draft_window.talon +++ /dev/null @@ -1,51 +0,0 @@ -# These are active when we have focus on the draft window -title:Talon Draft -- -settings(): - # Enable 'Smart dictation mode', see https://github.com/knausj85/knausj_talon/pull/356 - user.context_sensitive_dictation = 1 - -# Replace a single word with a phrase -replace with : - user.draft_select("{draft_anchor}") - result = user.formatted_text(text, "NOOP") - insert(result) - -# Position cursor before word -cursor : - user.draft_position_caret("{draft_anchor}") - -cursor before : - user.draft_position_caret("{draft_anchor}") - -# Position cursor after word -cursor after : - user.draft_position_caret("{draft_anchor}", 1) - -# Select a whole word -select : - user.draft_select("{draft_anchor}") - -# Select a range of words -select through : - user.draft_select("{draft_anchor_1}", "{draft_anchor_2}") - -# Delete a word -clear : - user.draft_select("{draft_anchor}", "", 1) - key(backspace) - -# Delete a range of words -clear through : - user.draft_select(draft_anchor_1, draft_anchor_2, 1) - key(backspace) - -# reformat word - word : - user.draft_select("{draft_anchor}", "", 1) - user.formatters_reformat_selection(user.formatters) - -# reformat range - through : - user.draft_select(draft_anchor_1, draft_anchor_2, 1) - user.formatters_reformat_selection(user.formatters) diff --git a/talon/community/community-cursorless-0.4.0/talon_draft_window/draft_window_open.talon b/talon/community/community-cursorless-0.4.0/talon_draft_window/draft_window_open.talon deleted file mode 100644 index 83c4f1c..0000000 --- a/talon/community/community-cursorless-0.4.0/talon_draft_window/draft_window_open.talon +++ /dev/null @@ -1,12 +0,0 @@ -# These are available when the draft window is open, but not necessarily focussed -tag: user.draft_window_showing -- -draft hide: user.draft_hide() - -draft submit: - content = user.draft_get_text() - user.draft_hide() - insert(content) - # user.paste may be somewhat faster, but seems to be unreliable on MacOSX, see - # https://github.com/talonvoice/talon/issues/254#issuecomment-789355238 - # user.paste(content) diff --git a/talon/community/community-cursorless-0.4.0/talon_draft_window/settings.talon.example b/talon/community/community-cursorless-0.4.0/talon_draft_window/settings.talon.example deleted file mode 100644 index 03c2288..0000000 --- a/talon/community/community-cursorless-0.4.0/talon_draft_window/settings.talon.example +++ /dev/null @@ -1,8 +0,0 @@ -# Put some settings like this in one of your Talon files to override the styling -# of the draft window. -- -settings(): - user.draft_window_theme = "dark" # or light - user.draft_window_text_size = 20 - user.draft_window_label_size = 20 - user.draft_window_label_color = "ff0000" # Any hex code RGB value, e.g. this is red diff --git a/talon/community/community-cursorless-0.4.0/talon_draft_window/test_draft_ui.py b/talon/community/community-cursorless-0.4.0/talon_draft_window/test_draft_ui.py deleted file mode 100644 index 573b75e..0000000 --- a/talon/community/community-cursorless-0.4.0/talon_draft_window/test_draft_ui.py +++ /dev/null @@ -1,86 +0,0 @@ -try: - import talon.experimental.textarea - running_in_talon = True -except ModuleNotFoundError: - # Some shenanigans to stub out the Talon imports - import imp, sys - name = "talon.experimental.textarea" - module = imp.new_module(name) - sys.modules[name] = module - exec( - "\n".join([ - "TextArea = 1", - "Span = 1", - "DarkThemeLabels = 1", - "LightThemeLabels = 1" - ]), - module.__dict__ - ) - running_in_talon = False - -from unittest import TestCase -from functools import wraps - -from .draft_ui import calculate_text_anchors - - -class CalculateAnchorsTest(TestCase): - """ - Tests calculate_text_anchors - """ - - def test_finds_anchors(self): - examples = [ - ("one-word", [("a", 0, 8, 8)]), - ("two words", [("a", 0, 3, 4), ("b", 4, 9, 9)]), - ("two\nwords", [("a", 0, 3, 4), ("b", 4, 9, 9)]), - ] - anchor_labels = ["a", "b"] - for text, expected in examples: - # Given an example - - # When we calculate the result and turn it into a list - result = list(calculate_text_anchors(text, 0, anchor_labels=anchor_labels)) - - # Then it matches what we expect - self.assertEqual(result, expected, text) - - def test_positions_anchors_around_cursor(self): - # In these examples the cursor is at the asterisk which is stripped by the test - # code. Indicies after the asterisk have to take this into account. - examples = [ - ("one*-word", [("a", 0, 8, 8)]), - ("one-word*", [("a", 0, 8, 8)]), - ( - "the three words*", - [("a", 0, 3, 4), ("b", 4, 9, 10), ("c", 10, 15, 15)] - ), - ( - "*the three words", - [("a", 0, 3, 4), ("b", 4, 9, 10), ("c", 10, 15, 15)] - ), - ( - "too many* words for the number of anchors", - [("a", 0, 3, 4), ("b", 4, 8, 9), ("c", 9, 14, 15)] - ), - ( - "too many words fo*r the number of anchors", - [("a", 9, 14, 15), ("b", 15, 18, 19), ("c", 19, 22, 23)] - ), - ] - anchor_labels = ["a", "b", "c"] - - for text_with_cursor, expected in examples: - # Given an example - cursor_pos = text_with_cursor.index("*") - text = text_with_cursor.replace("*", "") - - # When we calculate the result and turn it into a list - result = list(calculate_text_anchors( - text, - cursor_pos, - anchor_labels=anchor_labels - )) - - # Then it matches what we expect - self.assertEqual(result, expected, text) diff --git a/talon/community/community-cursorless-0.4.0/text/find_and_replace.talon b/talon/community/community-cursorless-0.4.0/text/find_and_replace.talon deleted file mode 100644 index 47ad5d3..0000000 --- a/talon/community/community-cursorless-0.4.0/text/find_and_replace.talon +++ /dev/null @@ -1,90 +0,0 @@ -tag: user.find_and_replace -- - this: user.find("") - this : user.find(text) - all: user.find_everywhere("") - all : user.find_everywhere(text) - case : user.find_toggle_match_by_case() - word : user.find_toggle_match_by_word() - expression : user.find_toggle_match_by_regex() - next: user.find_next() - previous: user.find_previous() -replace this []: user.replace(text or "") -replace all: user.replace_everywhere("") -replace all: user.replace_everywhere(text) -replace confirm that: user.replace_confirm() -replace confirm all: user.replace_confirm_all() - -#quick replace commands, modeled after jetbrains -clear last [over]: - user.select_previous_occurrence(text) - sleep(100ms) - edit.delete() -clear next [over]: - user.select_next_occurrence(text) - sleep(100ms) - edit.delete() -clear last clip: - user.select_previous_occurrence(clip.text()) - edit.delete() -clear next clip: - user.select_next_occurrence(clip.text()) - sleep(100ms) - edit.delete() -comment last [over]: - user.select_previous_occurrence(text) - sleep(100ms) - code.toggle_comment() -comment last clip: - user.select_previous_occurrence(clip.text()) - sleep(100ms) - code.toggle_comment() -comment next [over]: - user.select_next_occurrence(text) - sleep(100ms) - code.toggle_comment() -comment next clip: - user.select_next_occurrence(clip.text()) - sleep(100ms) - code.toggle_comment() -go last [over]: - user.select_previous_occurrence(text) - sleep(100ms) - edit.right() -go last clip: - user.select_previous_occurrence(clip.text()) - sleep(100ms) - edit.right() -go next [over]: - user.select_next_occurrence(text) - edit.right() -go next token: - user.select_next_token() -go next clip: - user.select_next_occurrence(clip.text()) - edit.right() -paste last [over]: - user.select_previous_occurrence(text) - sleep(100ms) - edit.right() - edit.paste() -paste next [over]: - user.select_next_occurrence(text) - sleep(100ms) - edit.right() - edit.paste() -replace last [over]: - user.select_previous_occurrence(text) - sleep(100ms) - edit.paste() -replace next [over]: - user.select_next_occurrence(text) - sleep(100ms) - edit.paste() -select last [over]: user.select_previous_occurrence(text) -select next [over]: user.select_next_occurrence(text) -select last clip: user.select_previous_occurrence(clip.text()) -select next clip: user.select_next_occurrence(clip.text()) - - - diff --git a/talon/community/community-cursorless-0.4.0/text/generic_editor.talon b/talon/community/community-cursorless-0.4.0/text/generic_editor.talon deleted file mode 100644 index 7c40372..0000000 --- a/talon/community/community-cursorless-0.4.0/text/generic_editor.talon +++ /dev/null @@ -1,229 +0,0 @@ -find it: - edit.find() - -next one: - edit.find_next() - -tug: - edit.left() - -tug now: - user.left_n(number_small) - -draw: - edit.word_left() - -draw now: - user.word_left_n(number_small) - -push: - edit.right() - -push now: - user.right_n(number_small) - -step: - edit.word_right() - -step now: - user.word_right_n(number_small) - -north: - user.up_n(1) - -north now: - user.up_n(number_small) - -south: - user.down_n(1) - -south now: - user.down_n(number_small) - -head: - edit.line_start() - -tail: - edit.line_end() - -go way down: - edit.file_end() - -go way up: - edit.file_start() - -go page down: - edit.page_down() - -go page up: - edit.page_up() - -# selecting -select line: - edit.select_line() - -select all: - edit.select_all() - -select left: - edit.extend_left() - -select right: - edit.extend_right() - -select up: - edit.extend_line_up() - -select down: - edit.extend_line_down() - -select word: - edit.select_word() - - lefter: - edit.extend_word_left() - - writer: - edit.extend_word_right() - -take start: - edit.extend_line_start() - -take close: - edit.extend_line_end() - -select way up: - edit.extend_file_start() - -select way down: - edit.extend_file_end() - -# editing -indent [more]: - edit.indent_more() - -(indent less | out dent): - edit.indent_less() - -# deleting -clear line: - edit.delete_line() - -wipe now: - user.delete_left_n(number_small) - -drill now: - user.delete_right_n(number_small) - - up: - edit.extend_line_up() - edit.delete() - - down: - edit.extend_line_down() - edit.delete() - - word: - edit.delete_word() - -scratch: - user.delete_word_left_n(1) - -scratch now: - user.delete_word_left_n(number_small) - -swallow: - user.delete_word_right_n(1) - -swallow now: - user.delete_word_right_n(number_small) - - start: - edit.extend_line_start() - edit.delete() - - close: - edit.extend_line_end() - edit.delete() - - way up: - edit.extend_file_start() - edit.delete() - - way down: - edit.extend_file_end() - edit.delete() - - all: - edit.select_all() - edit.delete() - -#copy commands -copy all: - edit.select_all() - edit.copy() -#to do: do we want these variants, seem to conflict -# copy left: -# edit.extend_left() -# edit.copy() -# copy right: -# edit.extend_right() -# edit.copy() -# copy up: -# edit.extend_up() -# edit.copy() -# copy down: -# edit.extend_down() -# edit.copy() - -copy word: - edit.select_word() - edit.copy() - -copy lefter: - edit.extend_word_left() - edit.copy() - -copy righter: - edit.extend_word_right() - edit.copy() - -copy line: - edit.select_line() - edit.copy() - -#cut commands -cut all: - edit.select_all() - edit.cut() -#to do: do we want these variants -# cut left: -# edit.select_all() -# edit.cut() -# cut right: -# edit.select_all() -# edit.cut() -# cut up: -# edit.select_all() -# edit.cut() -# cut down: -# edit.select_all() -# edit.cut() - -cut word: - edit.select_word() - edit.cut() - -cut lefter: - edit.extend_word_left() - edit.cut() - -cut righter: - edit.extend_word_right() - edit.cut() - -cut line: - edit.select_line() - edit.cut() - -Pokey mail: "pokey.rule@gmail.com" \ No newline at end of file diff --git a/talon/community/community-cursorless-0.4.0/text/homophones.talon b/talon/community/community-cursorless-0.4.0/text/homophones.talon deleted file mode 100644 index a8fda4d..0000000 --- a/talon/community/community-cursorless-0.4.0/text/homophones.talon +++ /dev/null @@ -1,5 +0,0 @@ -phones : user.homophones_show(homophones_canonical) -phones that: user.homophones_show_selection() -phones force : user.homophones_force_show(homophones_canonical) -phones force: user.homophones_force_show_selection() -phones hide: user.homophones_hide() diff --git a/talon/community/community-cursorless-0.4.0/text/homophones_open.talon b/talon/community/community-cursorless-0.4.0/text/homophones_open.talon deleted file mode 100644 index ea79590..0000000 --- a/talon/community/community-cursorless-0.4.0/text/homophones_open.talon +++ /dev/null @@ -1,10 +0,0 @@ -mode: user.homophones -- -choose : - result = user.homophones_select(number_small) - insert(result) - user.homophones_hide() -choose : - result = user.homophones_select(number_small) - insert(user.formatted_text(result, formatters)) - user.homophones_hide() \ No newline at end of file diff --git a/talon/community/community-cursorless-0.4.0/text/line_commands.talon b/talon/community/community-cursorless-0.4.0/text/line_commands.talon deleted file mode 100644 index dc248b5..0000000 --- a/talon/community/community-cursorless-0.4.0/text/line_commands.talon +++ /dev/null @@ -1,79 +0,0 @@ -tag: user.line_commands -- -#this defines some common line commands. More may be defined that are ide-specific. -paste line: - edit.line_end() - key(enter) - edit.paste() -paste line up: - edit.line_start() - key(left) - key(enter) - edit.paste() -# go start: edit.jump_line(number) -# go end: -# edit.jump_line(number) -# edit.line_end() -comment (line | this | that): - code.toggle_comment() -add comment $: - #todo: this should probably be a single function once - #.talon supports implementing actions with parameters? - code.toggle_comment() - insert(user.text) -# comment until : -# user.select_range(number_1, number_2) -# code.toggle_comment() -# line : -# edit.jump_line(number) -# user.select_range(number, number) -# edit.delete() -# until : -# user.select_range(number_1, number_2) -# edit.delete() -# copy [line] : -# user.select_range(number, number) -# edit.copy() -# copy until : -# user.select_range(number_1, number_2) -# edit.copy() -# cut line : -# user.select_range(number, number) -# edit.cut() -# cut line until : -# user.select_range(number_1, number_2) -# edit.cut() -# (paste | replace) until : -# user.select_range(number_1, number_2) -# edit.paste() -# (select | cell | sell) [line] : user.select_range(number, number) -# (select | cell | sell) until : user.select_range(number_1, number_2) -tab that: edit.indent_more() -# tab line : -# edit.jump_line(number) -# edit.indent_more() -# tab until : -# user.select_range(number_1, number_2) -# edit.indent_more() -# retab that: edit.indent_less() -# retab [line] : -# user.select_range(number, number) -# edit.indent_less() -# retab until : -# user.select_range(number_1, number_2) -# edit.indent_less() -drag line down: edit.line_swap_down() -drag line up: edit.line_swap_up() -# drag up [line] : -# user.select_range(number, number) -# edit.line_swap_up() -# drag up until : -# user.select_range(number_1, number_2) -# edit.line_swap_up() -# drag down [line] : -# user.select_range(number, number) -# edit.line_swap_down() -# drag down until : -# user.select_range(number_1, number_2) -# edit.line_swap_down() -smear (line|that): edit.line_clone() diff --git a/talon/community/community-cursorless-0.4.0/text/numbers.talon b/talon/community/community-cursorless-0.4.0/text/numbers.talon deleted file mode 100644 index 04748ce..0000000 --- a/talon/community/community-cursorless-0.4.0/text/numbers.talon +++ /dev/null @@ -1,4 +0,0 @@ -not tag: user.mouse_grid_showing -- -numb : "{number_string}" -numb (dot | point) : "{number_string}.{digit_string}" \ No newline at end of file diff --git a/talon/community/community-cursorless-0.4.0/text/symbols.talon b/talon/community/community-cursorless-0.4.0/text/symbols.talon deleted file mode 100644 index 2d2bd92..0000000 --- a/talon/community/community-cursorless-0.4.0/text/symbols.talon +++ /dev/null @@ -1,78 +0,0 @@ -double dash: "--" -triple quote: "'''" -(dot dot | dotdot): ".." -#ellipses: "…" -ellipses: "..." -spam: ", " -coal gap: ": " -pipe gap: " | " -boom: ". " -arrow: "->" -dub arrow: "=>" -new line: "\\n" -carriage return: "\\r" -line feed: "\\r\\n" -empty round: "()" -empty square: "[]" -empty curly: "{}" -empty diamond: "<>" -empty quad: '""' -empty twin: "''" -empty escaped quad: '\\"\\"' -empty escaped twin: "\\'\\' -tween : - '{symbol_key}{symbol_key}' - key(left) -quad: - '""' - key(left) -twin: - "''" - key(left) -eyes: - '``' - key(left) -escaped quad: - '\\"\\"' - key(left) - key(left) -escaped twin: - "\\'\\'" - key(left) - key(left) -round: - insert("()") - key(left) -square: - insert("[]") - key(left) -curly: - insert("{}") - key(left) -diamond: - insert("<>") - key(left) -(diamond | angle) that: - text = edit.selected_text() - user.paste("<{text}>") -(curly | lace) that: - text = edit.selected_text() - user.paste("{{{text}}}") -(round | leper) that: - text = edit.selected_text() - user.paste("({text})") -(double | quad) that: - text = edit.selected_text() - user.paste('"{text}"') -(single | twin) that: - text = edit.selected_text() - user.paste("'{text}'") - -slicer: - edit.line_end() - key(enter) - insert("- ") - -end gap: - edit.line_end() - key(space) \ No newline at end of file diff --git a/talon/community/community-cursorless-0.4.0/text/text_navigation.py b/talon/community/community-cursorless-0.4.0/text/text_navigation.py deleted file mode 100644 index 587943d..0000000 --- a/talon/community/community-cursorless-0.4.0/text/text_navigation.py +++ /dev/null @@ -1,294 +0,0 @@ -import re -from talon import ctrl, ui, Module, Context, actions, clip -import itertools -from typing import Union - -ctx = Context() -mod = Module() - - -text_navigation_max_line_search = mod.setting( - "text_navigation_max_line_search", - type=int, - default=10, - desc="the maximum number of rows that will be included in the search for the keywords above and below in ", -) - -mod.list( - "navigation_action", - desc="actions to perform, for instance move, select, cut, etc", -) -mod.list( - "before_or_after", - desc="words to indicate if the cursor should be moved before or after a given reference point", -) -mod.list( - "navigation_target_name", - desc="names for regular expressions for common things to navigate to, for instance a word with or without underscores", -) - -ctx.lists["self.navigation_action"] = { - "move": "GO", - "extend": "EXTEND", - "select": "SELECT", - "clear": "DELETE", - "cut": "CUT", - "copy": "COPY", -} -ctx.lists["self.before_or_after"] = { - "before": "BEFORE", - "after": "AFTER", - # DEFAULT is also a valid option as input for this capture, but is not directly accessible for the user. -} -navigation_target_names = { - "word": r"\w+", - "small": r"[A-Z]?[a-z0-9]+", - "big": r"[\S]+", - "parens": r'\((.*?)\)', - "squares": r'\[(.*?)\]', - "braces": r'\{(.*?)\}', - "quotes": r'\"(.*?)\"', - "angles": r'\<(.*?)\>', - #"single quotes": r'\'(.*?)\'', - "all": r'(.+)', - "method": r'\w+\((.*?)\)', - "constant": r'[A-Z_][A-Z_]+' -} -ctx.lists["self.navigation_target_name"] = navigation_target_names - -@mod.capture(rule=" | {user.navigation_target_name} | phrase ") -def navigation_target(m) -> re.Pattern: - """A target to navigate to. Returns a regular expression.""" - if hasattr(m, 'any_alphanumeric_key'): - return re.compile(re.escape(m.any_alphanumeric_key), re.IGNORECASE) - if hasattr(m, 'navigation_target_name'): - return re.compile(m.navigation_target_name) - return re.compile(re.escape(m.text), re.IGNORECASE) - -@mod.action_class -class Actions: - def navigation( - navigation_action: str, # GO, EXTEND, SELECT, DELETE, CUT, COPY - direction: str, # up, down, left, right - navigation_target_name: str, - before_or_after: str, # BEFORE, AFTER, DEFAULT - regex: re.Pattern, - occurrence_number: int, - ): - """Navigate in `direction` to the occurrence_number-th time that `regex` occurs, then execute `navigation_action` at the given `before_or_after` position.""" - direction = direction.upper() - navigation_target_name = re.compile((navigation_target_names["word"] if (navigation_target_name == "DEFAULT") else navigation_target_name)) - function = navigate_left if direction in ("UP", "LEFT") else navigate_right - function(navigation_action, navigation_target_name, before_or_after, regex, occurrence_number, direction) - - def navigation_by_name( - navigation_action: str, # GO, EXTEND, SELECT, DELETE, CUT, COPY - direction: str, # up, down, left, right - before_or_after: str, # BEFORE, AFTER, DEFAULT - navigation_target_name: str, # word, big, small - occurrence_number: int, - ): - """Like user.navigation, but to a named target.""" - r = re.compile(navigation_target_names[navigation_target_name]) - actions.user.navigation(navigation_action, direction, "DEFAULT", before_or_after, r, occurrence_number) - -def get_text_left(): - actions.edit.extend_line_start() - text = actions.edit.selected_text() - actions.edit.right() - return text - - -def get_text_right(): - actions.edit.extend_line_end() - text = actions.edit.selected_text() - actions.edit.left() - return text - - -def get_text_up(): - actions.edit.up() - actions.edit.line_end() - for j in range(0, text_navigation_max_line_search.get()): - actions.edit.extend_up() - actions.edit.extend_line_start() - text = actions.edit.selected_text() - actions.edit.right() - return text - - -def get_text_down(): - actions.edit.down() - actions.edit.line_start() - for j in range(0, text_navigation_max_line_search.get()): - actions.edit.extend_down() - actions.edit.extend_line_end() - text = actions.edit.selected_text() - actions.edit.left() - return text - - -def get_current_selection_size(): - return len(actions.edit.selected_text()) - - -def go_right(i): - for j in range(0, i): - actions.edit.right() - - -def go_left(i): - for j in range(0, i): - actions.edit.left() - - -def extend_left(i): - for j in range(0, i): - actions.edit.extend_left() - - -def extend_right(i): - for j in range(0, i): - actions.edit.extend_right() - - -def select(direction, start, end, length): - if direction == "RIGHT" or direction == "DOWN": - go_right(start) - extend_right(end - start) - else: - go_left(length - end) - extend_left(end - start) - - -def navigate_left( - navigation_action, navigation_target_name, before_or_after, regex, occurrence_number, direction -): - current_selection_length = get_current_selection_size() - if current_selection_length > 0: - actions.edit.right() - text = get_text_left() if direction == "LEFT" else get_text_up() - # only search in the text that was not selected - subtext = ( - text if current_selection_length <= 0 else text[:-current_selection_length] - ) - match = match_backwards(regex, occurrence_number, subtext) - if match == None: - # put back the old selection, if the search failed - extend_left(current_selection_length) - return - start = match.start() - end = match.end() - handle_navigation_action( - navigation_action, navigation_target_name, before_or_after, direction, text, start, end - ) - - -def navigate_right( - navigation_action, navigation_target_name, before_or_after, regex, occurrence_number, direction -): - current_selection_length = get_current_selection_size() - if current_selection_length > 0: - actions.edit.left() - text = get_text_right() if direction == "RIGHT" else get_text_down() - # only search in the text that was not selected - sub_text = text[current_selection_length:] - # pick the next interrater, Skip n number of occurrences, get an iterator given the Regex - match = match_forward(regex, occurrence_number, sub_text) - if match == None: - # put back the old selection, if the search failed - extend_right(current_selection_length) - return - start = current_selection_length + match.start() - end = current_selection_length + match.end() - handle_navigation_action( - navigation_action, navigation_target_name, before_or_after, direction, text, start, end - ) - - -def handle_navigation_action( - navigation_action, navigation_target_name, before_or_after, direction, text, start, end -): - length = len(text) - if navigation_action == "GO": - handle_move(direction, before_or_after, start, end, length) - elif navigation_action == "SELECT": - handle_select(navigation_target_name, before_or_after, direction, text, start, end, length) - elif navigation_action == "DELETE": - handle_select(navigation_target_name, before_or_after, direction, text, start, end, length) - actions.edit.delete() - elif navigation_action == "CUT": - handle_select(navigation_target_name, before_or_after, direction, text, start, end, length) - actions.edit.cut() - elif navigation_action == "COPY": - handle_select(navigation_target_name, before_or_after, direction, text, start, end, length) - actions.edit.copy() - elif navigation_action == "EXTEND": - handle_extend(before_or_after, direction, start, end, length) - - -def handle_select(navigation_target_name, before_or_after, direction, text, start, end, length): - if before_or_after == "BEFORE": - select_left = length - start - text_left = text[:-select_left] - match2 = match_backwards(navigation_target_name, 1, text_left) - if match2 == None: - end = start - start = 0 - else: - start = match2.start() - end = match2.end() - elif before_or_after == "AFTER": - text_right = text[end:] - match2 = match_forward(navigation_target_name, 1, text_right) - if match2 == None: - start = end - end = length - else: - start = end + match2.start() - end = end + match2.end() - select(direction, start, end, length) - - -def handle_move(direction, before_or_after, start, end, length): - if direction == "RIGHT" or direction == "DOWN": - if before_or_after == "BEFORE": - go_right(start) - else: - go_right(end) - else: - if before_or_after == "AFTER": - go_left(length - end) - else: - go_left(length - start) - - -def handle_extend(before_or_after, direction, start, end, length): - if direction == "RIGHT" or direction == "DOWN": - if before_or_after == "BEFORE": - extend_right(start) - else: - extend_right(end) - else: - if before_or_after == "AFTER": - extend_left(length - end) - else: - extend_left(length - start) - - -def match_backwards(regex, occurrence_number, subtext): - try: - match = list(regex.finditer(subtext))[-occurrence_number] - return match - except IndexError: - return - - -def match_forward(regex, occurrence_number, sub_text): - try: - match = next( - itertools.islice(regex.finditer(sub_text), occurrence_number - 1, None) - ) - return match - except StopIteration: - return None diff --git a/talon/community/community-cursorless-0.4.0/text/text_navigation.talon b/talon/community/community-cursorless-0.4.0/text/text_navigation.talon deleted file mode 100644 index c3d6160..0000000 --- a/talon/community/community-cursorless-0.4.0/text/text_navigation.talon +++ /dev/null @@ -1,76 +0,0 @@ -## (2021-03-09) This syntax is experimental and may change. See below for an explanation. -navigate [{user.arrow_key}] [{user.navigation_action}] [{user.navigation_target_name}] [{user.before_or_after}] [] : -## If you use this command a lot, you may wish to have a shorter syntax that omits the navigate keyword. Note that you then at least have to say either a navigation_action or before_or_after: -#({user.navigation_action} [{user.arrow_key}] [{user.navigation_target_name}] [{user.before_or_after}] | [{user.arrow_key}] {user.before_or_after}) [] : - user.navigation(navigation_action or "GO", arrow_key or "RIGHT", navigation_target_name or "DEFAULT", before_or_after or "DEFAULT", navigation_target, ordinals or 1) - -# ===== Examples of use ===== -# -# navigate comma: moves after the next "," on the line. -# navigate before five: moves before the next "5" on the line. -# navigate left underscore: moves before the previous "_" on the line. -# navigate left after second plex: moves after the second-previous "x" on the line. -# -# Besides characters, we can find phrases or move in predetermined units: -# -# navigate phrase hello world: moves after the next "hello world" on the line. -# navigate left third word: moves left over three words. -# navigate before second big: moves before the second-next 'big' word (a chunk of anything except white space). -# navigate left second small: moves left over two 'small' words (chunks of a camelCase name). -# -# We can search several lines (default 10) above or below the cursor: -# -# navigate up phrase john: moves before the previous "john" (case-insensitive) on the preceding lines. -# navigate down third period: moves after the third period on the following lines. -# -# Besides movement, we can cut, copy, select, clear (delete), or extend the current selection: -# -# navigate cut after comma: cut the word following the next comma on the line. -# navigate left copy third word: copy the third word to the left. -# navigate extend third big: extend the selection three big words right. -# navigate down clear phrase I think: delete the next occurrence of "I think" on the following lines. -# navigate up select colon: select the closest colon on the preceeding lines. -# -# We can specify what gets selected before or after the given input: -# -# navigate select parens after equals: Select the first "(" and everything until the first ")" after the "=" -# navigate left copy all before equals: Copy everything from the start of the line until the first "=" you encounter while moving left -# navigate clear constant before semicolon: Delete the last word consisting of only uppercase characters or underscores before a ";" -# -# ===== Explanation of the grammar ===== -# -# [{user.arrow_key}]: left, right, up, down (default: right) -# Which direction to navigate in. -# left/right work on the current line. -# up/down work on the closest lines (default: 10) above or below. -# -# [{user.navigation_action}]: move, extend, select, clear, cut, copy (default: move) -# What action to perform. -# -# [{user.navigation_target_name}]: word, small, big, parens, squares, braces, quotes, angles, all, method, constant (default: word) -# The predetermined unit to select if before_or_after was specified. -# Defaults to "word" -# -# [{user.before_or_after}]: before, after (default: special behavior) -# For move/extend: where to leave the cursor, before or after the target. -# Defaults to "after" for right/down and "before" for left/up. -# -# For select/copy/cut: if absent, select/copy/cut the target iself. If -# present, the navigation_target_name before/after the target. -# -# []: an english ordinal, like "second" (default: first) -# Which occurrence of the target to navigate to. -# -# : one of the following: -# - a character name, like "comma" or "five". -# - "word" or "big" or "small" -# - "phrase " -# Specifies the target to search for/navigate to. - -# The functionality for all these commands is covered in the lines above, but these commands are kept here for convenience. Originally from word_selection.talon. -word neck []: user.navigation_by_name("SELECT", "RIGHT", "DEFAULT", "word", number_small or 1) -word pre []: user.navigation_by_name("SELECT", "LEFT", "DEFAULT", "word", number_small or 1) -small word neck []: user.navigation_by_name("SELECT", "RIGHT", "DEFAULT", "small", number_small or 1) -small word pre []: user.navigation_by_name("SELECT", "LEFT", "DEFAULT", "small", number_small or 1) -big word neck []: user.navigation_by_name("SELECT", "RIGHT", "DEFAULT", "big", number_small or 1) -big word pre []: user.navigation_by_name("SELECT", "LEFT", "DEFAULT", "big", number_small or 1)