Lorsqu'on utilise tmux afin de gérer plusieurs machines à la fois, il peut être utile de zoomer entre les différents panneaux.
Voici un script à mettre dans .byobu/bin inspiré de Juan Ignacio Pumarino ( https://github.com/jipumarino/tmux-zoom ) qui apporte une émulation de zoom sous tmux.
Pour fonctionner, il faut rajouter dans ~/.byoburc.tmux le racourci:
bind z run "~/byobu/bin/tmux-zoom.sh"
Le script ci joint :
#!/bin/bash # Copyright (c) 2012 Juan Ignacio Pumarino, jipumarino@gmail.com # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, merge, publish, # distribute, sublicense, and/or sell copies of the Software, and to # permit persons to whom the Software is furnished to do so, subject to # the following conditions: # # The above copyright notice and this permission notice shall be # included in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # Instructions # ------------ # # 1. Install this script and give it execute permission somewhere in your PATH. # For example: # # $ mkdir -p ~/byobu/bin # $ chmod +x ~/byobu/bin/tmux-zoom.sh # # 2. Add a shortcut in your ~/.byoburc.tmux file: # # bind z run "~/byobu/bin/tmux-zoom.sh" # # 3. When using this shortcut, the current tmux pane will open in a new window by itself. # Running it again in the zoomed window will return it to its original pane. You can have # as many zoomed windows as you want. # Modification par Vitry David Gilbert lours974 # Amélioration de la gestion multizoom en multifenêtre current=$(tmux display-message -p '#W-#I-#P') list=$(tmux list-window) [[ "${current}" =~ ^(.*)-([0-9]+)-([0-9]+) ]] current_window=${BASH_REMATCH[1]} window_nb=${BASH_REMATCH[2]} pane_nb=${BASH_REMATCH[3]} new_zoom_window=ZOOM-${window_nb}-${pane_nb} #Verifiez que la synchronisation des commande n'est pas actif sinon on zoom tout if [ "$(tmux select-pane -t ${window_nb}.${pane_nb} \; show-window-options synchronize-panes| grep 'synchronize-panes on'| wc -l)" -gt 0 ] then tmux display-message "Désactiver synchronize-panes sur ${window_nb}.${pane_nb}" exit 0 fi #Emulation du zoom #Dézoomer if [[ ${current_window} =~ ZOOM-([0-9]+)-([0-9]+) ]] then old_zoom_window=ZOOM-${BASH_REMATCH[1]}-${BASH_REMATCH[2]} orig_window=${BASH_REMATCH[1]} orig_pane=${BASH_REMATCH[2]} tmux select-window -t ${orig_window} \; select-pane -t ${orig_pane} \; swap-pane -s ${orig_window}.${orig_pane} -t ${old_zoom_window}.0 \; kill-window -t ${old_zoom_window} elif [[ ${list} =~ ${new_zoom_window} ]] then # retour vers la fenêtre zoomer correspondant au panneau tmux select-window -t ${new_zoom_window} else # Zoomer if [ "$(tmux list-pane | wc -l )" -gt "1" ] then tmux new-window -d -n ${new_zoom_window} \; swap-pane -s ${window_nb}.${pane_nb} -t ${new_zoom_window}.0 \; select-window -t ${new_zoom_window} setw synchronize-panes -t ${new_zoom_window} off else #Pas de zoom sur panneau seul tmux display-message "Un seul panneau, pas de zoom" fi fi