diff --git a/README.md b/README.md index 758bbc8..bb99e75 100644 --- a/README.md +++ b/README.md @@ -78,6 +78,9 @@ item_types = ["VJOURNAL", "VTODO"] You may also specify the location of the configuration file with the environment `CONFIGFILE`. +By default, `fzf-vjour` sets a descriptive terminal title. +This can be bypassed by specyfing `SET_TERMINAL_TITLE="no"` in the configuration file. + Usage ----- Use the default `fzf` keys to navigate your notes, e.g., `ctrl-j` and `ctrl-k` for going down/up in the list. diff --git a/src/main.sh b/src/main.sh index 1be7c08..bc771a1 100644 --- a/src/main.sh +++ b/src/main.sh @@ -2,9 +2,6 @@ set -eu -# Set terminal title -printf '\033]0;%s\007' "fzf-vjour | Journal, notes, and tasks" - # Always load functions # Helper functions . "sh/helper.sh" @@ -122,6 +119,11 @@ if [ -n "${list_option:-}" ]; then exit 0 fi +# Set terminal title +if [ "$SET_TERMINAL_TITLE" = "yes" ]; then + printf '\033]0;%s\007' "$TERMINAL_TITLE" +fi + while true; do query=$(stripws "$query") selection=$( diff --git a/src/sh/config.sh b/src/sh/config.sh index 226d452..7e8fb75 100644 --- a/src/sh/config.sh +++ b/src/sh/config.sh @@ -1,4 +1,5 @@ CONFIGFILE="${CONFIGFILE:-$HOME/.config/fzf-vjour/config}" +export TERMINAL_TITLE="🗃️ fzf-vjour | Journal, notes, and tasks" if [ ! -f "$CONFIGFILE" ]; then err "Configuration '$CONFIGFILE' not found." exit 1 @@ -14,9 +15,11 @@ if [ ! -d "$ROOT" ]; then exit 1 fi SYNC_CMD="${SYNC_CMD:-}" +SET_TERMINAL_TITLE="${SET_TERMINAL_TITLE:-yes}" export ROOT export SYNC_CMD export COLLECTION_LABELS +export SET_TERMINAL_TITLE for i in $(seq 9); do collection=$(printf "%s" "$COLLECTION_LABELS" | cut -d ';' -f "$i" | cut -d '=' -f 1) label=$(printf "%s" "$COLLECTION_LABELS" | cut -d ';' -f "$i" | cut -d '=' -f 2)