* usr/bin/byobu, usr/lib/byobu/include/Makefile.am,

usr/lib/byobu/include/tmux-detach-all-but-current-client,
  usr/share/byobu/keybindings/f-keys.tmux,
  usr/share/byobu/keybindings/f-keys.tmux.disable,
  usr/share/doc/byobu/help.tmux.txt: LP: #939870
  - add a new keybinding, Alt-F6, which detaches all other clients
    + often used to maximize your tmux session, since tmux reduces
      the available size of your terminal to the smallest connected
      session
This commit is contained in:
Dustin Kirkland 2013-05-07 13:15:07 -05:00
commit 3a73583e91
7 changed files with 63 additions and 1 deletions

9
debian/changelog vendored
View file

@ -5,6 +5,15 @@ byobu (5.38) unreleased; urgency=low
* usr/bin/byobu-launch: * usr/bin/byobu-launch:
- append, rather than prepend, $PROMPT_COMMAND, as double-semi-colons - append, rather than prepend, $PROMPT_COMMAND, as double-semi-colons
are illegal, thanks to Christian Mäder in github for patch are illegal, thanks to Christian Mäder in github for patch
* usr/bin/byobu, usr/lib/byobu/include/Makefile.am,
usr/lib/byobu/include/tmux-detach-all-but-current-client,
usr/share/byobu/keybindings/f-keys.tmux,
usr/share/byobu/keybindings/f-keys.tmux.disable,
usr/share/doc/byobu/help.tmux.txt: LP: #939870
- add a new keybinding, Alt-F6, which detaches all other clients
+ often used to maximize your tmux session, since tmux reduces
the available size of your terminal to the smallest connected
session
-- Dustin Kirkland <kirkland@ubuntu.com> Sun, 21 Apr 2013 11:11:01 -0500 -- Dustin Kirkland <kirkland@ubuntu.com> Sun, 21 Apr 2013 11:11:01 -0500

View file

@ -2,6 +2,7 @@
# #
# byobu - wrapper script # byobu - wrapper script
# Copyright (C) 2008-2009 Canonical Ltd. # Copyright (C) 2008-2009 Canonical Ltd.
# Copyright (C) 2008-2013 Dustin Kirkland
# #
# Authors: Dustin Kirkland <kirkland@byobu.co> # Authors: Dustin Kirkland <kirkland@byobu.co>
# #
@ -59,6 +60,9 @@ esac
# At this point, we're sure BYOBU_BACKEND is properly defined # At this point, we're sure BYOBU_BACKEND is properly defined
export BYOBU_BACKEND export BYOBU_BACKEND
# Store the parent tty
export BYOBU_TTY=$(tty)
# Add a version argument for debugging purposes # Add a version argument for debugging purposes
if [ "$#" = "1" ]; then if [ "$#" = "1" ]; then
case "$1" in case "$1" in

View file

@ -1,2 +1,2 @@
inclibdirdir = $(prefix)/lib/@PACKAGE@/include inclibdirdir = $(prefix)/lib/@PACKAGE@/include
inclibdir_SCRIPTS = common constants cycle-status dirs mondrian notify_osd shutil ec2instancespricing.py inclibdir_SCRIPTS = common constants cycle-status dirs mondrian notify_osd shutil ec2instancespricing.py tmux-detach-all-but-current-client

View file

@ -0,0 +1,46 @@
#!/bin/sh
#
# tmux-detach-all-but-current-client
# Copyright (C) 2013 Dustin Kirkland
#
# Authors: Dustin Kirkland <kirkland@byobu.co>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
a1=
a2=
tty1=
tty2=
# List all clients, ordered by most recent activity descending
for c in $(tmux list-clients -F "#{client_activity}___#{client_tty}" | sort -n -r); do
if [ -z "$a1" ]; then
a1=${c%%___*}
tty1=${c##*___}
elif [ -z "$a2" ]; then
a2=${c%%___*}
tty2=${c##*___}
fi
if [ -n "$a1" ] && [ -n "$a2" ]; then
if [ "$a1" = "$a2" ]; then
# Activity timestamps match in top 2 attached clients
# Let's not detach anyone here!
tmux display-message "Multiple active attached clients detected, refusing to detach" >/dev/null 2>&1
elif [ -n "$tty1" ]; then
# Detach all but the current client, iterating across each
# Tempting to use detach-client -a -t here, but there's a bug
# in there, keeping that from working properly
tmux detach-client -t "$tty2" >/dev/null 2>&1
a2=
fi
fi
done

View file

@ -57,6 +57,7 @@ bind-key -n S-F5 new-window -k "$BYOBU_PREFIX/lib/byobu/include/cycle-status" \;
bind-key -n C-F5 send-keys ". $BYOBU_PREFIX/bin/byobu-reconnect-sockets" \; send-keys Enter bind-key -n C-F5 send-keys ". $BYOBU_PREFIX/bin/byobu-reconnect-sockets" \; send-keys Enter
bind-key -n C-S-F5 new-window -d "byobu-select-profile -r" bind-key -n C-S-F5 new-window -d "byobu-select-profile -r"
bind-key -n F6 detach bind-key -n F6 detach
bind-key -n M-F6 run-shell '$BYOBU_PREFIX/lib/byobu/include/tmux-detach-all-but-current-client'
bind-key -n S-F6 run-shell 'exec touch $BYOBU_RUN_DIR/no-logout' \; detach bind-key -n S-F6 run-shell 'exec touch $BYOBU_RUN_DIR/no-logout' \; detach
bind-key -n C-F6 kill-pane bind-key -n C-F6 kill-pane
bind-key -n F7 copy-mode bind-key -n F7 copy-mode

View file

@ -58,6 +58,7 @@ unbind-key -n S-F5
unbind-key -n C-F5 unbind-key -n C-F5
unbind-key -n C-S-F5 unbind-key -n C-S-F5
unbind-key -n F6 unbind-key -n F6
unbind-key -n M-F6
unbind-key -n S-F6 unbind-key -n S-F6
unbind-key -n C-F6 unbind-key -n C-F6
unbind-key -n F7 unbind-key -n F7

View file

@ -22,6 +22,7 @@ and some convenient keybindings:
Ctrl-Shift-F5 Change status bar's color randomly Ctrl-Shift-F5 Change status bar's color randomly
F6 Detach session and then logout F6 Detach session and then logout
Shift-F6 Detach session and do not logout Shift-F6 Detach session and do not logout
Alt-F6 Detach all clients but yourself
Ctrl-F6 Kill split in focus Ctrl-F6 Kill split in focus
F7 Enter scrollback history F7 Enter scrollback history
Alt-PageUp/PageDown Enter and move through scrollback Alt-PageUp/PageDown Enter and move through scrollback