Skip to content

Commit

Permalink
Add option to use custom modal mode status bar icon
Browse files Browse the repository at this point in the history
  • Loading branch information
jkazan committed Nov 3, 2024
1 parent b235216 commit 82291f8
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,17 @@ use. For example, if you press `w` the status bar will change from the modal
command icon `[=]` to `[w]` (the window command). If you now further press `s`,
it will update to `[ws]` to signify the split window command sequence and so on.

### Set custom status bar modal mode icon

The option `@modal-cmd-icon` can be used to specify any string, which will be
the left status bar icon to indicate that modal mode is in use. For example, to
use a circle as icon (note the padding at the beginning for a more aesthetically
centering in the status bar):

```
set -g @modal-cmd-icon " 🟢"
```

### Yes/no prompt

**DEPRECATED**
Expand Down
9 changes: 8 additions & 1 deletion tmux-modal.tmux
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,13 @@ elif ! parse_yn_opt "$SHOW_CMD_KEYS_VAL" $SHOW_CMD_KEYS_OPT; then
exit 22
fi

# Modal mode status bar icon.
KT_CMD_ICON_OPT=@modal-cmd-icon
KT_CMD_ICON_VAL=$(tmux show-options -g -v -q $KT_CMD_ICON_OPT)
if [ -z "$KT_CMD_ICON_VAL" ]; then
KT_CMD_ICON_VAL="[=]"
fi

# Create keybinding file to be sourced by tmux.

KBD_FILE="$CURRENT_DIR/.kbd.conf"
Expand Down Expand Up @@ -374,7 +381,7 @@ fi

# Prepend left status bar with KT_CMD_ICON if our key tables are in use.
# Determine this by checking if current key table starts with our prefix.
KT_CMD_ICON="[=]"
KT_CMD_ICON=$KT_CMD_ICON_VAL
STATUS_LEFT=`
`'#{'`
`'?#{==:'$KT_PREFIX'-,'`
Expand Down

0 comments on commit 82291f8

Please sign in to comment.