Skip to content

Commit

Permalink
Merge branch 'main' into patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
nriley authored Jul 28, 2024
2 parents bb4f23d + 3f3d7eb commit 068b386
Show file tree
Hide file tree
Showing 40 changed files with 709 additions and 389 deletions.
25 changes: 5 additions & 20 deletions apps/eclipse/eclipse_win.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,11 @@ def toggle_comment():

@ctx.action_class("edit")
class EditActions:
def find(text: str):
actions.key("ctrl-f")
actions.insert(text)
def find_next():
actions.key("enter")

def find_previous():
actions.key("shift-enter")

def line_swap_up():
actions.key("alt-up")
Expand Down Expand Up @@ -110,23 +112,6 @@ def split_window():

# splits.py support end

# find.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")

# find.py support end

# find_and_replace.py support begin

def find_everywhere(text: str):
Expand Down
6 changes: 0 additions & 6 deletions apps/finder/finder.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,6 @@ class UserActions:
def file_manager_open_parent():
actions.key("cmd-up")

def file_manager_go_forward():
actions.key("cmd-]")

def file_manager_go_back():
actions.key("cmd-[")

def file_manager_current_path():
title = ui.active_window().title

Expand Down
2 changes: 2 additions & 0 deletions apps/jetbrains/jetbrains.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,8 @@ def find_previous():

def find(text: str = None):
actions.user.idea("action Find")
if text:
actions.insert(text)

def line_clone():
actions.user.idea("action EditorDuplicate")
Expand Down
2 changes: 1 addition & 1 deletion apps/kde_konsole/kde_konsole.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def paste():
def copy():
actions.key("ctrl-shift-c")

def find(text: str):
def find(text: str = None):
actions.key("ctrl-shift-f")
if str:
actions.insert(text)
Expand Down
7 changes: 4 additions & 3 deletions apps/nautilus/nautilus.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,14 @@ class UserActions:
def tab_jump(number: int):
actions.key(f"alt-{number}")

# user.file_manager
def file_manager_go_back():
# user.navigation
def go_back():
actions.key("alt-left")

def file_manager_go_forward():
def go_forward():
actions.key("alt-right")

# user.file_manager
def file_manager_open_parent():
actions.key("alt-up")

Expand Down
25 changes: 5 additions & 20 deletions apps/notepad++/notepad++_win.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,11 @@ def jump_line(n: int):
actions.insert(str(n))
actions.key("enter")

def find(text: str):
actions.key("ctrl-f")
actions.insert(text)
def find_next():
actions.key("enter")

def find_previous():
actions.key("shift-enter")


@ctx.action_class("win")
Expand Down Expand Up @@ -96,23 +98,6 @@ def tab_final():
print("Notepad doesn't support this...")
# actions.key("ctrl-numpad_0")

# find.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")

# find.py support end

# find_and_replace.py support begin

def find_everywhere(text: str):
Expand Down
4 changes: 0 additions & 4 deletions apps/powershell/powershell_win.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@ def file_manager_refresh_title():
"$Host.UI.RawUI.WindowTitle = 'Windows PowerShell: ' + $(get-location)"
)
actions.key("enter")
# action(user.file_manager_go_back):
# key("alt-left")
# action(user.file_manager_go_forward):
# key("alt-right")

def file_manager_open_parent():
actions.insert("cd ..")
Expand Down
25 changes: 5 additions & 20 deletions apps/visualstudio/visual_studio.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,11 @@ def indent_less():
def save_all():
actions.key("ctrl-shift-s")

def find(text: str):
actions.key("ctrl-f")
actions.insert(text)
def find_next():
actions.key("enter")

def find_previous():
actions.key("shift-enter")

def line_swap_up():
actions.key("alt-up")
Expand Down Expand Up @@ -165,23 +167,6 @@ class UserActions:

# splits.py support end

# find.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")

# find.py support end

# find_and_replace.py support begin

def find_everywhere(text: str):
Expand Down
37 changes: 10 additions & 27 deletions apps/vscode/vscode.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,11 @@ def indent_less():
def save_all():
actions.user.vscode("workbench.action.files.saveAll")

def find(text=None):
if is_mac:
actions.key("cmd-f")
else:
actions.key("ctrl-f")
if text is not None:
actions.insert(text)
def find_next():
actions.user.vscode("editor.action.nextMatchFindAction")

def find_previous():
actions.user.vscode("editor.action.previousMatchFindAction")

def line_swap_up():
actions.key("alt-up")
Expand Down Expand Up @@ -169,6 +167,11 @@ class MacUserActions:
def command_palette():
actions.key("cmd-shift-p")

def find(text: str = None):
actions.key("cmd-f")
if text:
actions.insert(text)


@ctx.action_class("user")
class UserActions:
Expand Down Expand Up @@ -276,26 +279,6 @@ def split_number(index: int):

# splits.py support end

# find.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")

# find.py support end

# find_and_replace.py support begin

def find_everywhere(text: str):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@ class UserActions:
def file_manager_refresh_title():
actions.insert("title Command Prompt: %CD%")
actions.key("enter")
# action(user.file_manager_go_back):
# key("alt-left")
# action(user.file_manager_go_forward):
# key("alt-right")

def file_manager_open_parent():
actions.insert("cd ..")
Expand Down
4 changes: 0 additions & 4 deletions apps/windows_command_processor/command_processor_win.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@ class UserActions:
def file_manager_refresh_title():
actions.insert("title Command Prompt: %CD%")
actions.key("enter")
# action(user.file_manager_go_back):
# key("alt-left")
# action(user.file_manager_go_forward):
# key("alt-right")

def file_manager_open_parent():
actions.insert("cd ..")
Expand Down
5 changes: 0 additions & 5 deletions apps/windows_explorer/windows_explorer.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,6 @@

@ctx.action_class("user")
class UserActions:
def file_manager_go_back():
actions.key("alt-left")

def file_manager_go_forward():
actions.key("alt-right")

def file_manager_open_parent():
actions.key("alt-up")
Expand Down
22 changes: 22 additions & 0 deletions core/dragon_engine.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
from talon import Module, speech_system

mod = Module()


@mod.action_class
class Actions:
def dragon_engine_sleep():
"""Sleep the dragon engine"""
speech_system.engine_mimic("go to sleep"),

def dragon_engine_wake():
"""Wake the dragon engine"""
speech_system.engine_mimic("wake up"),

def dragon_engine_command_mode():
"""Switch dragon to command mode. Requires Pro."""
speech_system.engine_mimic("switch to command mode")

def dragon_engine_normal_mode():
"""Switch dragon to normal mode. Requires Pro."""
speech_system.engine_mimic("start normal mode")
9 changes: 6 additions & 3 deletions core/edit/edit_linux.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,16 @@ def file_end():
def file_start():
actions.key("ctrl-home")

def find(text: str = ""):
def find(text: str = None):
actions.key("ctrl-f")
actions.insert(text)
if text:
actions.insert(text)

def find_previous():
actions.key("shift-f3")

def find_next():
actions.key("f3")
# action(edit.find_previous):

def indent_less():
actions.key("home delete")
Expand Down
9 changes: 6 additions & 3 deletions core/edit/edit_win.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,16 @@ def file_end():
def file_start():
actions.key("ctrl-home")

def find(text: str = ""):
def find(text: str = None):
actions.key("ctrl-f")
actions.insert(text)
if text:
actions.insert(text)

def find_previous():
actions.key("shift-f3")

def find_next():
actions.key("f3")
# action(edit.find_previous):

def indent_less():
actions.key("home delete")
Expand Down
18 changes: 0 additions & 18 deletions core/engine.py

This file was deleted.

12 changes: 8 additions & 4 deletions core/help/help.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,10 @@ def update_title():
@imgui.open(y=0)
def gui_formatters(gui: imgui.GUI):
global formatters_words
gui.text("formatters help")
if formatters_reformat:
gui.text("re-formatters help")
else:
gui.text("formatters help")
gui.line()

for key, val in formatters_words.items():
Expand Down Expand Up @@ -479,7 +482,7 @@ def get_group(display_name) -> Tuple[str, str, int]:
context_name = display_name_to_context_name_map[display_name]
context = context_map[context_name]
keys = context._match.keys()
if "app.app" in keys:
if any(key for key in keys if key.startswith("app.")):
return (display_name, "Application-specific", 2)
if keys:
return (display_name, "Context-dependent", 1)
Expand Down Expand Up @@ -604,11 +607,12 @@ def help_list(ab: str):
register_events(True)
ctx.tags = ["user.help_open"]

def help_formatters(ab: dict):
def help_formatters(ab: dict, reformat: bool):
"""Provides the list of formatter keywords"""
# what you say is stored as a trigger
global formatters_words
global formatters_words, formatters_reformat
formatters_words = ab
formatters_reformat = reformat
reset()
hide_all_help_guis()
gui_formatters.show()
Expand Down
Loading

0 comments on commit 068b386

Please sign in to comment.