derailed / k9s

🐶 Kubernetes CLI To Manage Your Clusters In Style!
https://k9scli.io
Apache License 2.0
27.19k stars 1.7k forks source link

K9s enableMouse not working in a tmux #2853

Open davehouser1 opened 2 months ago

davehouser1 commented 2 months ago




Describe the bug When running k9s in a tmux session, mouse support does not work. This is when ui.enableMouse is turned on.

To Reproduce Steps to reproduce the behavior:

  1. Open WSL session
  2. Start tmux with tmux or attach an already active sessions with tmux attach -dt 0
  3. Try to use the mouse select, nothing happens. Mouse scroll scrolls the window up as tmux will take over in visual mode. Note: this does not happen in vim when mouse is enabled in a tmux session.

Expected behavior When opening k9s in tmux, mouse clicks operate as expected, mouse scroll of logs scroll without moving up the the current tmux session.

Versions (please complete the following information):

Additional context I did the following trouble shooting:

AndrewP-GH commented 1 month ago

Same problem in alacrity

uozalp commented 1 month ago

Works fine for me. This is only an issue if you enable mouse support in your tmux configuration file

uozalp commented 1 month ago

This works with k9s and mouse support enabled

set -g mouse on
bind -n WheelUpPane if -F '#{alternate_on}' 'send-keys Up' 'if -F "#{mouse_any_flag}" "send -M" "copy-mode -e; send-keys -M"'
bind -n WheelDownPane if -F '#{alternate_on}' 'send-keys Down' 'send-keys -M'
davehouser1 commented 1 month ago

@uozalp

This is only an issue if you enable mouse support in your tmux configuration file

Yes, I have mouse enabled in my tmux configuration, why would that influence k9s? I would think k9s should be able to support itself without affecting tmux. There are two family of problems I am running into. The first is the problems above. The second is a family of problems that affect tmux whenever k9s is turned on (even with mouse settings disabled in k9s). An example is, if I have k9s running in a pane, tmux mouse no longer works. If I scroll up on a pane in the same window k9s is running on, the whole window scrolls up. If I try to click a pane, it wont click (I have to move with the keyboard). Note: this only affects panes on the active window running k9s. If I switch to a different window I can use tmux mouse just fine. This family of problems may require a different issue opened up which I can do if you all think that is necessary. Also why would this matter? I have mouse enabled in vim and in tmux, and using the mouse in vim still works in vim AND tmux. Also having mouse enabled in tmux and vim does not affect how tmux runs.

This works with k9s and mouse support enabled

Did not work for me, same problem.

At this point I do not even want mouse to work in k9s. I want k9s to stop breaking tmux's use of the mouse whenever its open. I cant use the tmux mouse if k9s is running in any pane on the active window I am running.

uozalp commented 1 month ago

It works for me with Ubuntu + wsl

davehouser1 commented 1 month ago

It works for me with Ubuntu + wsl

When you get a chance can you share your full tmux.conf / k9s configs? Also share cat /etc/*release and uname -r?

uozalp commented 1 month ago

5.15.153.1-microsoft-standard-WSL2

DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=22.04
DISTRIB_CODENAME=jammy
DISTRIB_DESCRIPTION="Ubuntu 22.04.3 LTS"
PRETTY_NAME="Ubuntu 22.04.3 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.3 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=jammy
unbind C-b
set-option -g prefix C-a
bind-key C-a send-prefix

# Mouse
set -g mouse on
bind -n WheelUpPane if -F '#{alternate_on}' 'send-keys Up' 'if -F "#{mouse_any_flag}" "send -M" "copy-mode -e; send-keys -M"'
bind -n WheelDownPane if -F '#{alternate_on}' 'send-keys Down' 'send-keys -M'

# Splitting
unbind '"'
unbind %
unbind *
bind '+' split-window -h
bind '-' split-window -v
bind '*' split-window -vf
bind -r -T prefix M-Up    resize-pane -U 10
bind -r -T prefix M-Down  resize-pane -D 10
bind -r -T prefix M-Left  resize-pane -L 10
bind -r -T prefix M-Right resize-pane -R 10
bind -r -T prefix C-Up    resize-pane -U
bind -r -T prefix C-Down  resize-pane -D
bind -r -T prefix C-Left  resize-pane -L
bind -r -T prefix C-Right resize-pane -R

# Copy
setw -g mode-keys vi
bind-key -T copy-mode-vi 'v' send -X begin-selection     # Begin selection in copy mode.
bind-key -T copy-mode-vi 'C-v' send -X rectangle-toggle  # Begin selection in copy mode.
bind-key -T copy-mode-vi 'y' send -X copy-selection      # Yank selection in copy mode.

# Status Bar
setw -g status-justify left
setw -g window-status-separator ""
setw -g status-style 'fg=#ffa600,bg=#99bcc2'

setw -g window-status-current-format "\
#[fg=#ababab,bg=#e8b017]\
#[fg=black,bg=#ababab] [#I] \
#[fg=black,bg=#ababab]#W\
#[fg=black]#F \
#[fg=#ababab,bg=#e8b017]"

setw -g status-left '#[fg=#99bcc2,bg=#e8b017]'
setw -g window-status-format "\
#[fg=#828282,bg=#e8b017]\
#[fg=white,bg=#828282] [#I] \
#[fg=white,bg=#828282]#W\
#[fg=white,bg=#828282]#F \
#[fg=#828282,bg=#e8b017]"

# Wifi IP
setw -g status-right "#[fg=black]#(ipconfig.exe | grep 'Ethernet adapter Ethernet 3' -A4 | cut -d':' -f 2 | tail -n1 | sed -e 's/\s*//g') [%H:%M %d-%b-%y]"

#set -g status-bg '#a3a3a3'
#set -g status-bg '#99bcc2'
#set -g status-fg '#ffa600'

# General
bind X kill-pane
set-option -g history-limit 4000