Added --hold and -h function

master
Steven Saus 1 year ago
parent be27f769eb
commit a4edc7eee5
  1. 4
      README.md
  2. 14
      tmux_devour.sh
  3. 11
      tmux_sidebar.sh
  4. 12
      tmux_topbar.sh

@ -71,6 +71,10 @@ go through it. Very nice for programs like [emojin](https://github.com/peterjsc
For example, `tmux-sidebar.sh man man` will show you the man page for man in
the sidebar.
If the *first* argument is either `-h` or `--hold` then TDAB will pause after
executing the program and wait for you to hit a key (necessary for programs that
exit immediately, which triggers the pane closing).
If you run the scripts outside of tmux, it will just run the command.
### tmux_devour.sh

@ -8,8 +8,11 @@
#
##############################################################################
HOLD_VAR=""
if [ "$1" == "--hold" ] || [ "$1" == "-h" ];then
HOLD_VAR="True"
shift
fi
c_tmux=$(env | grep -c TMUX)
if [ $c_tmux -gt 0 ];then
command=$(echo "$@")
@ -19,10 +22,13 @@
printf '\033]2;%s\033\\' 'devour'
tmux resize-pane -t "$c_pane" -R 20
tmux select-pane -m -t "$c_pane"
command2=$(echo "eval \"${command}\" ; tmux kill-pane -t ${c_pane}")
if [ "$HOLD_VAR" == "True" ];then
command2=$(echo "eval \"${command}\" ; read ; tmux kill-pane -t ${c_pane}")
else
command2=$(echo "eval \"${command}\" ; tmux kill-pane -t ${c_pane}")
fi
tmux resize-pane -Z -t "$c_pane"
tmux send-keys -t "$c_pane" "$command2" C-m
else
eval "$@"
fi

@ -9,6 +9,11 @@
##############################################################################
HOLD_VAR=""
if [ "$1" == "--hold" ] || [ "$1" == "-h" ];then
HOLD_VAR="True"
shift
fi
c_tmux=$(env | grep -c TMUX)
if [ $c_tmux -gt 0 ];then
@ -20,7 +25,11 @@
#tmux swap-pane -s "$o_pane" -t "$c_pane"
printf '\033]2;%s\033\\' 'topbar'
tmux resize-pane -t "$c_pane" -R 30
command2=$(echo "eval \"${command}\" ; tmux kill-pane -t ${c_pane}")
if [ "$HOLD_VAR" == "True" ];then
command2=$(echo "eval \"${command}\" ; read ;tmux kill-pane -t ${c_pane}")
else
command2=$(echo "eval \"${command}\" ; tmux kill-pane -t ${c_pane}")
fi
tmux send-keys -t "$c_pane" "$command2" C-m
tmux last-pane
else

@ -8,6 +8,12 @@
#
##############################################################################
HOLD_VAR=""
if [ "$1" == "--hold" ] || [ "$1" == "-h" ];then
HOLD_VAR="True"
shift
fi
c_tmux=$(env | grep -c TMUX)
if [ $c_tmux -gt 0 ];then
@ -18,7 +24,11 @@
tmux swap-pane -s "$o_pane" -t "$c_pane"
printf '\033]2;%s\033\\' 'topbar'
tmux resize-pane -t "$c_pane" -U 14
command2=$(echo "eval \"${command}\" ; tmux kill-pane -t ${c_pane}")
if [ "$HOLD_VAR" == "True" ];then
command2=$(echo "eval \"${command}\" ; read; tmux kill-pane -t ${c_pane}")
else
command2=$(echo "eval \"${command}\" ; read ;tmux kill-pane -t ${c_pane}")
fi
tmux send-keys -t "$c_pane" "$command2" C-m
tmux last-pane
else

Loading…
Cancel
Save