1 unstable release
new 0.1.0 | Mar 8, 2025 |
---|
#217 in Unix APIs
103 downloads per month
28KB
293 lines
rlauncher: a dmenu_run replacement focused on startup time
Unlike dmenu
, which is a mulipurpuse menu utility, rlauncher
is an all-in-one program launcher, with a focus on performance and minimising startup time.
Due to differences in command lookup logic, rlauncher
is only designed to work on unix-like systems.
Building
rlauncher
can be built with nix flakes or directly with cargo.
nix (strongly reccomended for NixOS users): nix build git+https://codeberg.org/binarycat/rlauncher
cargo: cargo install rlauncher
Invocation
rlauncher
accepts the following command-line flags:
-w
/--wrapper <WRAPPER_PROGRAM>
: specifies a command to use when launching programs.
When a program is launched, rlauncher
runs sh -c
with the argument
${WRAPPER_PROGRAM} '${selected_program}' & disown
.
rlauncher
does not accept positional arguments.
Usage
While the rlauncher
window is open, there are a few keys that have behviors beyond just text editing:
- Enter: run the selected command (you can also double-click it)
- Escape: close the window (this will suspend
rlauncher
) - F5: reload the list of programs in the background (useful if you have installed/uninstalled something, but note this is automatically done whenever a new window is opened)
Optimizations
There are two main strategies employed by rlauncher
to minimize its startup time.
Suspend/Resume
The most significant optimization it employs is, rather that exiting after launching a program, it instead hides its window and suspends itself with SIGSTOP
. Further invokations of rlauncher
will wake the existing instance with SIGCONT
instead of creating their own window. This behavior has the nice side effect of making rlaucher
mostly idempotent, preventing you from launching multiple instances of it.
rlauncher
uses a pidfile to coordinate this behavior. The pidfile's location can be exactly set using the $RLAUNCHER_PIDFILE
environment variable.
If $RLAUNCHER_PIDFILE
is not set, the path follows the form:
${dir}/rlauncher-${display}.pidfile
${dir}
is the first environment variable set in:
XDG_RUNTIME_DIR
TEMPDIR
TEMP
TMP
or /tmp
, if none are set.
${display}
is the first environment variable set in:
WAYLAND_DISPLAY
DISPLAY
For this reason, when using rlauncher
in a multi-user environment, you should make sure one of the following is true:
RLAUNCHER_PIDFILE
is set appropriately in.xinitrc
or your compositor config.XDG_RUNTIME_DIR
is properly set.- you use a per-user tempdir.
Lazy $PATH reading
$PATH
is iterated through in a background thread.
This significantly decreases startup latency if you have a complex $PATH
or a slow filesystem.
Dependencies
~13–50MB
~828K SLoC