From 0872f4d8944803695528ca69b238bdfff51d19fe Mon Sep 17 00:00:00 2001 From: "Wojciech M. Wnuk" Date: Fri, 14 Apr 2023 20:08:51 +0200 Subject: [PATCH] Customize layout templates --- README.md | 12 ++++++++++++ libexec/tmuxifier-new-session | 4 +++- libexec/tmuxifier-new-window | 4 +++- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 510089a..6fba287 100644 --- a/README.md +++ b/README.md @@ -213,6 +213,18 @@ You can customize the layouts directory used by Tmuxifier by setting export TMUXIFIER_LAYOUT_PATH="$HOME/.tmux-layouts" ``` +### Custom Templates Path + +You can customize the templates directory that are used for creating new window and session layouts +`$TMUXIFIER_TEMPLATE_PATH`. + +```bash +export TMUXIFIER_TEMPLATE_PATH="$HOME/.tmux-templates" +``` + +Then place `session.sh` and `window.sh` in the new directory. +Check [templates](https://github.com/jimeh/tmuxifier/tree/master/templates) directory to see the default templates. + ### Disable Shell-Completion Tmuxifier comes with shell-completion for bash, zsh, tcsh, and fish. If for any diff --git a/libexec/tmuxifier-new-session b/libexec/tmuxifier-new-session index c3ec25f..1fe73fd 100755 --- a/libexec/tmuxifier-new-session +++ b/libexec/tmuxifier-new-session @@ -2,6 +2,8 @@ set -e [ -n "$TMUXIFIER_DEBUG" ] && set -x +TMUXIFIER_TEMPLATE_PATH=${TMUXIFIER_TEMPLATE_PATH:="$TMUXIFIER/templates"} + # Load internal utility functions. source "$TMUXIFIER/lib/util.sh" @@ -28,7 +30,7 @@ fi layout_name="$1" layout_file="$TMUXIFIER_LAYOUT_PATH/${layout_name}.session.sh" -template="$TMUXIFIER/templates/session.sh" +template="$TMUXIFIER_TEMPLATE_PATH/session.sh" if [ ! -f "$template" ]; then echo "tmuxifier: session layout template not found: $template" >&2 diff --git a/libexec/tmuxifier-new-window b/libexec/tmuxifier-new-window index a9e35ef..31182a3 100755 --- a/libexec/tmuxifier-new-window +++ b/libexec/tmuxifier-new-window @@ -2,6 +2,8 @@ set -e [ -n "$TMUXIFIER_DEBUG" ] && set -x +TMUXIFIER_TEMPLATE_PATH=${TMUXIFIER_TEMPLATE_PATH:="$TMUXIFIER/templates"} + # Load internal utility functions. source "$TMUXIFIER/lib/util.sh" @@ -28,7 +30,7 @@ fi layout_name="$1" layout_file="$TMUXIFIER_LAYOUT_PATH/${layout_name}.window.sh" -template="$TMUXIFIER/templates/window.sh" +template="$TMUXIFIER_TEMPLATE_PATH/window.sh" if [ ! -f "$template" ]; then echo "tmuxifier: window layout template not found: $template" >&2