From ece814d2626ed6512fd92e591a5455a966a1bc50 Mon Sep 17 00:00:00 2001 From: Adithyan A Date: Tue, 22 Apr 2025 22:20:27 +0530 Subject: [PATCH] feat: Add support for overriding config file path via tmux option - Users can now define a custom path for the config file by adding a tmux option (@tmux-nerd-font-window-name-config-file) in their tmux.conf. - Updated the script to check for this tmux option, falling back to the default location if not set. - Documented this feature in the README for better user understanding. --- README.md | 15 +++++++++++++++ bin/tmux-nerd-font-window-name | 5 ++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 6711e84..2e88650 100644 --- a/README.md +++ b/README.md @@ -40,6 +40,21 @@ icons: cmatrix: "🤯" # add new entries that aren't included ``` +### Custom Configuration File Path + +By default, the plugin looks for the configuration file at: + +```sh +~/.config/tmux/tmux-nerd-font-window-name.yml +``` + +You can override this path by adding the following line to your +tmux.conf file: + +```sh +set -g @tmux-nerd-font-window-name-config-file "/your/custom/path.yml" +``` + ## Contributions Contributions are welcome! Feel free to make a pull request to submit more diff --git a/bin/tmux-nerd-font-window-name b/bin/tmux-nerd-font-window-name index 1740ba3..45d099a 100755 --- a/bin/tmux-nerd-font-window-name +++ b/bin/tmux-nerd-font-window-name @@ -11,7 +11,10 @@ NAME="$1" PANES="$2" CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" DEFAULT_CONFIG="$CURRENT_DIR/defaults.yml" -USER_CONFIG="$HOME/.config/tmux/tmux-nerd-font-window-name.yml" + +# Allow overriding user config path via tmux option +USER_CONFIG=$(tmux show-option -gqv @tmux-nerd-font-window-name-config-file) +USER_CONFIG=${USER_CONFIG:-"$HOME/.config/tmux/tmux-nerd-font-window-name.yml"} # Function to retrieve a configuration value get_config_value() {