1
0
mirror of https://github.com/Cloudef/bemenu synced 2024-11-23 17:32:11 +01:00
Commit Graph

268 Commits

Author SHA1 Message Date
Jari Vetoniemi
9817071f3a menu: make bm_menu_item_is_selected internal 2022-02-19 09:38:02 +09:00
Jari Vetoniemi
b427e0d35e internal: remove util.h include 2022-02-19 09:38:02 +09:00
Jari Vetoniemi
d201c48421 get rid of all the internal symbols 2022-02-19 08:00:26 +09:00
Jari Vetoniemi
c13e28f4b5 menu: make all run functions part of public API
also remove the unused unicode arguments
2022-02-19 07:41:23 +09:00
Stacy Harper
76b3c25014 Avoid by zero divisions 2022-02-08 22:23:02 +09:00
Stacy Harper
5a095705d2 Optimize redrawing
We add a dirty flag on the menu to track if the menu actually need a
redraw. With it, we will not redraw if the touch is hold on the same
entry by example.
2022-02-08 22:23:02 +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
Andrei E
d593ab27b6 Close clipboard file 2021-11-04 09:01:29 +09:00
Andrei E
e1a016b8a0 Adapt code style 2021-11-04 09:01:29 +09:00
Andrei E
00efc974d7 Add paste functionality 2021-11-04 09:01:29 +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
Sergei Trofimovich
d31164db75 lib/renderers/curses/curses.c: always use "%s"-style format for printf()-style functions
`ncuses-6.3` added printf-style function attributes and now makes
it easier to catch cases when user input is used in palce of format
string when built with CFLAGS=-Werror=format-security:

    lib/renderers/curses/curses.c:234:9:
      error: format not a string literal and no format arguments [-Werror=format-security]
      234 |         mvprintw(0, 0, menu->title);
          |         ^~~~~~~~

Let's wrap all the missing places with "%s" format.
2021-11-03 17:57:06 +09:00
rei de vries
b7f8db7128 revert to single padding variable
but with height instead of ascii_height used as the box height
2021-10-07 00:32:25 +09:00
rei de vries
2eea64ad24 convert tab to spaces 2021-10-07 00:32:25 +09:00
rei de vries
9fcc611082 fix incorrect line height due to padding quantization 2021-10-07 00:32:25 +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
Stacy Harper
a84eeb770e fix scaling caused issue on window redimension on wayland
This caused issue when using the -b (bottom) and -l (line) arguments on
scaled outputs.

When using a scaled output, the set_size use a wrong value as height.
We generated a scalled buffer so we used a scale x too high size.

We just have to divide the scaling to use a good size.
2021-08-15 13:27:58 +09:00
Tuyen Pham
32aa05789e add contrl-c to exit 2021-07-22 09:05:41 +09:00
Tuyen Pham
81195da11c wayland: respect sway's keyboard rate settings 2021-07-06 10:29:47 +09:00
Jari Vetoniemi
ca6b903415 curses: revert alt detection
This seems to be broken at least on some terminals and the high bit
toggle corrupts input. In addition there was printf for the esc/alt key
detection that can break the UI.

Neovim seems to have noncompatible way of detecting alt, so I think
neovim should be looked for proper way for handling this.
2021-06-07 16:30:12 +09:00
Bill Doyle
69d030573c Handle multiple seats (more) correctly
Previously, any seat without a keyboard could destroy our selected
keyboard. Now, select by seat instead and only destroy the keyboard if
it vanishes from that seat. This isn't actually multi-seat support, but
at least it will allow bemenu to accept input.
2021-06-06 23:31:57 +09:00
Robert Günzler
a81c80f81f wayland: update wlr-layer-shell-unstable-v1 protocol
Signed-off-by: Robert Günzler <r@gnzler.io>
2021-05-22 04:12:59 +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
Jari Vetoniemi
4b7b483bd6 cairo: fix gnu_printf format warning 2021-05-07 23:50:45 +09:00
Jari Vetoniemi
dd276c0a15 curses: fix build for OSX 2021-05-07 23:43:11 +09:00
Jari Vetoniemi
203d79e063 curses: fix bad format string for draw_line 2021-05-07 23:40:56 +09:00
Jari Vetoniemi
ebd7338bd5 s/cairo/cairo_renderer/ and fix cairo include
The documented canonical include for cairo is #include <cairo.h>
2021-05-07 23:38:15 +09:00
Sören Tempel
2e922503e8 x11: Align -m argument interpretation with dmenu
With dmenu, monitor indices start at 0 and a value of -1 (the default)
is used to spawn dmenu on the current monitor. While bemenu strives to
be compatible with dmenu, bemenu monitor indices previously started at 1
and a value of 0 (the default) was used to spawn on the current monitor.

This commit aligns the behaviour of bemenu's x11 backend with dmenu. For
this purposes, the affected code in the x11 backend is synced with the
current dmenu implementation. While doing so the monitor type has also
been switched from a uint32_t to a int32_t.
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
Peter Colberg
1dfa72b8bc Fix missing definition for bm_menu_add_item_at
The function was declared in bemenu.h but defined using a different name.
2020-12-13 17:10:41 +09:00
Peter Colberg
38c2958573 Declare filter_dmenu_fun as static
This is an internal function that should not be exported from the library.
2020-12-13 17:10:07 +09:00
Peter Colberg
a9cee36e85 Support compilation with -fvisibility=hidden
When using a compiler with support for GNU C extensions (GCC, Clang),
explicitly mark functions shared across library boundaries as visible.

This is the default visibility and has no effect when compiling with the
default CFLAGS. When compiling with -fvisibility=hidden, however, this
exports only functions marked BM_PUBLIC and hides all others.

https://gcc.gnu.org/wiki/Visibility

This facilitates packaging for distributions that track shared library
symbols, e.g., Debian, which uses a symbol file to provide the minimal
version associated to each symbol exported by a library.

https://www.debian.org/doc/debian-policy/ch-sharedlibs.html#the-symbols-system
https://manpages.debian.org/unstable/dpkg-dev/dpkg-gensymbols.1.en.html
2020-12-13 17:09:44 +09:00
fancycade
1bd40d0a44 Add key_pending field to sync wayland keyboard event loops 2020-10-10 16:22:07 +09:00
Dominic Monroe
64c38dde50 Add custom key support 2020-08-28 21:01:22 +09:00
Peter Colberg
20661aed78 Drop CMakeLists.txt for curses renderer 2020-08-23 09:41:47 +09:00
Jari Vetoniemi
65cea5e20a cairo: add BEMENU_SCALE env variable
Allows overriding the scaling factor for bemenu
2020-06-29 00:12:20 +09:00
Jari Vetoniemi
7266ebb795 cairo: fix hidpi rendering 2020-06-29 00:06:19 +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
Jari Vetoniemi
d9f4d1bb12 cairo: don't draw left scroll indicator if empty
If there are no matches the left indicator would be still drawn as black
box. If filter string is long enough, this black box would cover part of
the filter string.
2020-05-08 12:20:35 +03:00
Tuomas Siipola
bdfc2aac84 menu: fix delete on multi-byte characters 2020-04-19 15:16:14 +03:00
Tuomas Siipola
33cec5cff6 cairo: fix cursor position on multi-byte input
`pango_layout_index_to_pos` expects byte index
2020-04-19 15:16:14 +03:00
Jari Vetoniemi
6343a658bb wayland: support showing bemenu on all monitors 2020-03-25 19:16:57 +02:00
Cole Helbling
cd53b7bb55 x11,wayland: treat keypad enter as normal enter 2020-03-19 09:23:32 +02:00