Skip to content

Commit

Permalink
feat: add custom shell icon option #4
Browse files Browse the repository at this point in the history
Adds a `@tmux-nerd-font-window-name-shell-icon` tmux option to overwrite the shell icon.
  • Loading branch information
zatchheems authored Mar 24, 2023
1 parent 0130ff4 commit 575f452
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,13 @@ set -g window-status-current-format '#[fg=magenta]#W'
set -g window-status-format '#[fg=gray]#W'
```

### Custom shell icon

To specify a custom shell icon, use the following option to set any icon you prefer:

```sh
set -g @tmux-nerd-font-window-name-shell-icon ""
```
## How it works

When installed, your window names will automatically update to a Nerd Font that matches the activity (ex: vim, bash, node, ect...).
Expand Down
17 changes: 16 additions & 1 deletion bin/tmux-nerd-font-window-name
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,28 @@

NAME=$1

# Get shell icon, using user-provided option if available
function get_shell_icon(){
local default_shell_icon=""
local shell_icon="$(tmux show -gqv '@tmux-nerd-font-window-name-shell-icon')"

# Alternate shell icon is nonempty
if [ -n "$shell_icon" ]; then
echo "$shell_icon"
else
echo "$default_shell_icon"
fi
}

SHELL_ICON=$(get_shell_icon)

get_icon() {
case $NAME in
tmux)
echo ""
;;
fish | zsh | bash | tcsh)
echo ""
echo $SHELL_ICON
;;
vi | vim | nvim | lvim)
echo ""
Expand Down

0 comments on commit 575f452

Please sign in to comment.