It works on Wayland and X11 and acts as a complement to margin. Exact
behavior is as follows:
- If width factor is 0, width minus margin is used.
- If width multiplied by factor is greater than width minus margin,
width minus is used. (so margin may be used to make sure that bemenu
is at least N pixels away from the view border)
- Otherwise width multiplied by factor is used.
I think it's fine to disable warnings about floating point numbers
comparision. We don't do any arithmetics on them anyway, so we can't
suffer from inaccuracy.
On most systems it's fairly uncommon to have hidden files within
`$PATH`, but in case of NixOS this is fairly regularly the case as we
have the convention to add `foo` and `.foo-wrapped` to a `bin`-directory
if `foo` is supposed to be a wrapper which sets e.g. env-vars for the
program.
These `.foo-wrapped`-executables are almost never needed, but are shown
in `bemenu` right at the start, so I modified the selection code to skip
hidden files which is also what `dmenu` does for instance.
This adds an alias 'focused' for selecting the current monitor, which
becomes the default on x11 and wayland. The previous wayland default of
displaying on all outputs moves under '-2' or 'all'.
ref: https://github.com/Cloudef/bemenu/issues/102#issuecomment-604562234
Signed-off-by: Robert Günzler <r@gnzler.io>
The previous version of this code operated under the assumption that
getline(3) lines are always \n\0 terminated. Unfortunately, this is not
the case as readline will return input which is not terminated with a
newline character if EOF is reached before encountering this newline. In
these cases, the code would falsely strip the last character. As an
example, consider the following bemenu invocation:
printf foo | ./bemenu
This would start bemenu with `fo` instead of `foo` as a menu item. This
commit fixes this edge case and also hardens the loop body a bit by only
entering it if getline wrote more than zero characters to the buffer.
Not sure why the code didn't use this function previously, but
getline(3) is mandatory since POSIX.1-2008 and should thus be supported
by all maintstream operating systems. The proposed changes make the code
easier to read and should also make it more efficient memory-wise as it
does not necessarily cause the entire input to be copied into memory at
once.
Text is displayed vertically centered in a line. If unspecified, or 0,
the previous behaviour of making the height the size of the text, plus
two pixels on either side, is used, so there will be no change in
behaviour if this option is not used.
Fixes https://github.com/Cloudef/bemenu/issues/44.