Code Monkey home page Code Monkey logo

bemenu's Introduction

bemenu

Dynamic menu library and client program inspired by dmenu

preview

Releases

Releases are signed with 29317348D687B86B and published on GitHub.

Building

# Build everything
make

# To build only certain features, pass the targets which you are interested into
#
# You can also use the following meta-targets for common features:
# - clients (bemenu, bemenu-run)
# - x11
# - wayland
# - curses
#
# For example this would build the bemenu and bemenu-run binaries and the x11 backend:
make clients x11

# To install the built features, simply run:
make install

# NOTE: You may get errors during install when not building all the features.
#       These errors are free to ignore if `Install OK!` is printed.

# By default that will install to /usr/local, but you can change this with PREFIX
make install PREFIX=/usr

# Other usual variables are available for modifying such as DESTDIR, bindir, libdir and mandir
# Note that if you want a custom PREFIX or libdir, you should pass those during build as well,
# since they will be used compile-time to figure out where to load backends from!

# HTML API documentation (requires doxygen installed):
make doxygen

# To test from source, you have to point the LD_LIBRARY_PATH and BEMENU_RENDERERS variables:
LD_LIBRARY_PATH=. BEMENU_RENDERERS=. ./bemenu-run

OSX

Homebrew

# Make sure you have GNU Make and pkg-config installed
brew install make pkg-config

# You may need to setup your pkg-config to point to the brew version of the libraries
# For example to build curses backend, you'd do:
PKG_CONFIG_PATH="/usr/local/opt/ncurses/lib/pkgconfig" sh build-osx.sh curses

# Other than that, follow the normal build steps, but use `build-osx.sh` instead of make

Nix

There is default.nix provided in this repo, you can install bemenu with it by running

nix-env -i -f default.nix

This installs only the curses backend.

Dependencies

  • C compiler
  • scdoc to generate manpage

Backend-specific

All dependencies below are searched with pkg-config

Backend Dependencies
curses ncursesw
x11 x11, xinerama, cairo, pango, pangocairo
Wayland wayland-client, wayland-protocols, cairo, pango, pangocairo, xkbcommon

Currently, pasting from clipboard is done at runtime with wl-paste and xclip, attempted in that order.

Installing the dependencies

Ubuntu 20.04

sudo apt install scdoc wayland-protocols libcairo-dev libpango1.0-dev libxkbcommon-dev libwayland-dev

Environment variables

Variable Description Value
BEMENU_OPTS Options for bemenu, bemenu-run from env Any cli argument
BEMENU_BACKEND Force backend by name x11, wayland, curses
BEMENU_RENDERER Force backend by loading a .so file Path to the .so file
BEMENU_RENDERERS Override the backend search path Path to a directory
BEMENU_SCALE Override the rendering scale factor Float value

About Wayland support

Wayland is only supported by compositors that implement the wlr-layer-shell protocol. Typically wlroots-based compositors.

Keybindings

Default Bindings

Key Binding
Left Arrow Move cursor left
Right Arrow Move cursor right
Up Arrow Move to previous item
Down Arrow Move to next item
Shift + Left Arrow Select previous item
Shift + Right Arrow Select next item
Shift + Alt + < Select first item in actual list
Shift + Alt + > Select last item in actual list
Shift + Page Up Select first item in actual list
Shift + Page Down Select last item in actual list
Page Up Select first item in displayed list
Page Down Select last item in displayed list
Tab Move to next item
Shift + Tab Select item and place it in filter
Esc Exit bemenu
Insert Return filter text or selected items if multi selection
Shift + Return Return filter text or selected items if multi selection
Return Execute selected item
Home Curses cursor set to 0
End Cursor set to end of filter text
Backspace Delete character at cursor
Delete Delete character at cursor
Delete Left Delete text before cursor
Delete Right Delete text after cursor
Word Delete Delete all text in filter
Alt + v Select last item in displayed list
Alt + j Select next item
Alt + d Select last item in display list
Alt + l Select previous item
Alt + f Select next item
Alt + 0-9 Execute selected item with custom exit code
Ctrl + Return Select item but don't quit to select multiple items
Ctrl + g Exit bemenu
Ctrl + n Select next item
Ctrl + p Select previous item
Ctrl + a Move cursor to beginning of text in filter
Ctrl + e Move cursor to end of text in filter
Ctrl + h Delete character at cursor
Ctrl + u Kill text behind cursor
Ctrl + k Kill text after cursor
Ctrl + w Kill all text in filter
Ctrl + m Execute selected item
Ctrl + y Paste clipboard

Vim Bindings

Vim bindings can be activated via the --binding vim option. All bindings are in vim normal mode. When bemenu is started with vim bindings it will be in insert mode. By pressing escape, normal mode can be activated.

Note: The default bindings can still be used for actions that do not have a separate vim binding such as launching a program or pasting.

Key Binding
j/n Goto next item
k/p Goto previous item
h Move cursor left
l Move cursor right
q Quit bemenu
v Toggle item selection
i Enter insert mode
I Move to line start and enter insert mode
a Move to the right and enter insert mode
A Move to line end and enter insert mode
w Move a word
b Move a word backwards
e Move to end of word
x Delete a character
X Delete a character before the cursor
0 Move to line start
$ Move to line end
gg Goto first item
G Goto last item
H Goto first item in view
M Goto middle item in view
L Goto last item in view
F Scroll one page of items down
B Scroll one page of items up
dd Delete the whole line
dw Delete a word
db Delete a word backwards
d0 Delete to start of line
d$ Delete to end of line
cc Change the whole line
cw Change a word
cb Change a word backwards
c0 Change to start of line
c$ Change to end of line

Projects using bemenu

License

bemenu's People

Contributors

ammen99 avatar barbaross93 avatar cloudef avatar dadav avatar ddevault avatar earnestly avatar escondida avatar gesellkammer avatar joanbm avatar khardix avatar llunacb avatar mahkoh avatar martinetd avatar merrittlj avatar mxkrsv avatar nimmidev avatar nmeum avatar petercolberg avatar quite avatar raring-coffee20 avatar reidevries avatar richardkraus avatar robertgzr avatar siiptuo avatar stacyharper avatar t-8ch avatar tardypad avatar upwhere avatar v44r avatar vain avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bemenu's Issues

Search for libncursesw on Debian/Ubuntu

I had to pass -DCURSES_LIBRARY=/lib/x86_64-linux-gnu/libncursesw.so.5 to cmake when building bemenu on Ubuntu 16.04 (64-bit).

Otherwise, I get this error:

bemenu-run
/usr/lib/bemenu/bemenu-renderer-curses.so: undefined symbol: get_wch

Blurry font rendering while using HiDPI scaling on wayland

I have issues with the bemenu font rendering when HiDPI scaling (factor 2) is used on wayland. I'm using sway (version 1.0-beta.2-270-g1a1133dc) and bemenu (r262.799d8b9-1 according to the package version I installed from git) on Archlinux.
I also tried to set the backend specifically to wayland using the BEMENU_BACKEND env variable and using different ttf fonts and sizes. But with no success. The font appears very blurry in comparison to other applications.

Open in terminal option

Hello, not sure if I'm just missing an option somewhere but would it be possible to add an 'open in terminal' option for command line applications?

In other launchers, usually you can hold [shift] while pressing [enter] and it will launch the selected application in a terminal window.

Currently I have to run alacritty -e ranger to launch a ranger window. Issuing ranger alone will not launch it.

bemenu fails to run on wlroots 0.8.1

bemenu works on wlroots 0.6 and doesn't do anything on wlroots 0.8.1. wlroots 0.7 and 0.8 are untested.

When run from the console the binary launches but does nothing. e.g. echo "foo" | bemenu on x11 will show something like

bemenu             foo

at the top of your screen. However on wlroots 0.8.1 nothing happens.

Since there isn't any output I'm not sure how helpful this bug report is, but at least you know about it now. Can I compile with debug messages enabled or something?

Wayland renderer is disabled by default (enable by -DBEMENU_WAYLAND_RENDERER=ON)

bemenu worked fine until yesterday, but suddenly doesn't do anything anymore.

$ ls | bemenu

$

I cannot find any debug option in the bemenu manpages, so I have no idea what's happening and how to fix the issue.

$ bemenu --version                                           โ”‚
bemenu v0.3.0 
$ pacman -Qs bemenu
local/bemenu 0.3.0-1
    Dynamic menu library and client program inspired by dmenu
    with support for wayland compositors

Running arch linux and sway 1:1.2-5 (wayland).

Any idea why this is happening?

bemenu isn't visible when another application is fullscreen

versions:

  • OS: Arch linux
  • sway 1:1.2-5
  • bemenu-git r303.98f7c80-1

Expected behavior: Triggering bemenu while another app is fullscreen should display bemenu on top of the full-screen application

Current behavior: bemenu is shown behind the fullscreen application.

In web dev, it would be a matter of bumping the css z-index property. In wayland/X11, no idea ^^

Note: the manpage mentionned an -n parameter (--no-overlap) for wayland, but using it still doesn't show bemenu while another app is fullscreen

The ability to paste in X11 and Wayland mode is missing.

It's possible to paste in the curses backend thanks to the terminal emulator via either shift-insert or its pasting mechanism but this functionality is not yet available in X11 or Wayland mode.

For comparison, dmenu uses C-y for pasting from X11's primary selection buffer.

Make bemenu-run async

Since we don't do any caching in bemenu-run (by choice), on slow disks and on first startup loading binaries from $PATH may be slow. If we do this on background and fill the list chunk by chunk it might be nicer. Chck's thread pool is useful here.

Transparency

Hi and thanks a lot for bemenu!

I was wondering if there's a way to specify an alpha value in bemenu's colors.

For example: bemenu --nb '#09abac5a' where the last two characters would make the background transparent.

RFE: Option for dmenu-like indent items in list mode

In dmenu -l, the items have a hanging indent that is as wide as the prompt or 'title':

2019-11-25 091311 frost

In bemenu -l, they don't, and everything just looks slighly weird when it's glued to the screen edge:

2019-11-25 091602 frost

(The --prefix option doesn't quite do the job; it just indents the text and not the background fill, and getting it to be exactly the right width can get annoying.)

bemenu isn't capable of detecting the bottom edge of the screen in list mode.

If you use a high number via -l then bemenu will render entires beyond the edge of the screen.

It would be nice if it could somehow detect the bottom and page instead. This might be related to your proposal for using -l 0 which would do the same thing and is generally what using a high number is intending to achieve.

wl_seat erro

wl_registry@2: error 0: invalid version for global wl_seat (5): have 4, wanted 5

This line ???
wayland->seat = wl_registry_bind(registry, id, &wl_seat_interface, XDG_SHELL_VERSION_CURRENT);
In weston client version is always 1 o 4

Key repetition for selection.

Currently key repetition isn't used when scrolling through the items using any of the navigation keys such as Up or Down.

selecting multiple inputs

There are two discrepancies between bemenu and dmenu. When selecting multiple entries with C-RET,

  1. in dmenu, you print the selection with S-RET, whereas in bemenu S-RET is the same as ESC. Additionally, C-[ doesn't behave as ESC.
  2. in bemenu, hitting RET will print both the selected entries and and the highlighted entry whether or not the highlighted entry was selected. dmenu will only launch selected entries with S-RET, and only the highlighted entry with RET whether or not there are selected entries.

The former amounts to trivial changes, but consistency would be nice. The latter I find to be unexpected, being a dmenu user. I like that in dmenu, even if I were to select a bunch of entries, I still have the choice to launch only the one highlighted entry, or all the selected ones.

display previous commands at the top of the menu

Similar to rofi, it would be nice if launching something, such as firefox, from bemenu meant that on next launch it would be above commands you've never ran, and that the most frequently-ran thing was at the top. This is really handy if you've ran a long specific command that you'll want to run again later. Also just keeping a history in general so you can filter to old commands would be nice.

bemenu hidden behind way-bar on sway launch

Immediately after launching sway, if bemenu is launched using a hotkey, it will be hidden behind waybar. It will only appear once another window is opened or if the desktop is clicked.

Note, I have waybar and bemenu attached to the bottom of the screen.

This behavior seems to only occur after first boot. Exiting the sway session and starting it again does not result in this behavior. Similarly, logging out and logging in again does not result in this behavior.

Bad font choice

Hello there. I got a problem from 24h now. The bemenu seems to use a bad font. I don't have very much knowledge on this kind of things.

Here's a screenshot
bemenu font problem

I'm on voidlinux, up to date. I don't think I installed something recently. Maybe this is an update issue from another package. Dunno

Scrolling with M-d and M-u doesn't wrap.

The -w causes M-j and M-k to correctly wrap but this don't seem to function when using M-d and M-u.

Once the bottom of the list is reached with M-d the next usage won't wrap to the beginning.

Support for desktop files

Some applications, such as the ones provided trough flatpak, typically only come with .desktop files as a way to be launched.

I am not entirely sure how to handle this (if you look for an app and there are two versions: one with a desktop file and one without, what should you display?), but displaying them at the end would be a start.

https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html

$XDG_DATA_DIRS is the $PATH equivalent. dex can be used to launch .desktop files.

error while loading shared libraries: libbemenu.so.0

I built this on Fedora 30, the build goes without problem, but when I run bemenu I get the error:

error while loading shared libraries: libbemenu.so.0: cannot open shared object file: No such file or directory
Any advice is appreciated.

Set Class for X Backend

It looks like the wayland backend sets the classname, but I don't think the X backend sets any window properties. I think it would be nice to have at least the classname set mainly because I'd like to be able to have bemenu excluded for shadows with compton.

Undefined symbol errors after #52

Build works fine but when trying to launch bemenu, it errors out for me with "undefined symbol" from pango for the x11 backend and wl_surface_interface for the wayland backend.

I'm using gentoo linux.

If I roll back to before #52, it launches and works as expected after building

Display of selected item lags behind

I use bemenu (bemenu-git from AUR) with sway using the wayland backend and open it using mod+d. When trying to launch for example "playonlinux" the sequence is as follows:

Key Pressed - Displayed Value - Displayed list
p - (NULL) - (everything)
pl - p - p11-kt, p11tool....
pla - pl - pl2pm, play, playonlinux
play - pla - play, playonlinux
playo - play - play, playonlinux

Now when I hit enter "playonlinux" is run although "play" is marked as the active entry. So it seems only the display lags behind by one while intenally everything is correct.

Refined zsh-like tab completion.

Instead of tab completing the first entire match it would complete only the
matching portion; for example:

The user opens bemenu and types 'bemenu' before pressing tab.
+------------------+----------------------------------+
| bemenu-<tab>     | bemenu-run bemenu-pdf bemenu-mpc |
+------------------+----------------------------------+

Currently what would happen is the first match will complete in full, e.g.
+------------------+----------------------------------+
| bemenu-run       | bemenu-run                       |
+------------------+----------------------------------+

Instead, what I am proprosing is that when <tab> is pressed it will match the
first unique prefix:
+------------------+----------------------------------+
| bemenu-          | bemenu-run bemenu-pdf bemenu-mpc |
+------------------+----------------------------------+

With this method of completion, it is still possible to press <Return> to
select the first match, but it would make typing out the other choices much
easier.

For example, if it completed to bemenu-run I would then have to backspace
run before I can type mpc.

With the new completion mechanism I can type bemen, press <Tab>, which
results in bemenu- which has prepared the input nicely for the next thing I'd
like to type, e.g. m or p which would then complete to bemenu-mpc or
bemenu-pdf respective on a subsequent <Tab>.

Do not wait for initial wayland events when starting up

I have tried running bemenu on Wayfire (a wlroots based compositor which supports layer-shell). However the bemenu-run didn't do anything visible. After a bit of debugging, I think I found the reason: the wayland backend waits for a wayland event before drawing the first frame. In some compositors though no such event will happen before the surface is mapped. Thus I think something along the lines should be implemented:

diff --git a/lib/renderers/wayland/wayland.c b/lib/renderers/wayland/wayland.c
index dd97009..8c18b62 100644
--- a/lib/renderers/wayland/wayland.c
+++ b/lib/renderers/wayland/wayland.c
@@ -13,6 +13,7 @@
 #include <sys/timerfd.h>
 
 static int efd;
+static int firstLoop = 1;
 
 static void
 render(const struct bm_menu *menu)
@@ -26,6 +27,16 @@ render(const struct bm_menu *menu)
     }
 
     struct epoll_event ep[16];
+    if (firstLoop)
+    {
+        struct window *window;
+        wl_list_for_each(window, &wayland->windows, link) {
+            bm_wl_window_render(window, wayland->display, menu);
+        }
+        firstLoop = 0;
+        return;
+    }
+
     uint32_t num = epoll_wait(efd, ep, 16, -1);
     for (uint32_t i = 0; i < num; ++i) {
         if (ep[i].data.ptr == &wayland->fds.display) {

This is of course just a hack, I am not familiar with the codebase enough to write a proper solution.

Configuration file

Add configuration file and move colors to there from the command line. Maybe some other options too that make sense. Add command line option for choosing different configuration file than default.

Key repeat doesn't work with Wayland

I am using Sway and I have tried the latest Github version and the release of bemenu.

Some comments mention that this has worked before, so I was looking for the commit that broke it, but I couldn't find a good commit to begin with.

Signing with a new GPG key?

Thanks as always for your work on this, Cloudef!

The signature file for 0.2.0 seems to be done with key 0x0CBD2CD395613887, whereas previously it was 0xF769BB961AF6D26A. Before I build this update for Arch, can you confirm your new key with your old one (and send it to keyservers) and/or link to some canonical spot on your own site where it can be found?

Add noecho/asterisks for credentials input

It would be pretty cool to have an option that turns bemenu into something suitable for entering credentials, be it by displaying nothing (like, sudo) or by displaying asterisks (like, browsers) or other glyphs (like, Emacs).

Currently a workaround would be to set the foreground color to the same value as the background color, but that's a pretty hacky way of doing it.

Missing manual page

There is no manual page for bemenu. Ideally, a manual page should be included for every executable and configuration files so that the user can get the information needed to use or configure the application quickly.

Use chck

Possible to remove lots of code and have more reliable codebase.

bemenu causing sway to crash on empty workspace

Not sure if I should raise this issue here or with sway.
When I try to launch a program via bemenu in an empty workspace sway (git) crashes. If there is another window already opened it works fine. Sway exits back to console with a segfault. I tried enabling sway debug but could not find any error.
It used to work fine about a week or two ago (I can try to find the exact commit which started this).
I am using the wayland backend.

bemenu does not show until I force sway to refresh display

On my side, when running bemenu on Sway, no menu is shown, and the terminal from which I ran it keeps the focus.
I've long thought it was something I misconfigured with respect to Wayland backend, but I recently noticed that forcing Sway to refresh display (using swaymsg reload, or using Ctrl+Alt+Fn to switch back-and-forth between TTY and Sway), while bemenuis running, gets the menu to be correctly shown.
I don't know whether the issue is on Sway or bemenu side, but I am opening this issue to collect your opinion on what could possibly be happening that causes this behaviour, and if there's any way I can get useful debug logs to push the investigation further.

Allow specifying height

--height <height> Sets the height of the bar. Default height (0) will match the font size.

Reason for this would be matching the height of sway-bar, for us OCD people out there. :)

Screenshot on README.md?

Might be useful to put a screenshot of bemenu in README.md to show users what the program looks like.

[Wanted] - Documentaion/build from source instruction

Hello, I am running bemenu through the default pacman package, and I have found that there is no man pages related to the project, and some information on how the program can be installed from source.

I have tried running:

cmake .
make
sudo make install

Which results in the error:

bash: /usr/bin/bemenu-run: no such file or directory

Any information on how I can get started with this would be awesome. Thank you for your time.

Running from source fails silently

I'm trying to build and run bemenu from source on Wayland. Building with cmake -DBEMENU_WAYLAND_RENDERER=ON .. works fine, but running it with dmenu_path | client/bemenu just has it exit (echo $? == 1) with no output. I tried using gdb and found that bm_init() fails at lib/library.c:137. Using 0.1.0 straight from the Arch repositories works fine.

If I were more fluent in C, I'd try to debug further, but this is the extent of my abilities.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.