tinted-theming / tinted-shell

Base16 and Base24 for Shells
https://github.com/tinted-theming/home
MIT License
65 stars 217 forks source link

PSA: "Why my base16 theme doesn't get applied in tmux anymore?" #1

Closed szero closed 10 months ago

szero commented 2 years ago

Because tmux 3.3a ships with option allow-passthrough set to false by default now. Yup, I have no clue what that means, not that well versed on terminal emulation or ANSI escape sequences. Also it prefers to set TERM variable to tmux-256color as opposed to screen-256color now, so it may or may not mess up your other terminal applications dependent on this variable.

To get your stuff operable you would fancy to add these two lines in your tmux.conf:

set -g allow-passthrough on
# if having issues with your other programs dependent on TERM env variable
set -g default-terminal screen-256color

tmux 3.3a discussions: https://github.com/tmux/tmux/issues/3218

Hope it was worth the read.

JamyGolden commented 2 years ago

Thanks for the information! I'll look into this. Out of interest, what operating system and terminal are you using?

szero commented 2 years ago

xfce4-terminal and debian unstable, i've tried with st terminal from suckless and xterm and had same problems, its solely tmux related issue imo

szero commented 2 years ago

Analogous issue from OG base16-shell repo https://github.com/chriskempson/base16-shell/issues/211. Btw, I thought that this repo and organization wasn't a fork, it was just transferred from chriskempson to people willing to maintain the project but I guess thats not the case.

JamyGolden commented 2 years ago

Thanks for linking. Yes, what you say is partially true: @chriskempson has disappeared and no one has been able to contact Chris for a long time. There was a discussion about creating a base16 organization but Chris didn't end up completing that. Most (all?) of the chriskempson/base16* repos exist without anyone else having owner access. So there has been an effort to contact GitHub about this and get it moved over to base16-project, but I'm not sure how that will end up going. So in the mean time we're maintaining things on base16-project, trying to get all of the old maintainers to join and adding "deprecation" messages on the old repos that we've moved, like we have on chriskempson/base16. So while it is a fork, it's only because there isn't another option.

nbn22385 commented 2 years ago

Another tmux issue I noticed: since the "new" base16-shell writes to a BASE16_THEME environment variable (as opposed to the legacy behavior of writing to a ~/.vimrc_background file), any other existing tmux panes that open vim will launch with the last color scheme known to its environment when that pane was launched, and not use the latest BASE16_THEME variable set from the pane that set the theme.

Steps to reproduce:

  1. Open tmux with 2 panes. The current theme is Theme A.
  2. On Pane 1, set a new base16 theme. The new theme is Theme B.
  3. Switch to Pane 2
  4. On Pane 2 open vim. The vim colorscheme is still Theme A.

Workarounds:

JamyGolden commented 2 years ago

@nbn22385 I'm looking at creating a fix for this atm. Out of interest, what OS and terminal emulator do you use?

nbn22385 commented 2 years ago

MacOS 12.4 + Alacritty for personal use and Windows 10 + Windows Terminal for work.

jonleopard commented 2 years ago

Just wanted to report the same issue here on macOS 12.5 running Alacritty and Tmux 3.3a. Happy to provide any additional info if needed!

acidghost commented 1 year ago

I have the following setup: local machine with tmux, in one window I ssh (or mosh) into another machine and open a nested tmux session there; inside the nested tmux session I ssh into a local VM. In this scenario the theme is not applied correctly (it is if I ssh into the VM directly from a tmux window on my local machine, i.e. not nested).

To fix it I updated my theme at ~/.config/tinted-theming/base16_shell_theme to

if [ -n "$TMUX" ] || [ "${TERM%%[-.]*}" = "tmux" ]; then

because in the remote VM the variable TMUX is not set (it's not running inside the VM, but on the server hosting the VM that I use to access the VM) and TERM is set to tmux-256color.

Maybe it's worth to have the same change in: https://github.com/tinted-theming/base16-shell/blob/56de873b62500f144446a9bb66d541bddd5c38b5/templates/default.mustache#L33

tummetott commented 11 months ago

Is there ongoing work to enable support for base16 colors in tmux without requiring the passthrough option to be enabled?

JamyGolden commented 11 months ago

@tummetott my understanding is that allow-passthrough used to be set to on or enabled by default, but since version tmux version 3.3a, it's set to off by default.

So base16-shell has always required the allow-passthrough option to be enabled. There aren't any plans or any reasons to change anything related to this.

JamyGolden commented 10 months ago

Closing this issue now since the information is included in the repo readme.