k9s icon indicating copy to clipboard operation
k9s copied to clipboard

K9s enableMouse not working in a tmux

Open davehouser1 opened this issue 1 year ago • 7 comments




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):

  • OS: Ubuntu 22.04 -- Kernel: 5.15.146.1-microsoft-standard-WSL2
  • K9s: v0.32.5
  • K8s: kubectl client = v1.30.0, sever: v1.29.7

Additional context I did the following trouble shooting:

  • Make sure my ~/.config/k9s/config.yml has ui.enableMouse set to true.
  • Opened k9s in a regular WSL session without tmux running, Mouse works as expected. I can scroll logs with the mouse. However clicking does not seem to do anything, not sure if this is a limitation of k9s, WSL, or something else. Is clicking supported with mouse control?
  • Tried running WSL session in Windows Terminal, and MobaXterm. Problem happens in all, k9s mouse functionality is over shadowed by tmux.

davehouser1 avatar Aug 27 '24 16:08 davehouser1

Same problem in alacrity

AndrewP-GH avatar Sep 19 '24 09:09 AndrewP-GH

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

uozalp avatar Sep 23 '24 07:09 uozalp

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'

uozalp avatar Sep 25 '24 12:09 uozalp

@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.

davehouser1 avatar Sep 26 '24 17:09 davehouser1

It works for me with Ubuntu + wsl

uozalp avatar Sep 26 '24 18:09 uozalp

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?

davehouser1 avatar Sep 26 '24 18:09 davehouser1

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

uozalp avatar Sep 27 '24 17:09 uozalp

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] avatar May 17 '25 02:05 github-actions[bot]