Skip to content

Commit

Permalink
Merge branch 'main' into common-commands
Browse files Browse the repository at this point in the history
  • Loading branch information
nriley authored Aug 19, 2023
2 parents bb50a16 + 98ba0be commit 0ff93a5
Show file tree
Hide file tree
Showing 7 changed files with 74 additions and 29 deletions.
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ repos:
- id: end-of-file-fixer
- id: mixed-line-ending
- repo: https://github.com/pre-commit/mirrors-prettier
rev: "v3.0.0"
rev: "v3.0.1"
hooks:
- id: prettier
- repo: https://github.com/ikamensh/flynt/
rev: "1.0.0"
rev: "1.0.1"
hooks:
- id: flynt
- repo: https://github.com/pycqa/isort
Expand All @@ -39,7 +39,7 @@ repos:
hooks:
- id: black
- repo: https://github.com/Lucas-C/pre-commit-hooks
rev: v1.5.1
rev: v1.5.3
hooks:
- id: remove-tabs
types: [file]
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ Note that it is also possible to install `community` by [downloading and extract
4. `help alphabet` will display the alphabet
5. `command history` will toggle a display of the recent commands
6. `help format` will display the available formatters with examples.
7. Many useful, basic commands are defined in https://github.com/talonhub/community/blob/main/core/edit/standard.talon
7. Many useful, basic commands are defined in https://github.com/talonhub/community/blob/main/core/edit/edit.talon
- `undo that` and `redo that` are the default undo/redo commands.
- `paste that`, `copy that`, and `cut that` for pasting/copy/cutting, respectively.
8. For community-generated documentation on Talon itself, please visit https://talon.wiki/
Expand Down
2 changes: 1 addition & 1 deletion apps/gdb/gdb_active.talon
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ os: linux
# XXX - this matches .gdb files atm
#win.title: /gdb/
tag: terminal
tag: user.gdb
and tag: user.gdb
-
tag(): user.debugger
until <number>: "until {number}"
Expand Down
21 changes: 20 additions & 1 deletion core/noise.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
Map noises (like pop) to actions so they can have contextually differing behavior
"""

from talon import Module, actions, noise
from talon import Module, actions, cron, noise

mod = Module()
hiss_cron = None


@mod.action_class
Expand All @@ -16,5 +17,23 @@ def noise_trigger_pop():
example.
"""

def noise_trigger_hiss(active: bool):
"""
Called when the user makes a 'hiss' noise. Listen to
https://noise.talonvoice.com/static/previews/hiss.mp3 for an
example.
"""


def noise_trigger_hiss_debounce(active: bool):
"""Since the hiss noise triggers while you're talking we need to debounce it"""
global hiss_cron
if active:
hiss_cron = cron.after("100ms", lambda: actions.user.noise_trigger_hiss(active))
else:
cron.cancel(hiss_cron)
actions.user.noise_trigger_hiss(active)


noise.register("pop", lambda _: actions.user.noise_trigger_pop())
noise.register("hiss", noise_trigger_hiss_debounce)
7 changes: 7 additions & 0 deletions lang/typescript/typescript.talon
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
tag: user.typescript
-
tag(): user.javascript

type union [<user.code_type>]: " | {code_type or ''}"
type intersect [<user.code_type>]: " & {code_type or ''}"

state type: user.insert_between("type ", " = ")

as const: " as const"
62 changes: 39 additions & 23 deletions plugin/mouse/mouse.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@
default=0,
desc="When enabled, pop stops continuous scroll modes (wheel upper/downer/gaze)",
)
setting_mouse_enable_hiss_scroll = mod.setting(
"mouse_enable_hiss_scroll",
type=bool,
default=False,
desc="Hiss noise scrolls down when enabled",
)
setting_mouse_wake_hides_cursor = mod.setting(
"mouse_wake_hides_cursor",
type=int,
Expand Down Expand Up @@ -249,29 +255,39 @@ def show_cursor_helper(show):
ctrl.cursor_visible(show)


@ctx.action("user.noise_trigger_pop")
def on_pop():
if setting_mouse_enable_pop_stops_scroll.get() >= 1 and (gaze_job or scroll_job):
# Allow pop to stop scroll
stop_scroll()
else:
# Otherwise respect the mouse_enable_pop_click setting
setting_val = setting_mouse_enable_pop_click.get()

is_using_eye_tracker = (
actions.tracking.control_zoom_enabled()
or actions.tracking.control_enabled()
or actions.tracking.control1_enabled()
)
should_click = (
setting_val == 2 and not actions.tracking.control_zoom_enabled()
) or (
setting_val == 1
and is_using_eye_tracker
and not actions.tracking.control_zoom_enabled()
)
if should_click:
ctrl.mouse_click(button=0, hold=16000)
@ctx.action_class("user")
class UserActions:
def noise_trigger_pop():
if setting_mouse_enable_pop_stops_scroll.get() >= 1 and (
gaze_job or scroll_job
):
# Allow pop to stop scroll
stop_scroll()
else:
# Otherwise respect the mouse_enable_pop_click setting
setting_val = setting_mouse_enable_pop_click.get()

is_using_eye_tracker = (
actions.tracking.control_zoom_enabled()
or actions.tracking.control_enabled()
or actions.tracking.control1_enabled()
)
should_click = (
setting_val == 2 and not actions.tracking.control_zoom_enabled()
) or (
setting_val == 1
and is_using_eye_tracker
and not actions.tracking.control_zoom_enabled()
)
if should_click:
ctrl.mouse_click(button=0, hold=16000)

def noise_trigger_hiss(active: bool):
if setting_mouse_enable_hiss_scroll.get():
if active:
actions.user.mouse_scroll_down_continuous()
else:
actions.user.mouse_scroll_stop()


def mouse_scroll(amount):
Expand Down
3 changes: 3 additions & 0 deletions settings.talon
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ settings():
# 2 = on but not with zoom mouse mode
user.mouse_enable_pop_click = 1

# Uncomment the below to enable mouse scroll down using hiss noise
# user.mouse_enable_hiss_scroll = 1

# When enabled, the 'Scroll Mouse' GUI will not be shown.
user.mouse_hide_mouse_gui = 0

Expand Down

0 comments on commit 0ff93a5

Please sign in to comment.