spmenu/spmenu.1

561 lines
15 KiB
Groff
Raw Normal View History

2023-03-25 18:48:45 +01:00
.\" Automatically generated by Pandoc 3.1
2023-02-26 15:37:09 +01:00
.\"
.\" Define V font for inline verbatim, using C font in formats
.\" that render this, and otherwise B font.
.ie "\f[CB]x\f[]"x" \{\
. ftr V B
. ftr VI BI
. ftr VB B
. ftr VBI BI
.\}
.el \{\
. ftr V CR
. ftr VI CI
. ftr VB CB
. ftr VBI CBI
.\}
2023-03-25 18:48:45 +01:00
.TH "spmenu" "1" "" "0.3.2" "dynamic menu"
2023-02-26 15:37:09 +01:00
.hy
.SH spmenu
2023-03-20 14:03:18 +01:00
.SH What is spmenu?
2023-02-26 15:37:09 +01:00
.PP
spmenu is a program for X11 that reads standard input and allows the
user to select items separated by a newline.
It is a fork of suckless\[cq]s dmenu which is a good more minimal
alternative to spmenu.
.PP
Unlike dmenu and the many builds out there, spmenu has features like
color support, Vim-like modes, image support, proper keybind
configuration, and more.
.PP
Most of these features can be disabled during compile time by editing
\f[V]toggle.mk\f[R].
2023-03-20 14:03:18 +01:00
.SH Usage
2023-02-26 15:37:09 +01:00
.PP
On runtime, spmenu reads from standard input (stdin).
spmenu items are separated by a newline (\f[V]\[rs]n\f[R]).
When (by default) Enter is pressed, the selected item will be piped to
stdout.
.PP
This allows things like
\f[V]printf \[dq]Apple\[rs]nOrange\[rs]nPear\[rs]n\[dq] | spmenu\f[R].
This command will spawn an spmenu window with three items, `Apple',
`Orange' and `Pear'.
This can be used in shell scripts to create interactive menus.
.PP
On top of this, you can specify arguments to change the behavior of
spmenu.
See a list below for a list.
2023-03-20 14:03:18 +01:00
.SH Arguments
.PP
2023-03-20 16:00:50 +01:00
You may use long, descriptive arguments or the shorter arguments.
.TP
\f[V]-mh, --lineheight height\f[R]
Set spmenu line height to height
.TP
\f[V]-mw, --min-width width\f[R]
Set minimum width to width
.TP
\f[V]-g, --columns grid\f[R]
Set the number of grids to grid
.TP
\f[V]-gc, --generate-cache\f[R]
Generate image cache
.TP
\f[V]-ngc, --no-generate-cache\f[R]
Don\[cq]t generate image cache
.TP
2023-03-21 21:52:14 +01:00
\f[V]-mc, --max-cache size\f[R]
Set max image cache size to size
.TP
2023-03-20 16:00:50 +01:00
\f[V]-rw, --relative-width\f[R]
Enable relative input width
.TP
\f[V]-nrw, --no-relative-width\f[R]
Disable relative input width
.TP
\f[V]-f, --fast\f[R]
Grabs keyboard before reading stdin
.TP
\f[V]-F, --fuzzy\f[R]
Enable fuzzy matching
.TP
\f[V]-NF, --no-fuzzy\f[R]
Disable fuzzy matching
.TP
\f[V]-P, --password\f[R]
Hide characters
.TP
\f[V]-Ps, --password-symbol symbol\f[R]
Set the password symbol to symbol
.TP
\f[V]-p, --prompt text\f[R]
Set spmenu prompt text to text
.TP
\f[V]-ip, --indent\f[R]
Indent items to prompt width
.TP
\f[V]-nip, --no-indent\f[R]
Don\[cq]t indent items to prompt width
.TP
\f[V]-a, --alpha\f[R]
Enable alpha
.TP
\f[V]-na, --no-alpha\f[R]
Disable alpha
.TP
\f[V]-tp, --allow-typing\f[R]
Allow the user to type
.TP
\f[V]-nt, --no-allow-typing\f[R]
Don\[cq]t allow typing, the user must select an option
.TP
\f[V]-x, --x-position x offset\f[R]
Offset spmenu x position by x offset
.TP
\f[V]-y, --y-position y offset\f[R]
Offset spmenu y position by y offset
.TP
\f[V]-n, --preselect line\f[R]
Preselect line in the list of items
.TP
\f[V]-z, --width width\f[R]
Width of the spmenu window
.TP
\f[V]-nmt, --normal-mode-text text\f[R]
Set normal mode text to text
.TP
\f[V]-imt, --insert-mode-text text\f[R]
Set insert mode text to text
.TP
\f[V]-bw, --border-width width\f[R]
Set width of the border to width .
2023-02-26 15:37:09 +01:00
0 will disable the border
2023-03-20 16:00:50 +01:00
.TP
\f[V]-so, --sort\f[R]
Sort matches
.TP
\f[V]-nso, --no-sort\f[R]
Don\[cq]t sort matches
.TP
\f[V]-pri, --priority pri1,pri2,pri3\f[R]
Specify a list of items that take priority
.TP
\f[V]-s, --case-sensitive\f[R]
Use case-sensitive matching
.TP
\f[V]-ns, --case-insensitive\f[R]
Use case-insensitive matching
.TP
\f[V]-nm, --normal\f[R]
Start spmenu in normal mode
.TP
\f[V]-im, --insert\f[R]
Start spmenu in insert mode
.TP
\f[V]-t, --top\f[R]
Position spmenu at the top of the screen
.TP
\f[V]-b, --bottom\f[R]
Position spmenu at the bottom of the screen
.TP
\f[V]-c, --center\f[R]
Position spmenu at the center of the screen
.TP
\f[V]-hm, --hide-mode\f[R]
Hide mode indicator
.TP
\f[V]-hmc, --hide-match-count\f[R]
Hide match count
.TP
\f[V]-hla, --hide-left-arrow\f[R]
Hide left arrow
.TP
\f[V]-hra, --hide-right-arrow\f[R]
Hide right arrow
.TP
\f[V]-hpr, --hide-prompt\f[R]
Hide prompt
.TP
2023-03-21 21:52:14 +01:00
\f[V]-hpl, --hide-powerline\f[R]
Hide powerline
.TP
2023-03-20 16:00:50 +01:00
\f[V]-hc, --hide-cursor\f[R]
Hide cursor
.TP
\f[V]-hhl, --hide-highlighting\f[R]
Hide highlight
.TP
\f[V]-hi, --hide-image\f[R]
Hide image
.TP
\f[V]-sm, --show-mode\f[R]
Show mode indicator
.TP
\f[V]-smc, --show-match-count\f[R]
Show match count
.TP
\f[V]-sla, --show-left-arrow\f[R]
Show left arrow
.TP
\f[V]-sra, --show-right-arrow\f[R]
Show right arrow
.TP
\f[V]-spr, --show-prompt\f[R]
Show prompt
.TP
2023-03-21 21:52:14 +01:00
\f[V]-spl, --show-powerline\f[R]
Show powerline
.TP
2023-03-20 16:00:50 +01:00
\f[V]-sc, --show-cursor\f[R]
Show cursor
.TP
\f[V]-shl, --show-highlighting\f[R]
Show highlight
.TP
\f[V]-si, --show-image\f[R]
Show image
.TP
\f[V]-xrdb, --xrdb\f[R]
Load .Xresources on runtime
.TP
\f[V]-nxrdb, --no-xrdb\f[R]
Don\[cq]t load .Xresources on runtime
.TP
\f[V]-m, --monitor monitor\f[R]
Specify a monitor to run spmenu on
.TP
\f[V]-w, --embed window id\f[R]
Embed spmenu inside window id
.TP
\f[V]-H, --hist-file hist file\f[R]
Specify a path to save the history to
.TP
\f[V]-ig, --image-gaps gaps\f[R]
Set image gaps to gaps
.TP
\f[V]-lp, --vertical-padding padding\f[R]
Set the vertical padding
.TP
\f[V]-hp, --horizontal-padding padding\f[R]
Set the horizontal padding
.TP
\f[V]-la, --left-arrow-symbol symbol\f[R]
Set the left arrow to symbol
.TP
\f[V]-ra, --right-arrow-symbol symbol\f[R]
Set the right arrow to symbol
.TP
\f[V]-is, --image-size size\f[R]
Image size
.TP
\f[V]-it, --image-top\f[R]
Position the image at the top
.TP
\f[V]-ib, --image-bottom\f[R]
Position the image at the bottom
.TP
\f[V]-ic, --image-center\f[R]
Position the image in the center
.TP
\f[V]-itc, --image-topcenter\f[R]
Position the image in the top center
.TP
\f[V]-wm, --managed, --x11-client\f[R]
Spawn spmenu as a window manager controlled client/window.
Useful for testing
2023-03-20 16:00:50 +01:00
.TP
\f[V]-nwm, --unmanaged\f[R]
Don\[cq]t spawn spmenu as a window manager controlled client/window.
Useful for testing
2023-03-20 16:00:50 +01:00
.TP
\f[V]-lcfg, --load-config\f[R]
Load spmenu configuration (\[ti]/.spmenu or
\[ti]/.config/spmenu/spmenurc)
.TP
\f[V]-ncfg, --no-load-config\f[R]
Don\[cq]t load spmenu configuration (\[ti]/.spmenu or
\[ti]/.config/spmenu/spmenurc)
.TP
\f[V]-v, --version\f[R]
Print spmenu version to stdout
.TP
\f[V]-fn, --font font\f[R]
Set the spmenu font to font
.TP
\f[V]-nif, --normal-item-foreground color\f[R]
Set the normal item foreground color
.TP
\f[V]-nib, --normal-item-background color\f[R]
Set the normal item background color
.TP
\f[V]-sif, --selected-item-foreground color\f[R]
Set the selected item foreground color
.TP
\f[V]-sib, --selected-item-background color\f[R]
Set the selected item background color
.TP
\f[V]-npf, --normal-item-priority-foreground color\f[R]
Set the normal item (high priority) foreground color
.TP
\f[V]-npb, --normal-item-priority-background color\f[R]
Set the normal item (high priority) background color
.TP
\f[V]-spf, --selected-item-priority-foreground color\f[R]
Set the selected item (high priority) foreground color
.TP
\f[V]-spb, --selected-item-priority-background color\f[R]
Set the selected item (high priority) background color
.TP
\f[V]-pfg, --prompt-foreground color\f[R]
Set the prompt foreground color
.TP
\f[V]-pbg, --prompt-background color\f[R]
Set the prompt background color
.TP
\f[V]-ifg, --input-foreground color\f[R]
Set input foreground color
.TP
\f[V]-ibg, --input-background color\f[R]
Set input background color
.TP
\f[V]-mnbg, --menu-background color\f[R]
Set the menu background color
.TP
\f[V]-nhf, --normal-highlight-foreground color\f[R]
Set the normal highlight foreground color
.TP
\f[V]-nhb, --normal-highlight-background color\f[R]
Set the normal highlight background color
.TP
\f[V]-shf, --selected-highlight-foreground color\f[R]
Set the selected highlight foreground color
.TP
\f[V]-shb, --selected-highlight-background color\f[R]
Set the selected highlight background color
.TP
\f[V]-nfg, --number-foreground color\f[R]
Set the foreground color for the match count
.TP
\f[V]-nbg, --number-background color\f[R]
Set the background color for the match count
.TP
\f[V]-mfg, --mode-foreground color\f[R]
Set the foreground color for the mode indicator
.TP
\f[V]-mbg, --mode-background color\f[R]
Set the background color for the mode indicator
.TP
\f[V]-laf, --left-arrow-foreground color\f[R]
Set the left arrow foreground color
.TP
\f[V]-raf, --right-arrow-foreground color\f[R]
Set the right arrow foreground color
.TP
\f[V]-lab, --left-arrow-background color\f[R]
Set the left arrow background color
.TP
\f[V]-rab, --right-arrow-background color\f[R]
Set the right arrow background color
.TP
\f[V]-cc, --caret-foreground color\f[R]
Set the caret color
.TP
\f[V]-bc, --border-background color\f[R]
Set the border color
.TP
\f[V]-sgr0, --sgr0 color\f[R]
Set the SGR 0 color
.TP
\f[V]-sgr1, --sgr1 color\f[R]
Set the SGR 1 color
.TP
\f[V]-sgr2, --sgr2 color\f[R]
Set the SGR 2 color
.TP
\f[V]-sgr3, --sgr3 color\f[R]
Set the SGR 3 color
.TP
\f[V]-sgr4, --sgr4 color\f[R]
Set the SGR 4 color
.TP
\f[V]-sgr5, --sgr5 color\f[R]
Set the SGR 5 color
.TP
\f[V]-sgr6, --sgr6 color\f[R]
Set the SGR 6 color
.TP
\f[V]-sgr7, --sgr7 color\f[R]
Set the SGR 7 color
.TP
\f[V]-sgr8, --sgr8 color\f[R]
Set the SGR 8 color
.TP
\f[V]-sgr9, --sgr9 color\f[R]
Set the SGR 9 color
.TP
\f[V]-sgr10, --sgr10 color\f[R]
Set the SGR 10 color
.TP
\f[V]-sgr11, --sgr11 color\f[R]
Set the SGR 11 color
.TP
\f[V]-sgr12, --sgr12 color\f[R]
Set the SGR 12 color
.TP
\f[V]-sgr13, --sgr13 color\f[R]
Set the SGR 13 color
.TP
\f[V]-sgr14, --sgr14 color\f[R]
Set the SGR 14 color
.TP
\f[V]-sgr15, --sgr15 color\f[R]
Set the SGR 15 color
.PP
2023-03-20 16:00:50 +01:00
dmenu compatibility can be achieved using these arguments:
.TP
\f[V]-S\f[R]
Don\[cq]t sort matches
.TP
\f[V]-i\f[R]
Use case-insensitive matching
.TP
\f[V]-nb color\f[R]
Set the normal background color
.TP
\f[V]-nf color\f[R]
Set the normal foreground color
.TP
\f[V]-sb color\f[R]
Set the selected background color
.TP
\f[V]-sf color\f[R]
2023-03-20 16:00:50 +01:00
Set the selected foreground color
2023-03-20 14:03:18 +01:00
.SH Keybinds
2023-02-26 15:37:09 +01:00
.PP
See \f[V]keybinds.h\f[R] for a list.
2023-03-20 14:03:18 +01:00
.SH Modes
2023-02-26 15:37:09 +01:00
.PP
One of the features that separate spmenu from dmenu is spmenu\[cq]s
different modes.
As of version 0.2, there are two modes.
Normal mode and Insert mode.
These modes are of course similar to Vim.
.PP
Normal mode is the mode spmenu starts in unless a mode argument is
specified.
In normal mode, all keys perform some action, but you cannot type any
actual text to filter items.
This mode is used for navigation, as well as quickly selecting an item.
.PP
Insert mode is entered through (by default) pressing \f[V]i\f[R] in
normal mode.
In this mode, most keybinds do nothing.
When you are in insert mode, you filter items by typing text into the
field.
Once you\[cq]re done with insert mode, you can press Escape to enter
normal mode again.
2023-03-20 14:03:18 +01:00
.SH -p option
2023-02-26 15:37:09 +01:00
.PP
spmenu has a -p option, which stands for prompt.
It allows you to specify text to display next to the item list.
It is displayed on the left side of the spmenu window.
It should be noted that the prompt is purely visual though.
2023-03-20 14:03:18 +01:00
.SH Images
2023-02-26 15:37:09 +01:00
.PP
spmenu supports drawing images.
This image is placed on the left side of the menu window.
To use an image, pipe \f[V]IMG:/path/to/image\f[R] to spmenu.
If you want you can specify arguments like usual.
Note that you should add a Tab (\f[V]\[rs]t\f[R]) character after the
path to the image file.
Otherwise the text after will be interpreted as part of the filename and
the image will not be drawn.
.PP
Any text after the Tab character will be interpreted as a regular item.
In practice, drawing an image might look like this:
.PP
\f[V]printf \[dq]IMG:/path/to/image\[rs]tLook at that image, isn\[aq]t it awesome?\[rs]n\[dq] | spmenu\f[R]
2023-02-26 15:37:09 +01:00
.PP
There are also a few image related arguments, such as:
.PP
\f[V]-is\f[R], \f[V]-ig\f[R], \f[V]-it\f[R], \f[V]-ib\f[R],
\f[V]-ic\f[R], \f[V]-itc\f[R] and \f[V]-gc\f[R].
.PP
NOTE: Vector images (such as .svg) can be displayed too.
2023-03-20 14:03:18 +01:00
.SH Colored text
2023-02-26 15:37:09 +01:00
.PP
spmenu supports colored text through SGR sequences.
This is the same colors that you might already be using in your shell
scripts.
This means you can pipe practically any colored shell script straight
into spmenu, no need to filter the output or anything.
.PP
2023-03-14 21:31:24 +01:00
For 256 color support to work, you must add to the array.
See \f[V]libs/color.h\f[R] if you want this.
.PP
See `SGR sequences' for more information.
2023-03-20 14:03:18 +01:00
.SH SGR sequences
2023-03-14 21:31:24 +01:00
.PP
A basic supported SGR sequence looks like this: \f[V]\[rs]033[X;YZm\f[R]
.PP
Here, X specifies if you want normal or bright colors.
Y specifies if you want background or foreground.
Z specifies the color number.
.PP
Foreground colors: \f[V]30\f[R] through \f[V]37\f[R] Background colors:
\f[V]40\f[R] through \f[V]47\f[R] Reset: \f[V]0\f[R]
.PP
NOTE: \f[V];\f[R] is a separator, and in this example it separates the
color number and normal/bright.
\[rs]033 may also be written as \f[V]\[ha]]\f[R] or simply
\f[V]ESC\f[R].
.PP
spmenu supports most color sequences, although not true color by default
(unless -sgr arguments are used).
.PP
There are a few arguments, you can override SGR colors on-the-fly using
the \f[V]-sgrX\f[R] arguments.
See `Arguments' for more information.
2023-03-20 14:03:18 +01:00
.SH Configuration
2023-03-14 21:31:24 +01:00
.PP
spmenu has .Xresources (xrdb) support built in.
It reads the xrdb (.Xresources database) on runtime.
You may disable it by passing -nxrdb, or enable it by padding -xrdb.
.PP
spmenu loads \f[V]\[ti]/.config/spmenu/spmenurc\f[R] or alternatively if
you\[cq]re old fashioned, \f[V]\[ti]/.spmenurc\f[R].
This requires that \f[V]xrdb\f[R] is available on your operating system.
.PP
You can also use wildcards (such as \f[V]*\f[R]) to achieve a global
colorscheme.
Programs like \f[V]pywal\f[R] do this to apply universal colorschemes.
.SH Run launcher
.PP
spmenu includes a shell script called spmenu_run.
It lists executable programs in $PATH and displays them to the user in a
list.
Not only that but it shows recently run programs first in the list.
.PP
spmenu_run will interpret any arguments as spmenu arguments and pass
them to spmenu.
Therefore \f[V]spmenu_run --prompt \[aq]Run:\[aq]\f[R] will set the
prompt to \f[V]Run:\f[R].
While it is similar to dmenu_run (and achieves the same goal), this
version has some extra features.
.PP
The selected option is piped to /bin/sh (by default).
Unlike dmenu_run, spmenu_run has some cool features.
For example:
.IP \[bu] 2
Prepending \f[V]#\f[R] will spawn it in a terminal instead of just a
shell.
.IP \[bu] 2
Prepending \f[V]magnet\f[R] will open a magnet link in $TORRENT
.IP \[bu] 2
Prepending \f[V]www\f[R] will open a page in $BROWSER
2023-03-20 15:32:20 +01:00
.SH License
.PP
spmenu is licensed under the MIT license.
See the included LICENSE file for more information.