1
0
mirror of https://github.com/Cloudef/bemenu synced 2024-11-26 05:58:25 +01:00
Commit Graph

83 Commits

Author SHA1 Message Date
Joan Bruguera Micó
fa84d4b2d6 Fix out-of-bounds read when parsing --list argument
When running bemenu like:
    env BEMENU_OPTS="--list 3" bemenu

Valgrind will report an out-of-bounds read:
    Invalid read of size 1
       at 0x10BC91: do_getopt.part.0 (common.c:366)
       by 0x10C635: do_getopt (common.c:340)
       by 0x10C635: parse_args (common.c:556)
       by 0x10B535: main (bemenu.c:55)
     Address 0x4ac13e2 is 0 bytes after a block of size 2 alloc'd
       at 0x4849BF3: calloc (vg_replace_malloc.c:1675)
       by 0x10C533: cstrcopy (common.c:120)
       by 0x10C533: tokenize_quoted_to_argv (common.c:146)
       by 0x10C60C: parse_args (common.c:555)
       by 0x10B535: main (bemenu.c:55)

The problem is that the parsing code for `--list` will blindly compare
a character past the number of lines to parse for e.g. `--list '3 up'`
but the end of the string may come right after the number of lines.

In my system Valgrind does not find the error when running bemenu like
`bemenu --list 3` even though the logic is equally questionable.

Fix it by checking that there is more after the number of lines.
2024-07-08 02:22:31 +09:00
Pablo Arias
f82eda732f add option to start vim bindings in normal mode 2023-12-02 23:24:20 +09:00
Lucas Merritt
46c3f76a7d Styling and behavior fixes
Fix many issues with styling related to bemenu and the upwards list
mode. In addition to this, fix/modify some behavior to improve
this(ex: border_size and border_radius are now a double).
2023-11-21 13:39:18 +09:00
Lucas Merritt
432753bfe9 Upwards list support(X11)
Add upwards list support for X11, as well as refactor/improve some
drawing code and flags.
2023-11-21 13:39:18 +09:00
Lucas Merritt
6ea2ed2cfe Update help/usage to add cursor background and foreground colors.
Cursor background and foreground colors were previously documented in
the man page, but not in help/usage.
2023-10-09 08:42:26 +09:00
Lucas Merritt
da41b831c1 Single-instance and multi-instance modes
Add flag and behavior for a forced single-instance mode.

Add XDG runtime directory possible selection and remove errx

Remove usage of errx and errno in the code, add the ability to select the XDG
runtime directory instead of /tmp for the bemenu lock file.
2023-10-09 08:42:02 +09:00
Lucas Merritt
d913466050 Password flag parameters with indicator option
Add parameters to the password flag, add an option in this flag to
enable indicator mode(display asterisks instead of hiding or
displaying the filter text).

Man page and help flag fix

Add password flag details to the man page, fix the help flag slightly
for better password flag details.
2023-10-09 08:41:40 +09:00
gesellkammer
a04dea3dc4 break long string into parts 2023-09-28 17:31:06 +09:00
gesellkammer
fa0461c847 new flag --auto-select, mirrors the behaviour of rofi's own -auto-select flag:
when there is only one option left during selection it is automatically
selected and the menu exits.
2023-09-28 17:31:06 +09:00
gesellkammer
266344471b fix --accept-single option 2023-09-28 17:31:06 +09:00
Robert Günzler
d7ef1f3310 Apply initial filter before evalutating accept-single
Follow up to 0a44fb65cdc052aeb53ee05ede05ac77ad2d2a0d
Which didn't actually result in the intended behavior of skipping all
menu interaction when `accept-single` is true and the initial filter
results in a single item.

This has the side effect that `ifne` now evaluates on the filtered items
as well.

Signed-off-by: Robert Günzler <r@gnzler.io>
2023-07-12 20:31:33 +09:00
ItsProfessional
c9b891e89b Add option to exit bemenu using esc in vim binds normal mode 2023-06-30 09:31:45 +09:00
Damien Tardy-Panis
879ae38766 Fix uninitialized pointer and touch structs in run_menu
Fixes #338
2023-05-08 21:18:13 +09:00
Lucas Merritt
d9ac320dd0
Add fixed height option(Addresses #270) (#326)
* added fixed height option && fixed counter
2023-02-18 18:30:55 +09:00
Lucas Merritt
77000a680c
Add Match/Page Counter(Addresses #204) (#325)
* counter with total item count

* filtered item counter

* optimized display code

* refactored overcomplicated code

* fixed warnings that failed Ubuntu test

* fixed inconsistent state

* CLI option for counter

* fixed vertical mode counter
2022-12-27 17:13:59 +09:00
Lucas Merritt
30379a88bf somewhat working, maybe fix background colors 2022-12-21 14:10:08 +09:00
Robert Günzler
0a44fb65cd Apply initial filter before evaluating accept-single
This lets us select fully non-interactive if we have a perfect match

Signed-off-by: Robert Günzler <r@gnzler.io>
2022-12-16 09:13:19 +09:00
Robert Günzler
516a2ab069 common: actually parse -F using getopt
Signed-off-by: Robert Günzler <r@gnzler.io>
2022-12-16 09:13:19 +09:00
Luca Nimmrichter
0c2bc885a1 Replace char *key_binding with an enum 2022-10-21 03:17:29 +09:00
Luca Nimmrichter
17481427a0 Replace --vim option with a generic --binding [name] option 2022-10-21 03:17:29 +09:00
Luca Nimmrichter
bcf53bcb25 Add basic vim bindings 2022-10-21 03:17:29 +09:00
dadav
d235dc38f7 Add support to disable pointer, touch and keyboard events
Sometimes you don't want the pointer/touch/keyboard to have any
influence on the menu (e.g. if you mainly use the keyboard, you don't
want the mouse to select an item by accident).

closes #299
2022-10-11 10:05:40 +09:00
Richard Kraus
22c7e3fd23 add --accept-single flag 2022-09-27 20:06:12 +09:00
Richard Kraus
c6bb62389c fix accidentally inserted tabs 2022-09-27 20:06:12 +09:00
Richard Kraus
24015ef32e change functionality of --ifne
a single item will not display the menu
2022-09-27 20:06:12 +09:00
Richard Kraus
7da8796291 fix ignored --monitor in BEMENU_OPTS env var 2022-09-18 10:14:11 +09:00
Joan Bruguera
8217ae024b Fix exiting when an unexpected Wayland error occurs.
If an unexpected error was returned from a Wayland API during rendering (e.g.
from wl_display_flush), the code did set input.sym = XKB_KEY_Escape, so that
the next call to poll_key would return BM_KEY_ESCAPE and bemenu would quit.

However, this has been broken since #135, because input.key_pending was not
set, so the "fake" XKB_KEY_Escape is just ignored, bemenu doesn't quit, but
instead, it enters an infinite loop and keeps a CPU core at 100% usage.

The "quick fix" would be to just set input.key_pending wherever input.sym was
set to XKB_KEY_Escape. However, to make error handling less error-prone,
decouple it from input handling and add an error flag to (bm_menu_)render.
2022-08-03 08:55:34 +09:00
Daniel Lublin
c04a3c7220 Add options to set cursor bg/fg color 2022-07-05 10:10:26 +09:00
Barbaross
8c1c29c0b9 Add option to define a border and border color 2022-06-29 15:13:09 +09:00
Barbaross
84bccc02a0 Add option to specify horizontal padding in single line mode 2022-06-03 09:20:10 +09:00
Barbaross
a8ef2457cb Add option to specify alternating entry background/foreground colors 2022-06-03 08:08:38 +09:00
Barbaross
9a76681b2c Add option to specify cursor width 2022-06-03 08:08:21 +09:00
Michael Hsu
81b509155c Fix --ch cursor height option parsing 2022-03-11 17:56:04 +09:00
Stacy Harper
9b8da12467 Add a feedback for touchscreen support
The idea is to write "Scroll up…", "Scroll down…" when the finger
touching bemenu will trigger a page scroll on release.
2022-02-08 22:23:02 +09:00
Stacy Harper
a111aa2afa mouse and touch support on wayland 2022-02-08 22:23:02 +09:00
Maxim Karasev
43255bbbe8 Add relative width option
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.
2021-12-29 17:22:10 +09:00
lunacb
cd41b1b52c add missing newline 2021-11-03 17:57:18 +09:00
lunacb
21ff4e47da fixed indentation 2021-11-03 17:57:18 +09:00
lunacb
a96ed87472 redesigned vertical alignment
single enum determines if the menu is at the top, in the center,
or at the bottom. implemented in wayland and x11 renderers.
2021-11-03 17:57:18 +09:00
lunacb
bddeea05b6 created margin option
-M or --margin option sets the horizontal margin of the window
2021-11-03 17:57:18 +09:00
Stacy Harper
9b2a2cabf2 Add -s to disable title spacing on entries 2021-10-07 00:25:20 +09:00
Ben Brown
0589962d1c Add option to configure cursor height
If set to 0 (the default), the height of the cursor is set to the
height of the line (as is the current behaviour).
2021-08-27 04:01:13 +09:00
Stacy Harper
a42fa97a49 add -c center mode on wayland 2021-08-16 17:46:57 +09:00
Robert Günzler
4612f9d327 wayland: Allow showing the menu on the focused monitor
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>
2021-05-22 04:12:59 +09:00
Sören Tempel
934aa6fbb9 client: make sure the monitor index defaults to -1
This ensures that the menu spawns on the current monitor by default when
using X11 or on all monitors when using Wayland.
2021-04-27 14:24:02 +09:00
Harley Swick
e74224a406 Use -m option for setting monitor name and monitor + cleanup 2021-02-05 16:53:43 +09:00
Robert Günzler
52547807b0
support hiding filter input (#150)
* support hiding filter input

"password mode"

Signed-off-by: Robert Günzler <r@gnzler.io>
2021-02-05 13:12:48 +09:00
Julian Mehne
7523af7d18 Add --filter option. 2020-11-15 11:30:03 +09:00
Dominic Monroe
64c38dde50 Add custom key support 2020-08-28 21:01:22 +09:00
Daniel Lublin
5387677720 Add --scrollbar none
Useful in aliases or scripts to override a previously enabled scrollbar
on the commandline.

Also correct documentation of bm_scrollbar_mode.
2020-06-15 15:09:42 +09:00