diff --git a/tdrop b/tdrop index 733bf59..3e25fc0 100755 --- a/tdrop +++ b/tdrop @@ -18,6 +18,7 @@ options: -n num num or extra text; only needed if want multiple dropdowns of same program (default: "") -p cmd provide a pre-map command to float the window if necessary -P cmd provide a post-map command to float the window if necessary + -M cmd provide a post-unmap command; can be used for example with a window manager that doesn't support floating to turn fullscreen on when mapping a terminal then off when unmapping it -O cmd provide a one time command only for when a dropdown is created/initiated (useful for 'tdrop -c') -d XxY give decoration/border size to accurately save position; only applicable with auto_show; on applicable with a few window managers (e.g. blackbox) -a automatically detect window manager and if settings exist for it, automatically set -p, -P, and -d values as necessary; this can have affect when used with a terminal or with auto_show or auto_hide (default: false) @@ -47,6 +48,7 @@ xoff=0 yoff=1 map_pre="" map_post="" +unmap_post="" oneshot_post="" session_name="" num="" @@ -66,6 +68,7 @@ do n) num=$OPTARG;; p) map_pre=$OPTARG;; P) map_post=$OPTARG;; + M) unmap_post=$OPTARG;; O) oneshot_post=$OPTARG;; d) dec_fix=$OPTARG;; W) normal_window=true;; @@ -82,6 +85,7 @@ do number) num=$OPTARG;; pre-command) map_pre=$OPTARG;; post-command) map_post=$OPTARG;; + post-unmap) unmap_post=$OPTARG;; oneshot-post) oneshot_post=$OPTARG;; decoration-fix) dec_fix=$OPTARG;; normal-window) normal_window=true;; @@ -173,6 +177,12 @@ map_post_command() { fi } +unmap_post_command() { + if [[ -n $unmap_post ]]; then + eval "$unmap_post" + fi +} + maybe_cancel_auto_show() { if $cancel_auto_show && [[ $1 == "$(< /tmp/tdrop/auto_hidden/wid)" ]]; then > /tmp/tdrop/auto_hidden/wid diff --git a/tdrop.groff b/tdrop.groff index de36143..f9651a5 100644 --- a/tdrop.groff +++ b/tdrop.groff @@ -42,6 +42,9 @@ Specify a command to execute before showing/mapping a dropdown. This may be usef \fB\-P\fR, \fB \-\-post-command\fR Specify a command to execute after showing/mapping a dropdown. This may be useful in the case where a window manager does not support floating rules or floating altogether. It can be used, for example, to fake a key combo to float the current window. (default: none) .TP +\fB\-M\fR, \fB \-\-post-unmap\fR +Specify a command to execute after unmapping a dropdown. This can be used with window managers that don't support floating in conjunction with '--pre-command' to, for example, change the layout to fullscreen when mapping a dropdown and then revert it when umapping it. (default: none) +.TP \fB\-O\fR, \fB \-\-oneshot-post\fR Specify a post command to execute only when first creating or initiating a dropdown. This can be used when turning the current window into a dropdown to float and resize it. (default: none) .TP @@ -52,7 +55,7 @@ Specify a window decoration/border size in the form x', 'tdrop auto_hide', and 'tdrop auto_show'. For 'auto_hide', if the window manager is supported, it will check if the current window is tiled so that it is not changed to floating when auto-showing. (default: false) +If there are available settings for the detected window manager for the -p, -P, -M, and/or -d options, automatically set them; takes no argument. User set settings will still override these. This can be used with 'tdrop ', 'tdrop auto_hide', and 'tdrop auto_show'. For 'auto_hide', if the window manager is supported, it will check if the current window is tiled so that it is not changed to floating when auto-showing. (default: false) .TP \fB \-\-clear\fR Used to clear a saved window id for the given program or 'current' instead of creating a dropdown; takes no argument.