1
0
forked from RepoMirrors/bemenu
Commit Graph

337 Commits

Author SHA1 Message Date
Joan Bruguera Micó
6f63f3f197 Fix transposed calloc arguments warning
GCC 14 added a new warning (included in `-Wextra`) when calling
`calloc` with `sizeof` in the first argument and the number of
elements in the second argument. See:
https://gcc.gnu.org/onlinedocs/gcc-14.1.0/gcc/Warning-Options.html#index-Wcalloc-transposed-args

Note that this is just a coding style warning.
2024-07-08 02:22:31 +09:00
ldev
5bc8a6caaa removed another unused variable (displayed) in curses renderer 2024-06-16 21:57:55 +09:00
ldev
9fc92189a1 removed unused varible scroll_count in lib/menu.c 2024-06-16 21:57:55 +09:00
ldev
c1326672d9 changed offset between filter and title so they don't overlap, removed
random rect that causes filter with opacity to behave weird
2024-06-16 21:57:16 +09:00
Peter Hofmann
75122a023a Clipboard: Don't use "text/plain"
On X11, not all programs offer this target, e.g. some terminals like
XTerm. The target "UTF8_STRING" has worked fine for many years and it is
what dmenu uses.

On Wayland, wl-paste supports the special type "text", which attempts to
autodetect a suitable type (in case there is no exact match for
"text/plain").
2024-06-16 15:50:52 +09:00
Peter Hofmann
5b462ad76d Clipboard: Switch C-y and C-Y
First, this behavior now matches that of dmenu. People switching over
from dmenu might be used to this.

I would argue, though, that it is more comfortable in general anyway:

The "primary" selection is often easier to access, you can just select
some text and be done with it, no need to reach for C-c (or even C-S-c
in terminals). Some programs like XTerm can't even put text into the
"clipboard" selection without special configuration. It thus makes sense
to make this selection available with a hotkey that's easier to reach (I
find C-y to be much more comfortable than C-Y). Only in rare
circumstances do I need to access the "clipboard" selection.

In practice, this change is *probably* not a (very) breaking change for
users, because you very often have to select some text first using a
mouse (thus putting it into the "primary" selection) before you can put
it into the "clipboard" selection using something like C-c. This means
that pasting from "primary" almost acts as a "magic" hotkey that does
"the right thing".
2024-06-16 15:50:52 +09:00
Peter Hofmann
62154d8e7b Clipboard: Make both selections available and fix inconsistencies
Previously, C-y pasted the "primary" selection on X11 and the
"clipboard" selection on Wayland. That's inconsistent and confusing,
especially when you're switching back and forth between the two.

This commit does two things:

1.  It makes C-y always paste the "clipboard" selection.
2.  It adds a key bind C-Y to paste the "primary" selection.

I suspect that most bemenu users are on Wayland, so this commit tries to
not break things for them. It does, however, change the behavior on X11.
2024-06-16 15:50:52 +09:00
Julian Orth
6bcffe408c wayland: bind to zwlr_layer_shell_v1 version 3
zwlr_layer_shell_v1_destroy is not available in version 2 of the
interface.
2024-03-07 17:41:43 +09:00
Anskrevy
52b23d8fb5 Fix use after free in wayland.c 2024-02-17 14:24:11 +09:00
ldev
34259c5da7 removed workaround for bug and added extra case for XKB_KEY_ISO_Left_Tab 2024-02-08 11:13:54 +09:00
Anskrevy
a3f19bab9b Fix mouse press being ignored on x11 2024-02-05 12:52:51 +09:00
Jari Vetoniemi
d93acb0e84 Revert "wayland: force window->scale = 1, if BEMENU_SCALE"
This reverts commit aac7d73afc.
2024-02-02 21:04:56 +09:00
Jari Vetoniemi
aac7d73afc wayland: force window->scale = 1, if BEMENU_SCALE
BEMENU_SCALE is global override for whatever buffer scaling mechanism
there might be
2024-02-02 18:37:00 +09:00
Jari Vetoniemi
291d58a849 wayland: put fractional scaling behind env var
seems to fail on hyprland at least for now
2024-02-02 18:35:21 +09:00
Willow Barraco
877ca82cc1 Reapply "implement wayland fractional scaling"
This reverts commit 943d74600e.

This fix the BEMENU_SCALE that was left unused when fractionnal scale
support was detected.

This is rebased over origin/master.
2024-02-02 18:13:22 +09:00
Jari Vetoniemi
3156dac7d4 wayland: cairo/wl scale are different concepts
Sepearate BEMENU_SCALE from wayland's buffer scale
2024-02-02 17:22:01 +09:00
Jari Vetoniemi
826b8953ed wayland: unused parameter 2024-02-02 14:58:52 +09:00
Jari Vetoniemi
80d904c534 wayland: set buffer scale before everything else 2024-02-02 14:57:30 +09:00
Jari Vetoniemi
943d74600e Revert "implement wayland fractional scaling"
This reverts commit b1439df42c.
2024-02-02 14:40:40 +09:00
Jari Vetoniemi
36bb77b9ac wayland: use the correct scale render operates on 2024-02-02 14:35:33 +09:00
Jari Vetoniemi
af9fa0d105 wayland: remove unneccessary commit and roundtrip 2024-02-02 14:34:42 +09:00
Jari Vetoniemi
7a65abf52b x11: allow backend to be forced 2024-02-02 14:34:42 +09:00
Willow Barraco
b1439df42c implement wayland fractional scaling 2024-02-02 13:26:28 +09:00
Willow Barraco
b9efebde1d fix: buffer is not divisible by scale X
To prevent this, we move where we set the buffer scale just after where
we attach the new buffer to the surface. It should make sure the buffer
scale, and the attached buffer stay consistent on the first commit.
2024-02-01 10:16:08 +09:00
MithicSpirit
a2c0441861 feat: C-b to go left
This brings the keybinds more in line with readline/emacs-style
bindings. C-l to go left is preserved for backwards compatibility.
Notably, the curses backend already had C-b to go left, but did not
have C-l; it has not been changed.
2024-01-21 14:43:51 +09:00
Consolatis
d671226856 wayland: ensure bemenu is shown on top of fullscreen windows
Before this patch, wayland compositors that render fullscreen
windows between the top and overlay layers would show bemenu
behind an active fullscreen window. For other compositors
the z-rendering order was undefined.

This change ensures that bemenu will always be on top of other
usual windows (including fullscreen ones).

Fixes 
2023-12-16 14:50:12 +09:00
Lucas Merritt
b0751f7ddc Wayland support
Add necessary functions for Wayland upwards list mode to work.
2023-11-21 13:39:18 +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
Peter Hofmann
5b75b2c93a Fix fallback to xclip
popen() returns NULL if the underlying fork() or pipe() fails, not if
the called program didn't run properly. The old code didn't actually
fall back to xclip on X11, it was never called.

To fix this, inspect the exit code of the programs that we run. We use
the output of the first program that exited cleanly.

CC .
2023-11-21 13:36:53 +09:00
Willow Barraco
4ee128c086 chore: minor variable rewording 2023-11-21 13:34:57 +09:00
Willow Barraco
62657f8f28 fix: wayland mmap failed on Sway 1.8.1
Sway 1.8.1 does not trigger some event as surface.enter before we are
asked to render the first frame. This cause this first frame to be
rendered with wrong attributes.

This is solved with Sway master, precisely with commit:

> 7d2e4a51063ac90f950cb44f141ab391cbcaff5f
>
> layer-shell: enter output before surface is mapped
>
> This sends fractional-scale-v1 events before the first configure
> event. That way clients have all of the metadata they need to render
> the first frame.

To ensure we don't fails rendering the first frame, even if the
compositor does not provide metadata in a correct order, we initialize
the window structure with default values.
2023-11-21 13:34:04 +09:00
Willow Barraco
c22cc64bdb Wayland: fix monitor and scaling detection
The whole management of monitor_name with the Wayland backend seems heavily
broken, and doesn't allow to (1) select the target output with -m, and (2) to
correctly detect the used output and use correct attributes.

When used with two monitors with different scale values, depending on
the output order, you get a blurry menu.

To fix this we attach a listener to wayland surfaces to store which outputs
it belongs to. This rewrite almost completly the "recreate_windows"
function.

This also drop completly the xdg-output-unstable-v1 protocol, cause v4
already add the "name" event to fetch the output name.

I did not pushed this to support v6, with the new
"preferred_buffer_scale" event, cause anyway we need to fetch the
output max_height.
2023-11-05 17:29:20 +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
Jari Vetoniemi
45fee1488d filter: fix exact matching 2023-08-30 00:05:22 +09:00
ItsProfessional
c9b891e89b Add option to exit bemenu using esc in vim binds normal mode 2023-06-30 09:31:45 +09:00
Moyu Su
8e2fd06f70 fixed that respond of Escape while using Vim binding under Wayland 2023-03-13 21:57:18 +09:00
Willow
0c0107e8cb
Fix: select last entry if pointer/touch above last index ()
* Fix: select last entry if pointer/touch above last index

* Select first line if pointer/touch above title bar
2023-02-22 16:07:57 +09:00
Willow
f53310a961
Fix: invisible right border. () 2023-02-22 10:56:17 +09:00
Lucas Merritt
d9ac320dd0
Add fixed height option(Addresses ) ()
* added fixed height option && fixed counter
2023-02-18 18:30:55 +09:00
Lucas Merritt
77000a680c
Add Match/Page Counter(Addresses ) ()
* 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
a1374d487e fixed minor issues 2022-12-21 14:10:08 +09:00
Lucas Merritt
30379a88bf somewhat working, maybe fix background colors 2022-12-21 14:10:08 +09:00
Robert Günzler
778617e7c9 wayland: don't chomp dirty state when window is pending
Running `printf "foo\nbar\n" | bemenu --filter foo` no results would
show up until something set the dirty state (like interacting with the
keyboard, e.g. deleting a character).

This would only happen on wayland, due to the render implementation not
considering the dirty state when the window was not yet created and then
just overwriting `menu->dirty` with `false`.

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
a8c89c41a7 Fix remaining crashes 2022-10-21 03:17:29 +09:00
Luca Nimmrichter
75afebeb4b Remove debug logs 2022-10-21 03:17:29 +09:00
Luca Nimmrichter
197936e697 Add new bindings
H/M/L to goto first/mid/last item in view
X to delete character before the cursor
v to toggle item selection

Change goto first item from g to gg
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
dc24d795bb Fix escape close bemenu in vim normal mode 2022-10-21 03:17:29 +09:00