This method is more concise, doesn't require the checks the previous
method did, allows for both the --option=value and --option value
syntaxes, and still uses getopts. I'm not sure if there is some good
reason to not pre-parse the arguments in this way though.
Addresses #12
Exit with an error message if
- A long option that requires an arg is specified without =
- No positional argument is given (for the program name or auto commands)
- A negative width or height is given without -m
- Numeric options do not have a number value
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
Arguments of long-options (e.g. --program-flags='--foo=bar') may contain
equal sign characters (=). Before this fix, these kind of options were
split up into "program-flags" and "--foo" removing the last part of the
argument. This was because only the first two colums from `awk -F= ...`
were used.
Now these kind of options will be split up correctly using Bash parameter
expansion: "program-flags" and "--foo=bar".
See man bash > Parameter Expansion for details.
Tested with:
sudo cp tdrop /usr/bin/tdrop
tdrop -W --program-flags='-e tmux --role=tdropwindow' termite
tdrop -W -f '-e tmux --role=tdropwindow' termite
tdrop --normal-window -f '-e tmux --role=tdropwindow' termite
It also works for boolen long-option flags without argument. In this
case both OPTION and OPTARG are set to the long-option name. Boolean
options don't use the OPTARG so it doesn't matter.
When there is no active window, open the dropdown and use it to
determine the current monitor. This can result in delay before the
dropdown is resized. Closes#3.
Previously, if the dropdown was unmapped from another monitor and then
remapped on that monitor, the dropdown would not be resized since the
unmapping would change the stored "last_monitor".
This is apparently necessary for at least i3 when remapping a dropdown
and also for bspwm when first creating one (otherwise the dropdown will
be created at the absolute position xoff yoff even if it is not on the
current monitor).
Addresses #3
- Use window id to float windows, so that the wrong window isn't ever
accidentally floated
- Sleep when first creating window to ensure it is mapped before
resizing/floating