Exemplo n.º 1
0
# - add tracking support for states with corresponding tags to enable sub rule
# files
import json
import os
from time import sleep

from talon import Context, Module, actions, ctrl, settings, ui
from talon_plugins.eye_mouse import config, mouse, toggle_control

mod = Module()
# these are used to differentiate between menus with differing hot keys
# they will result in the loading of sub-grammar files
mod.tag("stellaris_government", desc="government screen hot keys")
mod.setting(
    "stellaris_screen_resolution",
    type=str,
    default="2560x1440",
    desc="Default resolution for most coordinates",
)
ctx = Context()
ctx.matches = r"""
app: stellaris
"""

mod.list("stellaris_topbar", desc="list of top bar coordinates locations")
ctx.lists["user.stellaris_topbar"] = []


@mod.capture
def stellaris_topbar(m) -> list:
    "Return an stellaris_topbar"
Exemplo n.º 2
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 = {
Exemplo n.º 3
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
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)
Exemplo n.º 4
0
from typing import Optional
from datetime import datetime
import os

mod = Module()

default_folder = ""
if app.platform == "windows":
    default_folder = os.path.expanduser(os.path.join("~",
                                                     r"OneDrive\Pictures"))
if not os.path.isdir(default_folder):
    default_folder = os.path.join("~", "Pictures")

screenshot_folder = mod.setting(
    "screenshot_folder",
    type=str,
    default=default_folder,
    desc="Where to save screenshots. Note this folder must exist.",
)


@mod.action_class
class Actions:
    def screenshot(screen_number: Optional[int] = None):
        """Takes a screenshot of the entire screen and saves it to the pictures folder.
        Optional screen number can be given to use screen other than main."""
        screen = get_screen(screen_number)
        screenshot_rect(screen.rect)

    def screenshot_window():
        """Takes a screenshot of the active window and saves it to the pictures folder"""
        win = ui.active_window()
Exemplo n.º 5
0
mod.list("file_manager_directory_remap",
         desc="list of titles remapped to the absolute path")
mod.list(
    "file_manager_directory_exclusions",
    desc=
    "list of titles that are excluded/disabled from the picker functionality",
)
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",
)
mod.tag("file_manager",
Exemplo n.º 6
0
    """Is the zoom mouse an active mouse mode?"""
    try:
        return eye_zoom_mouse.zoom_mouse.enabled
    except AttributeError:
        return False


def is_zooming():
    """Is the zoom mouse currently zooming?"""
    return eye_zoom_mouse.zoom_mouse.state == eye_zoom_mouse.STATE_OVERLAY


module = Module()
module.setting(
    "click_sounds",
    type=bool,
    default=True,
    desc="play sounds when zoom clicks are buffered (or cancelled)",
)


# TODO: Pull this out once talon exposes mouse mode scopes by default
@module.scope
def scope(*_):
    zoom_mouse = zoom_mouse_active()
    return {
        "zoom_mouse_active": zoom_mouse,
        "zoom_mouse_zooming": zoom_mouse and is_zooming(),
    }


speech_system.register("pre:phrase", scope.update)
Exemplo n.º 7
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: user.auto_lang
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 ",
}
Exemplo n.º 8
0
mod.list("talon_hud_widget_enabled_voice_commands",
         desc="List of extra voice commands added by visible widgets")
mod.tag(
    "talon_hud_available",
    desc=
    "Tag that shows the availability of the Talon HUD repository for other scripts"
)
mod.tag("talon_hud_visible",
        desc="Tag that shows that the Talon HUD is visible")
mod.tag(
    "talon_hud_choices_visible",
    desc=
    "Tag that shows there are choices available on screen that can be chosen")
mod.setting(
    "talon_hud_environment",
    type="string",
    desc=
    "Which environment to set the HUD in - Useful for setting up a HUD for screen recording or other tasks"
)

ctx.tags = ["user.talon_hud_available"]
ctx.settings["user.talon_hud_environment"] = ""
ctx.lists["user.talon_hud_widget_enabled_voice_commands"] = []

# A list of Talon HUD versions that can be used to check for in other packages
TALON_HUD_RELEASE_030 = 3  # Walk through version
TALON_HUD_RELEASE_040 = 4  # Multi-monitor version
TALON_HUD_RELEASE_050 = 5  # Debugging / screen overlay release
TALON_HUD_RELEASE_060 = 6  # Persistent content release
CURRENT_TALON_HUD_VERSION = TALON_HUD_RELEASE_060

Exemplo n.º 9
0
from talon import Module, actions, ui, app
import time

mod = Module()
mod.mode("draft_editor",
         "Indicates whether the draft editor has been activated")

default_names = [
    "Visual Studio Code", "Code", "VSCodium", "Codium", "code-oss"
]

setting_editor_names = mod.setting(
    "draft_editor",
    type=str,
    default=None,
    desc="List of application names to use for draft editor",
)

editor_names = {}


@mod.scope
def scope():
    for app in ui.apps(background=False):
        if app.name in editor_names:
            return {"draft_editor_running": True}
    return {"draft_editor_running": False}


def on_ready():
    global editor_names
Exemplo n.º 10
0
    'eighteen',
    'nineteen',
    'twenty',
]
selection_map = {n: i for i, n in enumerate(selection_numbers)}

mod = Module()
mod.list('file_manager_directory_index', desc='number -> directory name')
mod.list('file_manager_file_index', desc='number -> file name')
mod.list('file_manager_directory_remap',
         desc='list of titles remapped to the absolute path')
mod.list(
    'file_manager_directory_exclusions',
    desc=
    'list of titles that are excluded/disabled from the picker functionality')
mod.setting('file_manager_auto_show_pickers', 'int')

ctx = Context()
ctx.settings["user.file_manager_auto_show_pickers"] = 1

user_path = os.path.expanduser('~')

#todo use expanduser for cross platform support
ctx.lists['user.file_manager_directory_remap'] = {
    "Desktop": os.path.join(user_path, "Desktop"),
    "Downloads": os.path.join(user_path, "Downloads"),
    "Documents": os.path.join(user_path, "Documents"),
    "Pictures": os.path.join(user_path, "Pictures"),
    "Music": os.path.join(user_path, "Music"),
}
Exemplo n.º 11
0
    "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_zoom_auto_click = mod.setting(
    "mouse_enable_zoom_auto_click",
    type=int,
    default=1,
    desc="Enable zoom to auto click after the configured time out",
)

setting_mouse_zoom_auto_click_timeout = mod.setting(
    "mouse_zoom_auto_click_timeout",
    type=float,
    default=1,
    desc="The time in seconds to delay auto clicking after a zoom occurs",
)
Exemplo n.º 12
0
"SizeNESW": "%SystemRoot%\\Cursors\\aero_nesw.cur",
"SizeNS": "%SystemRoot%\\Cursors\\aero_ns.cur",
"SizeNWSE": "%SystemRoot%\\Cursors\\aero_nwse.cur",
"SizeWE": "%SystemRoot%\\Cursors\\aero_ew.cur",
"UpArrow": "%SystemRoot%\Cursors\\aero_up.cur",
"Wait": '%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__)), "Resources\HiddenCursor.cur")

mod = Module()
mod.list('mouse_button', desc='List of mouse button words to mouse_click index parameter')
mod.setting('mouse_enable_pop_click', type=int, default=0,desc="Enable pop to click when control mouse is enabled.")
mod.setting('mouse_enable_pop_stops_scroll', type=int,default=0,desc="When enabled, pop stops continuous scroll modes (wheel upper/downer/gaze)")
mod.setting('mouse_wake_hides_cursor', type=int, default=0,desc="When enabled, mouse wake will hide the cursor. mouse_wake enables zoom mouse.")
mod.setting('mouse_hide_mouse_gui', type=int, default=0,desc="When enabled, the 'Scroll Mouse' GUI will not be shown.")

ctx = Context()
ctx.lists['self.mouse_button'] = {
     #right click
     'righty':  '1',
     'rickle': '1',
     
     #left click
     'chiff': '0',
}

continuous_scoll_mode = ""
Exemplo n.º 13
0
from talon import Module, actions, app
import time

mod = Module()
setting = mod.setting("sleep_word", type=str)
time_last_pop = 0


@mod.action_class
class Actions:

    # XXX - should go through and disable all of the currently activated modes,
    # and then wake up should reactivate all of them
    def talon_sleep():
        """Put Talon to sleep"""
        # XXX - why doesn't this show?
        actions.user.notify("Talon sleeping")
        actions.speech.disable()
        actions.user.mouse_sleep()
        #actions.user.talon_sleep_callback()

    def talon_wake():
        """Wake Talon from sleep"""
        actions.speech.enable()
        actions.user.mouse_wake()
        #actions.user.talon_wake_callback()
        actions.user.notify("Talon awake")

    def talon_wake_on_pop():
        """Use pop sound to wake from sleep"""
        global time_last_pop
Exemplo n.º 14
0
from talon import Context, Module, actions, ui, app, speech_system, scope, settings
import unicodedata

mod = Module()
mod.mode('german')

ctx = Context()
ctx.matches = 'mode: user.german'
ctx.settings = {
    'speech.engine': 'vosk',
    #	'speech.language': 'de_DE',
    'speech.timeout': 0.3
}

mod.setting("german_unicode",
            type=int,
            default=1,
            desc="Enable proper unicode punctuation")

mod.list("buchstabe", desc="The spoken phonetic alphabet")
ctx.lists["self.buchstabe"] = {
    "alpha": "a",
    "bravo": "b",
    "charlie": "c",
    "delta": "d",
    "echo": "e",
    "foxtrott": "f",
    "golf": "g",
    "hotel": "h",
    "india": "i",
    "julia": "j",
    "kilo": "k",
Exemplo n.º 15
0
from talon import Context, Module, actions, ui
import time

mod = Module()
mod.setting(
    "ida_opcode_count",
    type=int,
    default=8,
    desc="the number of opcodes to automatically set when toggling",
)
ctx = Context()

ctx.matches = r"""
mode: user.ida
"""


@mod.action_class
class Actions:
    def ida_open_general_options():
        """Open the general options menu"""
        actions.key("alt-o g")
        time.sleep(0.2)

    def accept_change():
        """Accept dialogue change after a small wait"""
        time.sleep(0.4)
        actions.key("enter")
Exemplo n.º 16
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()

mod.setting(
    "warn_dictation_mode",
    type=int,
    default=0,
    desc="Pop notification bubble whenever text is dictated in dictation mode",
)

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.",
)


def mode_is_lowerable():
    return actions.user.current_mode() not in ["user.german"]


def pretty_words(word, lower=True):
    words = []
    for w in actions.dictate.parse_words(word):
        if lower:
            w = w.lower()
Exemplo n.º 17
0
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")
Exemplo n.º 18
0
import json
import os
import sys
from typing import Set

from talon import Context, Module, actions, fs, imgui, settings, ui

mod = Module()
mod.mode("personal_info")
mod.setting(
    "personal_info_auto_select",
    type=int,
    default=1,
    desc="Auto select specified entry in json list, or none if 0",
)
mod.list("personal_info", desc="List of personal info populated by json file")
ctx = Context()


@mod.capture(rule="{user.personal_info}")
def personal_info(m) -> list:
    return m.personal_info


# ctx.matches = r"""
# mode: command
# """

main_screen = ui.main_screen()

personal_info_list = []
Exemplo n.º 19
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, Callable
import re

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.list("prose_modifiers", desc="Modifiers that can be used within prose")
mod.list("prose_snippets", desc="Snippets that can be used within prose")
ctx = Context()
# Maps spoken forms to DictationFormat method names (see DictationFormat below).
ctx.lists["user.prose_modifiers"] = {
    "cap": "cap",
    "no cap": "no_cap",
    "no caps": "no_cap",  # "no caps" variant for Dragon
    "no space": "no_space",
}
ctx.lists["user.prose_snippets"] = {
    "spacebar": " ",
    "new line": "\n",
    "new paragraph": "\n\n",
    # Curly quotes are used to obtain proper spacing for left and right quotes, but will later be straightened.
    "open quote": "“",
    return '{0:x}'.format(v)


mod = Module()

mod.tag("full_mouse_grid_showing",
        desc="Tag indicates whether the full mouse grid is showing")
mod.tag("full_mouse_grid_enabled",
        desc="Tag enables the full mouse grid commands.")
mod.list("mg_point_of_compass", desc="point of compass for full mouse grid")

mod.mode("full_mouse_grid", desc="indicate the full mouse grid is active")

setting_letters_background_color = mod.setting(
    "full_mouse_grid_letters_background_color",
    type=str,
    default="000000",
    desc="set the background color of the small letters in the full mouse grid",
)

setting_row_highlighter = mod.setting(
    "full_mouse_grid_row_highlighter",
    type=str,
    default="ff0000",
    desc="set the color of the row to highlight",
)

setting_large_number_color = mod.setting(
    "full_mouse_grid_large_number_color",
    type=str,
    default="00ffff",
    desc="sets the color of the large number label in the superblock",
Exemplo n.º 21
0
    "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=1,
    desc="Enable pop to click when controlmouse 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.",
# 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"),
)
Exemplo n.º 23
0
# 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 = []
Exemplo n.º 24
0
# courtesy of https://github.com/timo/
# see https://github.com/timo/talon_scripts
from talon import Module, Context, app, canvas, screen, ui, ctrl, cron
from talon.skia import Shader, Color, Rect
from talon_plugins import eye_mouse, eye_zoom_mouse

import math, time

import typing

mod = Module()

shimmer_effect_enabled = mod.setting(
    "grid_shimmer_effect_enabled",
    type=bool,
    default=False,
    desc="""Enable the "shimmer effect" that regularly displays a faint hint of the first two layers of the 3x3 grid.""",
)
shimmer_effect_duration = mod.setting(
    "grid_shimmer_effect_duration",
    type=float,
    default=10,
    desc="""How long should the shimmer effect take to pass across the screen.""",
)
shimmer_effect_pause = mod.setting(
    "grid_shimmer_effect_pause",
    type=float,
    default=420,
    desc="""How long should it take for the shimmer effect to come back.""",
)
shimmer_effect_width = mod.setting(
Exemplo n.º 25
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():]
Exemplo n.º 26
0
    "SizeNWSE": "%SystemRoot%\\Cursors\\aero_nwse.cur",
    "SizeWE": "%SystemRoot%\\Cursors\\aero_ew.cur",
    "UpArrow": "%SystemRoot%\Cursors\\aero_up.cur",
    "Wait": '%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__)),
                             "Resources\HiddenCursor.cur")

mod = Module()
mod.list('mouse_button',
         desc='List of mouse button words to mouse_click index parameter')
mod.setting('mouse_enable_pop_click', int)
mod.setting('mouse_enable_pop_stops_scroll', int)
mod.setting('mouse_focus_change_stops_scroll', int)
mod.setting('mouse_wake_hides_cursor', int)

ctx = Context()
ctx.settings["self.mouse_enable_pop_click"] = 0
ctx.settings["self.mouse_enable_pop_stops_scroll"] = 0
ctx.settings["self.mouse_wake_hides_cursor"] = 0

ctx.lists['self.mouse_button'] = {
    #right click
    'righty': '1',
    'rickle': '1',

    #left click
Exemplo n.º 27
0
    "h2 tags": "<h2>",
    "div tags": "<div>",
    "bold tags": "<b>",
}

# settings that you can just set by sing on or off
# correlates to settings that start with no in turning off
vim_on_and_off_settings = {
    "see indent": "cindent",
}

mod.tag("vim", desc="a tag to load various vim plugins")
mod.tag("vim_terminal", desc="a tag to designate if we are in a vim terminal")
mod.setting(
    "vim_preserve_insert_mode",
    type=int,
    default=1,
    desc="If normal mode actions are called from insert mode, stay in insert",
)

mod.setting(
    "vim_adjust_modes",
    type=int,
    default=1,
    desc="User wants talon to automatically adjust modes for commands",
)

mod.setting(
    "vim_notify_mode_changes",
    type=int,
    default=0,
    desc="Notify user about vim mode changes as they occur",
Exemplo n.º 28
0
    "braces": "{",
    "square brackets": "[",
    "squares ": "[",
    "brackets": "[",
    "backticks": "`",
    "sentence": "s",
    "sentences": "s",
    "paragraph": "p",
    "paragraphs": "p",
    "tag block": "t",
}

mod.tag("vim", desc="a tag to load various vim plugins")
mod.setting(
    "vim_preserve_insert_mode",
    type=int,
    default=1,
    desc="If normal mode actions are called from insert mode, stay in insert",
)
mod.setting(
    "vim_adjust_modes",
    type=int,
    default=1,
    desc="User wants talon to automatically adjust modes for commands",
)
mod.setting(
    "vim_notify_mode_changes",
    type=int,
    default=0,
    desc="Notify user about vim mode changes as they occur",
)
Exemplo n.º 29
0
import re
from talon import ctrl, ui, Module, Context, actions, clip
import itertools
from typing import Union

ctx = Context()
mod = Module()

ctx.matches = r"""
not app: vim
"""


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 <user direction>",
)

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",
)
Exemplo n.º 30
0
from talon import Context, Module, actions, app, settings, ui

mod = Module()
ctx = Context()
mod.setting(
    "warn_dictation_mode",
    type=int,
    default=0,
    desc="Pop notification bubble whenever text is dictated in dictation mode",
)
# if settings.get("user.warn_dictation_mode") == 0:
#    app.notify("Dictation Mode")

# Courtesy of https://github.com/dwiel/talon_community/blob/master/misc/dictation.py
# Port for Talon's new api + wav2letter

# dictionary of sentence ends. No space should appear before these.
sentence_ends = {
    ".": ".",
    "?": "?",
    "!": "!",
    # these are mapped with names since passing "\n" didn't work for reasons
    "new-paragraph": "\n\n",
    "new-line": "\n",
}

# dictionary of punctuation. no space before these.
punctuation = {
    ",": ",",
    ":": ":",
    ";": ";",