-
Notifications
You must be signed in to change notification settings - Fork 31
Feature: add option for alternate shell icon #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature: add option for alternate shell icon #4
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for doing this! I'm thinking of offering a yml file or something so people can map whatever icons they want to whatever values, but this is helpful for now.
I've made a couple of suggestions to make it more flexible and cleanup the code.
README.md
Outdated
To show a reverse white-on-black NerdFont icon for shells, set the following: | ||
|
||
```sh | ||
set -g @tmux-nerd-font-window-name-alterate-shell-icon true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about we accept a string to let people pick whatever icon they want?
set -g @tmux-nerd-font-window-name-alterate-shell-icon true | |
set -g @tmux-nerd-font-window-name-shell-icon "" |
bin/tmux-nerd-font-window-name
Outdated
ALTERNATE_SHELL_ICON="$(tmux show -gqv '@tmux-nerd-font-window-name-alterate-shell-icon')" | ||
SHELL_ICON="" | ||
|
||
if [ "$ALTERNATE_SHELL_ICON" = true ]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer we use a function to scope the data.
get_shell_icon() {
local default_shell_icon=''
local shell_icon="$(tmux show -gqv '@tmux-nerd-font-window-name-shell-icon')"
[ -n "$shell_icon" ] && echo "$shell_icon" || echo "$default_shell_icon"
}
SHELL_ICON=$(get_shell_icon)
Please test this and clean it up as you see fit.
thanks for the suggestions! I appreciate them especially because tmux config and plugins can get spaghetti-like without constant vigilance 🙂 I'll make those changes and test |
echo "$shell_icon" | ||
else | ||
echo "$default_shell_icon" | ||
fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This differs from your suggestion, but I usually prefer verbosity over shorthand—it's a holdover from a few years in Rescript I think. I can use shorthand if preferred.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me 👍
This is already merged, but just for future reference: applying bold styling to NerdFonts can cause them to behave unexpectedly. That's what caused the weird behavior in my screenshots. The more you know! |
Good to know, I might add some info to the README to let people know. |
Adds a `@tmux-nerd-font-window-name-shell-icon` tmux option to overwrite the shell icon.
Alternate Shell Icon Feature
For some odd reason, the NerdFont icon
nf-dev-terminal
renders strangely when windows running shells are focused. It could be Kitty, it could be my theme; I've tried several different NerdFont options to no avail. Not sure what the problem is or if it's repeatable. I've added an option to change this icon from black-on-white to white-on-black, which renders correctly and looks quite a bit better on my machine, regardless of the weird focus problem.I'm also thinking about adding a small preview for the icon difference in the README but I'm not sure if that's necessary. Please advise!
Demo:
Detail: