mirror of
https://github.com/dustinkirkland/byobu
synced 2025-08-22 06:23:19 -07:00
* 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:
parent
4b93e536cf
commit
3a73583e91
7 changed files with 63 additions and 1 deletions
9
debian/changelog
vendored
9
debian/changelog
vendored
|
@ -5,6 +5,15 @@ byobu (5.38) unreleased; urgency=low
|
|||
* usr/bin/byobu-launch:
|
||||
- append, rather than prepend, $PROMPT_COMMAND, as double-semi-colons
|
||||
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
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#
|
||||
# byobu - wrapper script
|
||||
# Copyright (C) 2008-2009 Canonical Ltd.
|
||||
# Copyright (C) 2008-2013 Dustin Kirkland
|
||||
#
|
||||
# Authors: Dustin Kirkland <kirkland@byobu.co>
|
||||
#
|
||||
|
@ -59,6 +60,9 @@ esac
|
|||
# At this point, we're sure BYOBU_BACKEND is properly defined
|
||||
export BYOBU_BACKEND
|
||||
|
||||
# Store the parent tty
|
||||
export BYOBU_TTY=$(tty)
|
||||
|
||||
# Add a version argument for debugging purposes
|
||||
if [ "$#" = "1" ]; then
|
||||
case "$1" in
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
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
|
||||
|
|
46
usr/lib/byobu/include/tmux-detach-all-but-current-client
Executable file
46
usr/lib/byobu/include/tmux-detach-all-but-current-client
Executable 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
|
|
@ -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-S-F5 new-window -d "byobu-select-profile -r"
|
||||
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 C-F6 kill-pane
|
||||
bind-key -n F7 copy-mode
|
||||
|
|
|
@ -58,6 +58,7 @@ unbind-key -n S-F5
|
|||
unbind-key -n C-F5
|
||||
unbind-key -n C-S-F5
|
||||
unbind-key -n F6
|
||||
unbind-key -n M-F6
|
||||
unbind-key -n S-F6
|
||||
unbind-key -n C-F6
|
||||
unbind-key -n F7
|
||||
|
|
|
@ -22,6 +22,7 @@ and some convenient keybindings:
|
|||
Ctrl-Shift-F5 Change status bar's color randomly
|
||||
F6 Detach session and then logout
|
||||
Shift-F6 Detach session and do not logout
|
||||
Alt-F6 Detach all clients but yourself
|
||||
Ctrl-F6 Kill split in focus
|
||||
F7 Enter scrollback history
|
||||
Alt-PageUp/PageDown Enter and move through scrollback
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue