From 78c830d709b398ab51e4d89c9d065739cfb3aa25 Mon Sep 17 00:00:00 2001 From: EdJoJob Date: Tue, 14 Feb 2023 09:36:18 +1000 Subject: [PATCH] Prefer tmux splits and tabs over containing terminal Done by having the context for matching tmux be a more restrictive match than that of the terminals --- apps/tmux/tmux.py | 10 +++++++--- apps/tmux/tmux.talon | 13 ++++++++++++- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/apps/tmux/tmux.py b/apps/tmux/tmux.py index 53af8ed263..66402bcaab 100644 --- a/apps/tmux/tmux.py +++ b/apps/tmux/tmux.py @@ -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( @@ -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(): diff --git a/apps/tmux/tmux.talon b/apps/tmux/tmux.talon index f3cbc4b9c1..5424f87832 100644 --- a/apps/tmux/tmux.talon +++ b/apps/tmux/tmux.talon @@ -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