2 title: X11 keybindings for easier terminal clipboard handling
3 date: 2015-02-12 15:35:15+01:00
7 After years of annoyance with the X11 behaviour for clipboard and selection
8 handling with regards to terminal applications, I managed to find a good
9 compromise via some additional shortcurts in my window manager of choice, dwm
10 and terminal multiplexer, tmux.
12 Now, pressing `C-o p` (in tmux) pastes from X11 primary selection, `C-o P` from
13 the clipboard and `Linux-z` (meaning the key formerly known is Windows key)
14 exchanges clipboard and primary selection, so no more awkward pasting and
15 selecting with the mouse in order to get the correct string in the correct
18 # to switch clipboard and primary selection
19 PRIMARY=`xsel -op`; xsel -ob | xsel -ip; echo "$PRIMARY" | xsel -ib
21 # to paste from primary selection in tmux
22 bind p run "tmux set-buffer \"$(xsel -op)\"; tmux paste-buffer
24 Other useful keybindings in tmux would copying into the clipboard etc. and
26 post](https://unix.stackexchange.com/questions/77355/tmux-xclip-copy-no-longer-working/77587#77587)
29 As before this is public at the
30 [customisations](https://github.com/Ferada/dwm/tree/customisations) branch on
31 Github; I still have to upload the tmux part though.