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.
and provide BEMENU_BACKEND env variable. Change API to reflect this
change.
There is no reliable way to detect when running on terminal (especially
when stdin is a pipe), so we need to make curses backend explicit with
BEMENU_BACKEND=curses or bm_menu_new("curses"), otherwise GUI backend
will be choosed automatically.