Added list command to the byobu-layout

Since there is no way to list the layouts other than running 'ls' on the
  preferences directory, this commits adds the 'list' command to the byobu-layout
  helper.
This commit is contained in:
Srdjan Grubor 2014-06-30 10:45:43 -05:00
commit 458e1d313a

View file

@ -29,8 +29,6 @@ PRESETS="even-horizontal even-vertical main-horizontal main-vertical tiled"
current_panes=$(tmux list-panes | wc -l) current_panes=$(tmux list-panes | wc -l)
list_layouts() { list_layouts() {
echo
echo "Restore layout with <shift-F8>, save a layout with <shift-ctrl-F8>"
echo echo
echo "Byobu Saved Layouts" echo "Byobu Saved Layouts"
local count=0 i= desc= count= p= local count=0 i= desc= count= p=
@ -52,6 +50,8 @@ case "$1" in
if [ -n "$2" ]; then if [ -n "$2" ]; then
name="$2" name="$2"
else else
echo
echo "Restore layout with <shift-F8>, save a layout with <shift-ctrl-F8>"
while true; do while true; do
list_layouts list_layouts
echo -n "Enter a unique name to save this layout: " echo -n "Enter a unique name to save this layout: "
@ -115,8 +115,12 @@ case "$1" in
tmux select-layout "$layout" tmux select-layout "$layout"
tmux source "$BYOBU_PREFIX/share/byobu/profiles/tmuxrc" tmux source "$BYOBU_PREFIX/share/byobu/profiles/tmuxrc"
;; ;;
list)
list_layouts
exit 0
;;
*) *)
echo "ERROR: Invalid argument, try [save|restore]" 2>&1 echo "ERROR: Invalid argument, try [save|restore|list]" 2>&1
exit 1 exit 1
;; ;;
esac esac