init commit

This commit is contained in:
unknown
2025-08-19 08:06:37 -04:00
commit 2957b5515a
743 changed files with 45495 additions and 0 deletions
+123
View File
@@ -0,0 +1,123 @@
from talon import Context, Module, actions, settings
mod = Module()
mod.apps.tmux = """
tag: terminal
and tag: user.tmux
"""
mod.setting(
"tmux_prefix_key",
type=str,
default="ctrl-b",
desc="The key used to prefix all tmux commands",
)
@mod.action_class
class TmuxActions:
def tmux_prefix():
"""press control and the configured tmux prefix key"""
actions.key(settings.get("user.tmux_prefix_key"))
def tmux_keybind(key: str):
"""press tmux prefix followed by a key bind"""
actions.user.tmux_prefix()
actions.key(key)
def tmux_enter_command(command: str = ""):
"""Enter tmux command mode and optionally insert a command without executing it."""
actions.user.tmux_keybind(":")
actions.insert(command)
def tmux_execute_command(command: str):
"""execute tmux command"""
actions.user.tmux_enter_command(command)
actions.key("enter")
actions.sleep("100ms")
def tmux_execute_command_with_confirmation(command: str, confirmation_prompt: str):
"""execute tmux command with confirm-before"""
actions.user.tmux_execute_command(
f'confirm-before -p "{confirmation_prompt} (y/n)" {command}'
)
actions.key("\n")
ctx = Context()
ctx.matches = "app: tmux"
@ctx.action_class("app")
class AppActions:
def tab_open():
actions.user.tmux_execute_command("new-window")
def tab_next():
actions.user.tmux_execute_command("select-window -n")
def tab_previous():
actions.user.tmux_execute_command("select-window -p")
@ctx.action_class("user")
class UserActions:
def tab_jump(number: int):
if number < 10:
actions.user.tmux_keybind(f"{number}")
else:
actions.user.tmux_execute_command(f"select-window -t {number}")
def tab_close_wrapper():
actions.user.tmux_execute_command_with_confirmation(
"kill-window", "kill-window #W?"
)
def split_window_right():
actions.user.split_window_horizontally()
actions.user.tmux_execute_command("swap-pane -U -s #P")
def split_window_left():
actions.user.split_window_horizontally()
def split_window_down():
actions.user.split_window_vertically()
actions.user.tmux_execute_command("swap-pane -U -s #P")
def split_window_up():
actions.user.split_window_vertically()
def split_flip():
actions.user.tmux_execute_command("next-layout")
def split_window_vertically():
actions.user.tmux_execute_command("split-pane")
def split_window_horizontally():
actions.user.tmux_execute_command("split-pane -h")
def split_maximize():
# toggle the maximization because zooming when already zoomed is pointless
actions.user.tmux_execute_command("resize-pane -Z")
def split_reset():
actions.user.tmux_execute_command("resize-pane -Z")
def split_window():
actions.user.split_window_horizontally()
def split_clear():
actions.user.tmux_execute_command_with_confirmation(
"kill-pane", "kill-pane #P?"
)
def split_next():
# select-pane doesn't seem to support the prefix-o behavior
actions.user.tmux_keybind("o")
def split_last():
actions.user.tmux_execute_command("select-pane -l")
def split_number(index: int):
actions.user.tmux_execute_command(f"select-pane -t {index}")
+20
View File
@@ -0,0 +1,20 @@
app: tmux
-
tag(): user.splits
tag(): user.tabs
# Note that you will need to add something to match the tmux app in your configuration
# This is not active by default
# Adding a file with a matcher for detecting tmux active in your terminal and activating
# the tmux tag is required
# Something like:
#
# title: /^tmux/
# -
# tag(): user.tmux
# pane management - these commands use the word split to match with the splits
# tag defined in tags/splits/splits.talon
go split <user.arrow_key>: user.tmux_keybind(arrow_key)
#Say a number after this command to switch to pane
go split: user.tmux_execute_command("display-panes -d 0")
+53
View File
@@ -0,0 +1,53 @@
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 <number>:
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 <user.arrow_key>:
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)