Skip to content
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

Kube module keeps going blank #301

Closed
1 task done
pauldthomson opened this issue Aug 29, 2024 · 10 comments · Fixed by #305
Closed
1 task done

Kube module keeps going blank #301

pauldthomson opened this issue Aug 29, 2024 · 10 comments · Fixed by #305
Labels
bug Something isn't working

Comments

@pauldthomson
Copy link
Contributor

pauldthomson commented Aug 29, 2024

Is there an existing issue outlining your problem?

  • I have searched the existing issues and they do not solve my problem.

Describe your problem.

The kube module stops showing anything and I have to reload my tmux conf to make it appear again

Paste your configuration.

set -g default-terminal 'tmux-256color'
# set -as terminal-overrides ',xterm*:Tc:sitm=\E[3m'

# Workaround for tmux + system clipbaord on MacOS
if-shell "[ type reattach-to-user-namespace ]" \
	"set-option -g default-command \"reattach-to-user-namespace -l bash\""

set-window-option -g mode-keys vi

# Automatically set window title
set-window-option -g automatic-rename on
set-option -g set-titles on

# Prompt for window title when creating new window
bind-key c command-prompt -p "Name of new window: " "new-window -n '%%'"

# Send prefix to nested tmux sessions
bind-key a send-prefix

# Disable delay between escape key and subsequent keys in vim
set -sg escape-time 0

# Start window numbering at 1
set -g base-index 1

# Automatically renumber windows if one is closed
set -g renumber-windows on

# Start pane numbering at 1
setw -g pane-base-index 1

# Scroll history
set -g history-limit 3000

# Enable mouse scrolling
setw -g mouse on

# Stay in copy mode on drag end.
unbind-key -T copy-mode-vi MouseDragEnd1Pane

# Pane resizing with PREFIX + Alt-hjkl
bind -r H resize-pane -L 5
bind -r J resize-pane -D 5
bind -r K resize-pane -U 5
bind -r L resize-pane -R 5

# Set prefix to space.
unbind-key C-b
set-option -g prefix C-Space

# Split pane horizontally with PREFIX + -
bind - split-window -v -c '#{pane_current_path}'

# Split pane vertically with PREFIX + |
bind | split-window -h -c '#{pane_current_path}'

# Use vim style keys
set -g status-keys vi
setw -g mode-keys vi

# Reload .tmux.conf with PREFIX r
bind r source-file ~/.tmux.conf \; display "Reloaded!"

# Smart pane switching with awareness of Vim splits.
# See: https://github.com/christoomey/vim-tmux-navigator
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
    | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
bind-key -n C-h if-shell "$is_vim" "send-keys C-h"  "select-pane -L"
bind-key -n C-j if-shell "$is_vim" "send-keys C-j"  "select-pane -D"
bind-key -n C-k if-shell "$is_vim" "send-keys C-k"  "select-pane -U"
bind-key -n C-l if-shell "$is_vim" "send-keys C-l"  "select-pane -R"
# bind-key -n C-\ if-shell "$is_vim" "send-keys C-\\" "select-pane -l"
bind-key -T copy-mode-vi C-h select-pane -L
bind-key -T copy-mode-vi C-j select-pane -D
bind-key -T copy-mode-vi C-k select-pane -U
bind-key -T copy-mode-vi C-l select-pane -R
# bind-key -T copy-mode-vi C-\ select-pane -l

# Use <prefix> C-l to clear screen
bind C-l send-keys "C-l"

# Copy to system clipboard
bind -T copy-mode-vi 'v' send-keys -X begin-selection
bind -T copy-mode-vi 'y' send-keys -X copy-pipe-and-cancel "pbcopy"

# Interactive search of windows/sessions
bind j split-window -v "tmux list-sessions -F '#S' | fzf --reverse | xargs tmux switch-client -t"
bind k split-window -v "tmux list-window -F '#W' | fzf --reverse | xargs tmux select-window -t"

# Plugins
set -g @plugin 'catppuccin/tmux#latest'
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'jonmosco/kube-tmux'

set -g @catppuccin_window_left_separator ""
set -g @catppuccin_window_right_separator " "
set -g @catppuccin_window_middle_separator " █"
set -g @catppuccin_window_number_position "right"

set -g @catppuccin_window_default_fill "number"
set -g @catppuccin_window_default_text "#W"

set -g @catppuccin_window_current_fill "number"
set -g @catppuccin_window_current_text "#W"

set -g @catppuccin_status_modules_right "session kube"
set -g @catppuccin_status_left_separator  " "
set -g @catppuccin_status_right_separator ""
set -g @catppuccin_status_fill "icon"
set -g @catppuccin_status_connect_separator "no"

set -g @catppuccin_directory_text "#{pane_current_path}"

run '~/.tmux/plugins/tpm/tpm'

Attach screenshots.

Screen.Recording.2024-08-30.at.9.40.40.AM.mov

What tmux version are you seeing the issue on?

tmux 3.4

Any additional comments?

I have been running kube-tmux for a long time prior to using catppuccin and this issue didn't exist, so it seems theme related?

@pauldthomson pauldthomson added the bug Something isn't working label Aug 29, 2024
@vdbe
Copy link
Contributor

vdbe commented Aug 30, 2024

Can you show the output of tmux show-options -g status-right when starting tmux and after reloading it once?

It seems that the env TMUX_PLUGIN_MANAGER_PATH is empty here when using ~/.tmux.conf instead of ~/.config/tmux/tmux.conf but not for the shell (and subsequent reloads)

image
notice the #(KUBE_TMUX_SYMBOL_ENABLE=false kube-tmux/kube.tmux 250 '#f38ba8' '#89dceb') before and #(KUBE_TMUX_SYMBOL_ENABLE=false /home/user/.tmux/plugins/kube-tmux/kube.tmux 250 '#f38ba8' '#89dceb') after reload.

@pauldthomson
Copy link
Contributor Author

Before:

:!tmux show-options -g status-right
status-right "#[fg=#{?client_prefix,#f38ba8,#a6e3a1},bg=default,nobold,nounderscore,noitalics] #[fg=#1e1e2e,bg=#{?client_prefix,#f38ba8,#a6e3a1},nobold,nounderscore,noitalics] #[fg=#cdd6f4,bg=#313244] #
S#[fg=#313244,bg=default,nobold,nounderscore,noitalics]#[fg=#89b4fa,bg=default,nobold,nounderscore,noitalics] #[fg=#1e1e2e,bg=#89b4fa,nobold,nounderscore,noitalics]󱃾 #[fg=#cdd6f4,bg=#313244] #(KUBE_TMUX
_SYMBOL_ENABLE=false kube-tmux/kube.tmux 250 '#f38ba8' '#89dceb')#[fg=#313244,bg=default,nobold,nounderscore,noitalics]"

after:

:!tmux show-options -g status-right
status-right "#[fg=#{?client_prefix,#f38ba8,#a6e3a1},bg=default,nobold,nounderscore,noitalics] #[fg=#1e1e2e,bg=#{?client_prefix,#f38ba8,#a6e3a1},nobold,nounderscore,noitalics] #[fg=#cdd6f4,bg=#313244] #
S#[fg=#313244,bg=default,nobold,nounderscore,noitalics]#[fg=#89b4fa,bg=default,nobold,nounderscore,noitalics] #[fg=#1e1e2e,bg=#89b4fa,nobold,nounderscore,noitalics]󱃾 #[fg=#cdd6f4,bg=#313244] #(KUBE_TMUX
_SYMBOL_ENABLE=false /Users/paul/.tmux/plugins/kube-tmux/kube.tmux 250 '#f38ba8' '#89dceb')#[fg=#313244,bg=default,nobold,nounderscore,noitalics]"

Seems you're on to a winner... I'll have a look in the TPM repo

@pauldthomson
Copy link
Contributor Author

Yeah odd, seems it should always get set when launching tmux: https://github.com/tmux-plugins/tpm/blob/99469c4a9b1ccf77fade25842dc7bafbc8ce9946/tpm#L26-L35

Will need to dig some more

@pauldthomson
Copy link
Contributor Author

So the issue seems to be that setting the tmux env var this way: https://github.com/tmux-plugins/tpm/blob/99469c4a9b1ccf77fade25842dc7bafbc8ce9946/tpm#L34
doesn't actually get sent to the initial shell spawned inside the tmux window: https://stackoverflow.com/questions/20701757/tmux-setting-environment-variables-for-sessions#comment114609472_49395839

I added an export "$DEFAULT_TPM_ENV_VAR_NAME"="$tpm_path" below the line from tpm above and it fixes the issue.

I'm not sure why this hasn't been noticed before, perhaps not many other things rely on this env var?

I'll open an issue on tpm and see what the response is, and see if perhaps there's a cleaner way to fix this.

@vdbe
Copy link
Contributor

vdbe commented Sep 3, 2024

A better solution would be to escape the dollar sign so the env var is interpreted during the status update.

@pauldthomson
Copy link
Contributor Author

A better solution would be to escape the dollar sign so the env var is interpreted during the status update.

Yeah, I thought there was an issue with the way tpm was setting that var so figured it would be good to fix at the source but looks not to be the case anyway. I'll raise a minor PR here..

@Xysto
Copy link

Xysto commented Nov 14, 2024

Hello @pauldthomson, it seems that the problem is back with the new version (at least >2.0) but I have no idea how to fix it again as the shell scripts are no more. Do you think you can take a look or point me in the right direction?

@pauldthomson
Copy link
Contributor Author

@Xysto yep, been meaning to raise this actually, I also think there's an issue with adding custom status modules but that's a separate one. I'll open a PR for this.

pauldthomson added a commit to pauldthomson/tmux that referenced this issue Nov 14, 2024
As per
catppuccin#301 (comment),
it seems the issue returned in v2.0
pauldthomson added a commit to pauldthomson/tmux that referenced this issue Nov 14, 2024
As per
catppuccin#301 (comment),
it seems the issue returned in v2.0
pauldthomson added a commit to pauldthomson/tmux that referenced this issue Nov 14, 2024
As per
catppuccin#301 (comment)
this issue has returned in v2.0
@pauldthomson
Copy link
Contributor Author

@Xysto ^^

kjnsn pushed a commit that referenced this issue Nov 14, 2024
@Xysto
Copy link

Xysto commented Nov 14, 2024

Oh wow, that was fast! Thanks a lot @pauldthomson !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants