You are not logged in.
I have an annoying problem with Tmux. If I open a TTY and run Tmux in just the one window my middle-click/paste action works properly. However, if I split a window my middle-click merely changes which window should be the active one. I realise I could disable mouse support and get the correct middle-click behaviour I desire. However, I'd like to keep my middle-click/paste function with my mouse. Does anyone have a solution or pointer to a possible way to keep both functions intact?
Thank you! ![]()
Last edited by MoonSwan (2014-11-02 21:51:34)
Offline
A tty usually means the linux terminal outside of X, is this the case?
Post your tmux.conf. I'm using tmux with st terminal emulator and middle-click pasting works just fine.
Offline
Hi karol, yes I meant to say a terminal window in X, i.e., xfce4-terminal and roxterm. Pasting text only fails if I have tmuxvsplit its active (currently focused) window either horizontally or vertically. The pasting function fails even if I create a new window and then split that one within the tmux environment too.
My .tmux.conf:
#~/.tmux.conf - tmux terminal multiplexer config
# Based heavily on Thayer Williams' (http://cinderwick.ca)
## Environmental Options
# Enable tmux to use a 256 colour terminal
# Provided the underlying terminal supports 256 colours, it is usually sufficient to add the following to ~/.tmux.conf:
set -g default-terminal "screen-256color"
set -g terminal-overrides 'xterm*:smcup@:rmcup@'
# Set clock colour.
setw -g clock-mode-colour green
#setw -g clock-mode-colour blue
# If you SSH into a host in a tmux window, you'll notice the window title of your terminal emulator remains to be user@localhost
# rather than user@server. To allow the title bar to adapt to whatever host you connect to, set the following in ~/.tmux.conf
set -g set-titles on
set -g set-titles-string "#T"
# open a man page in new window
bind m command-prompt -p "new-window 'exec man %%'"
## By default, all windows in a session are constrained to the size of the
## smallest client connected to that session, even if both clients are
## looking at different windows. It seems that in this particular case, Screen
## has the better default where a window is only constrained in size if a
## smaller client is actively looking at it. This behaviour can be fixed by
## setting tmux's aggressive-resize option.
setw -g aggressive-resize on
## mouse-select-pane [on | off]
## If on, tmux captures the mouse and when a window is split into multiple panes
## the mouse may be used to select the current pane. The mouse click is also
## passed through to the application
set -g mouse-select-pane on
## Upon starting to use tmux, I noticed that I had to add a noticeable delay
## between two characters in a command sequence for it to recognize the
## command, for example between the C-a and n in C-a n. This is because tmux is
## waiting for an escape sequence. Fix that by setting escape time to zero.
set -s escape-time 0
### Hotkeys and Commands
## Binds
# set prefix key to ctrl+a
unbind C-b
set -g prefix C-a
## Quick way to mosh/ssh into another system bound to S [Shift-S]
bind S command-prompt -p 'SSH to:' "new-window -n %1 'mosh %1'"
# reload config without killing server
bind R source-file ~/.tmux.conf \; display-message "Config reloaded..."
# toggle last window like screen
bind-key C-a last-window
# more intuitive keybindings for splitting
unbind '%'
bind v split-window -v
bind - split-window -v
unbind '"'
bind h split-window -h
bind \ split-window -h
# send the prefix to client inside window (ala nested sessions)
bind-key a send-prefix
# confirm before killing a window or the server
bind-key k confirm kill-window
bind-key K confirm kill-server
# toggle statusbar
bind-key b set-option status
# ctrl+left/right cycles thru windows
#bind-key -n C-right next
#bind-key -n C-left prev
#bind-key -n M-right next
#bind-key -n M-left prev
# quick view of processes
bind '~' split-window "exec htop"
# scrollback buffer n lines
set -g history-limit 10000
# listen for activity on all windows
set -g bell-action none
set -g bell-on-alert on
set -g visual-bell on
# on-screen time for display-panes in ms
set -g display-panes-time 4000
# start window indexing at one instead of zero
set -g base-index 1
# disable wm window titles
set -g set-titles off
# disable auto renaming
#setw -g automatic-rename on
# border colours
set -g pane-active-border-bg default
#set -g pane-border-fg blue
# wm window title string (uses statusbar variables)
set -g set-titles-string "tmux:#I [ #W ]"
#set -g set-titles-string "tmux"
# session initialization
#new -s0 -nTTYtter 'ttytter'
#selectw -t 1
# --------------------------------------------------------------
### default statusbar colors
set -g status-fg default
set -g status-bg default
set -g status-attr bright
# --------------------------------------------------------------
### default window title colors
# set-window-option -g window-status-fg white
# set-window-option -g window-status-bg default
# set-window-option -g window-status-attr bright
### White Yunzi - command/message line colors
set -g message-fg green
set -g message-bg default
set -g message-attr bright
### Silver Yunzi - command/message line colors
#set -g message-fg white
#set -g message-bg default
#set -g message-attr bright
# --------------------------------------------------------------
### Pink Yunzi - command/message line colors
#set -g message-fg magenta
#set -g message-bg default
#set -g message-attr bright
### White Yunzi - statusbar
# set -g status-interval 1
# set -g status-justify centre # center align window list
# set -g status-left-length 30
# set -g status-left '#[fg=white,bright] [ #[fg=green,bright]#H#[fg=white,bright] ]#[fg=white,bright] Up #(uptime | cut -f 4-5 -d " "|cut -f 1 -d ",")'
# set -g status-right-length 30
# set -g status-right '#[fg=green,bright][#[fg=white,bright] %a %m-%d-%Y %H:%M #[fg=green,bright]]'
# set-window-option -g window-status-current-bg default
# set-window-option -g window-status-current-attr bright
# --------------------------------------------------------------
### Silver Yunzi - statusbar
set -g status-interval 1
set -g status-justify centre # center align window list
set -g status-left-length 30
set -g status-left '#[fg=white,bright][ #[fg=blue,bright]#H#[fg=white,bright] ]#[fg=white,bright] Up #(uptime | cut -f 4-5 -d " "|cut -f 1 -d ",")'
set -g status-right '#[fg=yellow]%k:%M #[fg=blue]%a,%d-%b#[default] '
set -g status-right-length 30
set -g status-right '#[fg=blue,bright][#[fg=white,bright] %a %b-%d-%Y %H:%M #[fg=blue,bright]]'
set-window-option -g window-status-current-bg default
set-window-option -g window-status-current-attr bright
## --------------------------------------------------------------
### Pink Yunzi - statusbar
# set -g status-interval 1
# set -g status-justify centre # center align window list
# set -g status-left-length 30
# set -g status-left '#[fg=white,bright] [ #[fg=magenta,bright]#H#[fg=white,bright] ]#[fg=white] Up #(uptime | cut -f 4-5 -d " "|cut -f 1 -d ",")'
# set -g status-right-length 30
# set -g status-right '#[fg=magenta,bright][#[fg=white,dim] %a %m-%d-]'
# set -g status-right '#[fg=blue,bright][#[fg=white,bright] %a %b-%d-%Y %H:%M #[fg=blue,bright]]'
# set-window-option -g window-status-current-bg default
# set-window-option -g window-status-current-attr bright
# --------------------------------------------------------------
#### White Yunzi - active window title colors
# set-window-option -g window-status-current-fg green
# set-window-option -g window-status-current-attr bright
# set-window-option -g window-status-current-bg default
# set-window-option -g window-status-current-attr bright
# --------------------------------------------------------------
#### Silver Yunzi - active window title colors
set-window-option -g window-status-current-fg white
set-window-option -g window-status-current-attr bright
set-window-option -g window-status-current-bg default
set-window-option -g window-status-current-attr bright
# --------------------------------------------------------------
#### Pink Yunzi - active window title colors
# set-window-option -g window-status-current-fg magenta
# set-window-option -g window-status-current-attr bright
# set-window-option -g window-status-current-bg default
# set-window-option -g window-status-current-attr bright
# --------------------------------------------------------------Edit - typos
Last edited by MoonSwan (2014-11-01 23:06:08)
Offline
Does it work if you're using a blank tmux.conf?
Offline
I tried it with a blank tmux.conf and pasting worked but as soon as I set the mouse selection option, set -g mouse-select-pane on, I was no longer able to paste with a middle click.
Offline
I can't even select with a mouse inside tmux with this setting.
Pasting with e.g. Shift+Ins works.
Offline
karol, yes I too found that Shift+Ins does work just fine. I want the mouse click paste behaviour because I have a Kinesis keyboard which has keys in awkward places for some keyboard shortcuts, i.e. Shift+Ins works but hitting those keys is almost impossible on my Kinesis.
Maybe I'm missing something obvious here and I'd like to know what that is.
Offline
I haven't done much testing, but
set -g mode-mouse onlets you copy, paste and select panes with a mouse.
Edit: It seems to break X clipboard i.e. selecting with a mouse in tmux won't let you paste the selection in e.g. firefox.
Last edited by karol (2014-11-01 23:59:17)
Offline
I see what you're saying about the clipboard. I'm glad someone else is seeing this behaviour. And enabling or disabling the mode-muse setting makes no difference about pasting with a mouse.
Offline
Did you reload the config?
Offline
I physically exited the tmux using the "exit" command and I made sure it wasn't running anymore after restarting roxterm. That should force it to reload the config file, I think. Still no joy.
Edit: Setting the mouse-mode to "on" and mouse-select-pane to "off" completely disabables middle-clicking. This is odd
Edit: Setting the options up like this I get middle-click functionality as long as my pane is whole:
set -g mode-mouse off
set -g mouse-select-pane onLast edited by MoonSwan (2014-11-02 00:45:44)
Offline
I have found an answer to my original question about pasting between tmux and other apps. The answer isn't what I really wanted as it uses keyboard-driven hotkeys but it adds functionality for both of X's clipboards. For an explanation of how this works and the person who coded it please look here: Tmux: Clipboard Integration.
The code that makes using both clipboards possible in tmux:
# C-c: save into system clipboard (+). With preselection.
bind C-c choose-buffer "run \"tmux save-buffer -b %% - | xclip -i -sel clipboard\" \; run \" tmux display \\\"Clipboard \(+\) filled with: $(tmux save-buffer -b %1 - | dd ibs=1 obs=1 status=noxfer count=80 2> /dev/null)... \\\" \" "
# C-v: copy from + clipboard.
bind C-v run "tmux set-buffer \"$(xclip -o -sel clipboard)\"; tmux paste-buffer" \; run "tmux display \"Copied from \(+\) $(xclip -o -sel clipboard | dd ibs=1 obs=1 status=noxfer count=80 2> /dev/null)... \""
# C-d: save into selection clipboard (*). With preselection.
bind C-d choose-buffer "run \"tmux save-buffer -b %% - | xclip -i\" \; run \" tmux display \\\"Clipboard \(*\) filled with: $(tmux save-buffer -b %1 - | dd ibs=1 obs=1 status=noxfer count=80 2> /dev/null)... \\\" \" "
# C-f: copy from * clipboard.
bind C-f run "tmux set-buffer \"$(xclip -o)\"; tmux paste-buffer" \; run "tmux display \"Copied from \(*\) $(xclip -o | dd ibs=1 obs=1 status=noxfer count=80 2> /dev/null)... \""The author's explanation of how this works:
this makes use of the xclip program to access the system and selection clipboards.
Marking this as [Solved]
Now, while in tmux:
Everytime you press the prefix key followed by C-v you will get the content of the system clipboard inside tmux.
Everytime you press the prefix key followed by C-c you will be asked to choose from the list of tmux paste-buffers. The buffer selected will be put into the system clipboard.The same copy/paste behaviour can be applied to the selection clipboard by using C-f and C-d.
Now admittedly point 1 above is not strictly necessary because there are usually system-wide shortcuts to do that, (Shift-Ctrl-v and Shift-Insert are the usual defaults in Linux) but I’m a sucker for symmetry.
Offline