Skip to content

Commit 575f452

Browse files
authored
feat: add custom shell icon option #4
Adds a `@tmux-nerd-font-window-name-shell-icon` tmux option to overwrite the shell icon.
1 parent 0130ff4 commit 575f452

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

README.md

+7
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,13 @@ set -g window-status-current-format '#[fg=magenta]#W'
4444
set -g window-status-format '#[fg=gray]#W'
4545
```
4646

47+
### Custom shell icon
48+
49+
To specify a custom shell icon, use the following option to set any icon you prefer:
50+
51+
```sh
52+
set -g @tmux-nerd-font-window-name-shell-icon ""
53+
```
4754
## How it works
4855

4956
When installed, your window names will automatically update to a Nerd Font that matches the activity (ex: vim, bash, node, ect...).

bin/tmux-nerd-font-window-name

+16-1
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,28 @@
22

33
NAME=$1
44

5+
# Get shell icon, using user-provided option if available
6+
function get_shell_icon(){
7+
local default_shell_icon=""
8+
local shell_icon="$(tmux show -gqv '@tmux-nerd-font-window-name-shell-icon')"
9+
10+
# Alternate shell icon is nonempty
11+
if [ -n "$shell_icon" ]; then
12+
echo "$shell_icon"
13+
else
14+
echo "$default_shell_icon"
15+
fi
16+
}
17+
18+
SHELL_ICON=$(get_shell_icon)
19+
520
get_icon() {
621
case $NAME in
722
tmux)
823
echo ""
924
;;
1025
fish | zsh | bash | tcsh)
11-
echo ""
26+
echo $SHELL_ICON
1227
;;
1328
vi | vim | nvim | lvim)
1429
echo ""

0 commit comments

Comments
 (0)