* usr/lib/byobu/include/layout => usr/bin/byobu-layout,

usr/share/byobu/keybindings/f-keys.tmux, usr/share/man/man1/byobu-
  layout.1:
  - move the layout library utility to a generally usable byobu-layout
    in the system path
  - add specific named layout support to both save and restore operations
  - add a manpage
This commit is contained in:
Dustin Kirkland 2012-01-08 18:26:52 -06:00
commit 692a34bdf0
4 changed files with 67 additions and 29 deletions

7
debian/changelog vendored
View file

@ -4,6 +4,13 @@ byobu (5.2) unreleased; urgency=low
- save some space in the tarball - save some space in the tarball
* usr/lib/byobu/logo: * usr/lib/byobu/logo:
- add a linux mint logo - add a linux mint logo
* usr/lib/byobu/include/layout => usr/bin/byobu-layout,
usr/share/byobu/keybindings/f-keys.tmux, usr/share/man/man1/byobu-
layout.1:
- move the layout library utility to a generally usable byobu-layout
in the system path
- add specific named layout support to both save and restore operations
- add a manpage
-- Dustin Kirkland <kirkland@ubuntu.com> Thu, 29 Dec 2011 12:28:51 -0600 -- Dustin Kirkland <kirkland@ubuntu.com> Thu, 29 Dec 2011 12:28:51 -0600

View file

@ -69,37 +69,43 @@ case "$1" in
printf "$panes\n$layout\n" > "$BYOBU_CONFIG_DIR/layouts/$name" printf "$panes\n$layout\n" > "$BYOBU_CONFIG_DIR/layouts/$name"
;; ;;
"restore") "restore")
# List the saved layouts, prompt the user to select one if [ -n "$2" ]; then
list_layouts # Layout selected on the command line
count="$_RET" name="$2"
while true; do else
echo -n "Select a layout to restore [1-$count]: " # List the saved layouts, prompt the user to select one
selected=$(head -n1) list_layouts
if [ -n "$selected" ] && [ $selected -le $count ] && [ $selected -ge 1 ]; then count="$_RET"
break while true; do
fi echo -n "Select a layout to restore [1-$count]: "
done selected=$(head -n1)
if [ -n "$selected" ] && [ $selected -le $count ] && [ $selected -ge 1 ]; then
break
fi
done
count=0
for i in $PRESETS "$DIR"/*; do
count=$(expr $count + 1)
if [ $count -eq $selected ]; then
name=$(basename "$i")
break
fi
done
fi
# Get the details of the selected layout # Get the details of the selected layout
count=0
panes= panes=
layout= layout=
for i in $PRESETS "$DIR"/*; do if [ -f "$DIR/$name" ]; then
count=$(expr $count + 1) panes=$(head -n1 "$DIR/$name")
if [ $count -eq $selected ]; then layout=$(tail -n1 "$DIR/$name")
if [ -f "$i" ]; then else
panes=$(head -n1 "$i") if [ $current_panes -eq 1 ]; then
layout=$(tail -n1 "$i") panes=4
else else
if [ $current_panes -eq 1 ]; then panes=0
panes=4
else
panes=0
fi
layout="$i"
fi
break
fi fi
done layout="$name"
fi
# Create panes if nececessary to restore the layout # Create panes if nececessary to restore the layout
while [ $(tmux list-panes | wc -l) -lt $panes ]; do while [ $(tmux list-panes | wc -l) -lt $panes ]; do
tmux split-window tmux split-window

View file

@ -61,8 +61,8 @@ bind-key -n M-NPage copy-mode \; send-keys NPage
bind-key -n M-PPage copy-mode \; send-keys PPage bind-key -n M-PPage copy-mode \; send-keys PPage
bind-key -n F8 command-prompt -p "(rename-window)" "rename-window %%" bind-key -n F8 command-prompt -p "(rename-window)" "rename-window %%"
bind-key -n S-F8 next-layout bind-key -n S-F8 next-layout
bind-key -n C-F8 new-window -k "$BYOBU_PREFIX/lib/byobu/include/layout restore; clear; $SHELL" bind-key -n C-F8 new-window -k "byobu-layout restore; clear; $SHELL"
bind-key -n C-S-F8 command-prompt -p "Save byobu layout as:" "run-shell '$BYOBU_PREFIX/lib/byobu/include/layout save %%'" bind-key -n C-S-F8 command-prompt -p "Save byobu layout as:" "run-shell 'byobu-layout save %%'"
bind-key -n F9 new-window -k -n config byobu-config bind-key -n F9 new-window -k -n config byobu-config
bind-key -n M-F11 break-pane bind-key -n M-F11 break-pane
bind-key -n C-F11 join-pane -h -s :. -t :-1 bind-key -n C-F11 join-pane -h -s :. -t :-1

View file

@ -0,0 +1,25 @@
.TH byobu-layout 1 "8 Jan 2012" byobu "byobu"
.SH NAME
byobu\-layout \- Save and restore byobu-tmux laouts
.SH USAGE
byobu\-layout [save|restore] [name]
.SH DESCRIPTION
\fBbyobu\-layout\fP will save and restore \fBbyobu-tmux\fP(1) split window layouts.
If 'name' is blank, it operates interactively.
Note that this only works with Byobu when backed by \fBtmux\fP(1), and not \fBscreen\fP(1).
.SH SEE ALSO
\fBbyobu\fP(1), \fBtmux\fP(1)
.TP
\fIhttp://launchpad.net/byobu\fP
.PD
.SH AUTHOR
This manpage and the utility were written by Dustin Kirkland <kirkland@ubuntu.com> for Ubuntu systems (but may be used by others). Permission is granted to copy, distribute and/or modify this document and the utility under the terms of the GNU General Public License, Version 3 published by the Free Software Foundation.
The complete text of the GNU General Public License can be found in \fI/usr/share/common-licenses/GPL\fP on Debian/Ubuntu systems, or in \fI/usr/share/doc/fedora-release-*/GPL\fP on Fedora systems, or on the web at \fIhttp://www.gnu.org/licenses/gpl.txt\fP.