Skip to content

Commit

Permalink
Prefer tmux splits and tabs over containing terminal
Browse files Browse the repository at this point in the history
Done by having the context for matching tmux be a more restrictive match than that of the terminals
  • Loading branch information
EdJoJob committed Sep 6, 2023
1 parent 9fafdc1 commit 78c830d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
10 changes: 7 additions & 3 deletions apps/tmux/tmux.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from talon import Context, Module, actions

ctx = Context()
mod = Module()

ctx.matches = r"""
tag: user.tmux
mod.apps.tmux = """
tag: terminal
and tag: user.tmux
"""

setting_tmux_prefix_key = mod.setting(
Expand Down Expand Up @@ -45,6 +45,10 @@ def tmux_execute_command_with_confirmation(command: str, confirmation_prompt: st
actions.key("\n")


ctx = Context()
ctx.matches = "app: tmux"


@ctx.action_class("app")
class AppActions:
def tab_open():
Expand Down
13 changes: 12 additions & 1 deletion apps/tmux/tmux.talon
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
tag: user.tmux
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
Expand Down

0 comments on commit 78c830d

Please sign in to comment.