add --clear option

long-opts
angelic-sedition 10 years ago
parent b138d2c3b3
commit 87849d3f64

@ -20,6 +20,7 @@ options:
-P cmd provide a post command to float the window if necessary -P cmd provide a post command to float the window if necessary
-O cmd provide a one time command only for when a dropdown is created/initiated (useful for 'tdrop -c') -O cmd provide a one time command only for when a dropdown is created/initiated (useful for 'tdrop -c')
-W the given program is not a terminal (or lacks an -e flag) (default: assume it IS a terminal) -W the given program is not a terminal (or lacks an -e flag) (default: assume it IS a terminal)
--clear clear saved window id; useful accidentally make a window a dropdown (e.g. '$ tdrop --clear current')
--no-cancel don't cancel auto-showing --no-cancel don't cancel auto-showing
(default is to prevent this when manually toggling a term after it is auto-hidden) (default is to prevent this when manually toggling a term after it is auto-hidden)
--help print help --help print help
@ -44,6 +45,7 @@ oneshot_post=""
session_name="" session_name=""
num="" num=""
normal_window=false normal_window=false
clearwid=false
cancel_auto_show=true cancel_auto_show=true
term=${*:0-1} term=${*:0-1}
while getopts :h:w:x:y:s:n:p:P:O:-:W opt while getopts :h:w:x:y:s:n:p:P:O:-:W opt
@ -73,6 +75,7 @@ do
post-command) float_post=$OPTARG;; post-command) float_post=$OPTARG;;
oneshot-post) oneshot_post=$OPTARG;; oneshot-post) oneshot_post=$OPTARG;;
normal-window) normal_window=true;; normal-window) normal_window=true;;
clear) clearwid=true;;
no-cancel) cancel_auto_show=false;; no-cancel) cancel_auto_show=false;;
help) print_help;; help) print_help;;
esac;; esac;;
@ -219,7 +222,9 @@ toggle_auto_hide() {
} }
if [[ -n $1 ]]; then if [[ -n $1 ]]; then
if [[ $term == toggle_auto_hide ]]; then if $clearwid; then
> /tmp/tdrop/"$term$num"
elif [[ $term == toggle_auto_hide ]]; then
toggle_auto_hide toggle_auto_hide
elif [[ $term == auto_hide ]]; then elif [[ $term == auto_hide ]]; then
auto_hide auto_hide

Loading…
Cancel
Save