Determine the WID of a created window by checking the WID(s) associated
with the PID until one is viewable. This allows tdrop to reliably
determine the WID of the programs it starts and prevents capturing the
wrong window.
- Combine wid_create and term_create into one (which removes the need
for the -W option)
- Remove differing sleep settings for various window managers
- Get rid of a loop to check if the WID has been found
`-s` should only be used for terminals if the user wants to start a tmux or tmuxinator session. `-W` should be used if the program to start is not a terminal with an `-e` flag. `-a` should be used to set up WM specific rules (which are required for the --width, --height, --xoff, and --yoff flags to work properly; see below for supported WMs). Long options require using `--opt=<arg>` as opposed to leaving a space. Refer to `tdrop --help` and the manpage for more complete instructions.
`-s` should only be used for supported terminals and if the user wants to start a tmux or tmuxinator session. `-a` should be used to set up WM specific rules (which are required for the --width, --height, --xoff, and --yoff flags to work properly; see below for supported WMs). Long options require using `--opt=<arg>` as opposed to leaving a space. Refer to `tdrop --help` and the manpage for more complete instructions.
*Changes*
Old users please note that `-W|--normal-window`, `-z|--sleep-terminal`, and `-Z|--sleep-window` are no longer necessary and have been removed.
### Flicker
### Flicker
For some window managers that require a window to be repositioned after re-mapping it, some flicker may be noticeable. With a recent change, this flicker is pretty much gone for some window managers (e.g. in the Gnome Shell and Cinnamon DEs) and slightly better than before in other
For some window managers that require a window to be repositioned after re-mapping it, some flicker may be noticeable. With a recent change, this flicker is pretty much gone for some window managers (e.g. in the Gnome Shell and Cinnamon DEs) and slightly better than before in other
-w width specify a width for a newly created term (default: 45%)
-w width specify a width for a newly created term (default: 45%)
-x pos specify x offset for a newly created term (default: 0)
-x pos specify x offset for a newly created term (default: 0)
-y pos specify y offset for a newly created term (default: 1, see BUGS in man)
-y pos specify y offset for a newly created term (default: 1, see BUGS in man)
-s name name for tmux or tmuxinator session (if not given, will not use tmux)
-s name name for tmux or tmuxinator session (requires the program to be a supported terminal)
-n num num or extra text; only needed if want multiple dropdowns of same program (default: "")
-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 pre-map command to float the window if necessary
-P cmd provide a post-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
-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 current')
-O cmd provide a one time command only for when a dropdown is created/initiated (useful for 'tdrop current')
-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)
-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)
-z use a different sleep time to wait for terminal to be created (advanced; see man page)
-Z use a different sleep time for -W program to be created (advanced; see man page)
-f specify flags/options to be used when creating the term or window (e.g. -f '--title mytitle', default: none)
-f specify flags/options to be used when creating the term or window (e.g. -f '--title mytitle', default: none)
-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)
-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)
-m for use with multiple monitors and only with dropdowns (not for auto_show or auto_hide); convert percentages used for width or height to values relative to the size of the current monitor and force reszing of the dropdown when the monitor changes (default: false)
-m for use with multiple monitors and only with dropdowns (not for auto_show or auto_hide); convert percentages used for width or height to values relative to the size of the current monitor and force reszing of the dropdown when the monitor changes (default: false)
-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')
--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)
@ -57,18 +54,12 @@ map_post=""
unmap_post=""
unmap_post=""
oneshot_post=""
oneshot_post=""
dec_fix=""
dec_fix=""
sleep_term_time=0.01
sleep_term_user_set=false
sleep_win_time=0.5
sleep_win_user_set=false
program_flags=""
program_flags=""
normal_window=false
clearwid=false
clearwid=false
cancel_auto_show=true
cancel_auto_show=true
term=${*:0-1}
auto_detect_wm=false
auto_detect_wm=false
monitor_aware=false
monitor_aware=false
while getopts :h:w:x:y:s:n:p:P:M:O:d:z:Z:f:-:Wam opt
while getopts :h:w:x:y:s:n:p:P:M:O:d:f:-:am opt
do
do
case $opt in
case $opt in
h) height=$OPTARG;;
h) height=$OPTARG;;
@ -82,12 +73,7 @@ do
M) unmap_post=$OPTARG;;
M) unmap_post=$OPTARG;;
O) oneshot_post=$OPTARG;;
O) oneshot_post=$OPTARG;;
d) dec_fix=$OPTARG;;
d) dec_fix=$OPTARG;;
z) sleep_term_time=$OPTARG
sleep_term_user_set=true;;
Z) sleep_win_time=$OPTARG
sleep_win_user_set=true;;
f) program_flags=$OPTARG;;
f) program_flags=$OPTARG;;
W) normal_window=true;;
a) auto_detect_wm=true;;
a) auto_detect_wm=true;;
m) monitor_aware=true;;
m) monitor_aware=true;;
-)
-)
@ -105,12 +91,7 @@ do
post-unmap) unmap_post=$OPTARG;;
post-unmap) unmap_post=$OPTARG;;
oneshot-post) oneshot_post=$OPTARG;;
oneshot-post) oneshot_post=$OPTARG;;
decoration-fix) dec_fix=$OPTARG;;
decoration-fix) dec_fix=$OPTARG;;
sleep-terminal) sleep_term_time=$OPTARG
sleep_term_user_set=true;;
sleep-window) sleep_win_time=$OPTARG
sleep_win_user_set=true;;
program-flags) program_flags=$OPTARG;;
program-flags) program_flags=$OPTARG;;
normal-window) normal_window=true;;
auto-detect-wm) auto_detect_wm=true;;
auto-detect-wm) auto_detect_wm=true;;
monitor-aware) monitor_aware=true;;
monitor-aware) monitor_aware=true;;
clear) clearwid=true;;
clear) clearwid=true;;
@ -260,14 +241,7 @@ wm_autoset_for_all() {
elif [[ $wm == awesome ]]; then
elif [[ $wm == awesome ]]; then
# awesome remembers size, but need to float and then set size first
# awesome remembers size, but need to float and then set size first
map_post_oneshot() {
map_post_oneshot() {
# need sleep time to wait for window be created or will float wrong one..
@ -31,7 +31,7 @@ Specify the x position for a created window as a number or percentage. (default:
Specify the y position for a created window as a number or percentage. (default: 1, see BUGS)
Specify the y position for a created window as a number or percentage. (default: 1, see BUGS)
.TP
.TP
\fB\-s\fR, \fB \-\-session\fR
\fB\-s\fR, \fB \-\-session\fR
Specify a tmuxinator or tmux session name to start. An existing tmux session has highest precedence and will be connected to with '-d', detaching other attached clients. If a there is no tmuxinator session of the given name, a normal tmux session with the name will be created. If this option is not given, tmux will not be used. (default: none)
Specify a tmuxinator or tmux session name to start. An existing tmux session has highest precedence and will be connected to with '-d', detaching other attached clients. If a there is no tmuxinator session of the given name, a normal tmux session with the name will be created. If this option is not given, tmux will not be used. Note that this option requires that the program be a supported terminal. (default: none)
.TP
.TP
\fB\-n\fR, \fB \-\-number\fR
\fB\-n\fR, \fB \-\-number\fR
Specify a number to add when saving dropdown information. Only needed if multiple dropdowns of the same program are wanted. Can also be used for creating multiple different dropdowns on the fly. (default: none)
Specify a number to add when saving dropdown information. Only needed if multiple dropdowns of the same program are wanted. Can also be used for creating multiple different dropdowns on the fly. (default: none)
@ -51,18 +51,9 @@ Specify a post command to execute only when first creating or initiating a dropd
\fB\-d\fR, \fB \-\-decoration-fix\fR
\fB\-d\fR, \fB \-\-decoration-fix\fR
Specify a window decoration/border size in the form <x decoration size>x<y decoration size> to be taken into account when saving window position. This should not be necessary for most window managers and is only used with 'auto_show', e.g. 'tdrop -d 1x22 auto_show' for blackbox. (default: none)
Specify a window decoration/border size in the form <x decoration size>x<y decoration size> to be taken into account when saving window position. This should not be necessary for most window managers and is only used with 'auto_show', e.g. 'tdrop -d 1x22 auto_show' for blackbox. (default: none)
.TP
.TP
\fB\-z\fR, \fB \-\-sleep-terminal\fR
Specify an alternate sleep time to wait for a terminal emulator to be completed. Only use this option if tdrop ends up capturing a different window as the dropdown when you press a dropdown key. You probably won't need to change this, and if you do, please report it. I hope to remove the need for sleeping entirely in the future. (default: 0.1)
.TP
\fB\-Z\fR, \fB \-\-sleep-window\fR
Specify an alternate sleep time to wait for a window to be completed. This is for use with -W or for -a with tiling window managers that cannot pre-float the next instance of a window (e.g. awesome and i3 if no rule to always float a specific class). Only use this option if tdrop ends up capturing a different window as the dropdown when you press a dropdown key. You probably won't need to change this, and if you do, please report it. I hope to remove the need for sleeping entirely in the future. (default: 0.5)
.TP
\fB\-f\fR, \fB \-\-program-flags\fR
\fB\-f\fR, \fB \-\-program-flags\fR
Specify flags/options that the terminal or program should be called with. For example, to set the title of the terminal, something like '-f "--title mytitle"' can be used. (default: none)
Specify flags/options that the terminal or program should be called with. For example, to set the title of the terminal, something like '-f "--title mytitle"' can be used. (default: none)
.TP
.TP
\fB\-W\fR, \fB \-\-normal-window\fR
Specifies that the program is not a terminal or does not have the '-e' flag; takes no argument. If using 'tdrop current', this option will have no effect either way. (default: false)
.TP
\fB\-a\fR, \fB \-\-auto-detect-wm\fR
\fB\-a\fR, \fB \-\-auto-detect-wm\fR
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 <terminal>', '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 <terminal>', '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
.TP
@ -147,9 +138,7 @@ mime ^image, has sxiv, X, flag f = tdrop auto_hide ; sxiv -a -- "$@" && tdrop -a
With terminals, it is easy to use the -e flag to reliably get window id and perform actions such as resizing. When using tdrop with a normal window (-W), the window id is gotten from the program's pid. This can be problematic when the pid has multiple window ids and the first one is not the desired one (I have yet to encounter this problem). More importantly, this means that tdrop has to wait to get the window id, resulting in a delay before it is floated/resized. This may cause visual annoyance when first creating a dropdown. There is a fork of xtoolwait that starts a program and returns its window id when created, but this has not been merged. Note that this only matters if the user wants to resize/float a normal window; it won't cause problems with a tiled dropdown.
If -y is set to 0, a window may be subsequently moved to the middle when showing/mapping it with xdotool. This may have to do with the window border.
Also, if -y is set to 0, a window may be subsequently moved to the middle when showing/mapping it with xdotool. This may have to do with the window border.
.SH AUTHOR
.SH AUTHOR
Lit Wakefield <nocturnalartifice at gmail dot com>
Lit Wakefield <nocturnalartifice at gmail dot com>