spmenu/spmenu.1

350 lines
10 KiB
Groff
Raw Normal View History

2023-02-26 15:37:09 +01:00
.\" Automatically generated by Pandoc 3.0.1
.\"
.\" 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-09 10:10:29 +01:00
.TH "spmenu" "1" "" "0.2.2" "dynamic menu"
2023-02-26 15:37:09 +01:00
.hy
.SH spmenu
.SS 1. What is spmenu?
.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-02-26 15:37:09 +01:00
.SS 2. Usage
.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.
.SS 3. Arguments
.IP \[bu] 2
2023-02-26 15:44:09 +01:00
spmenu -l line - Set line count to stdin
2023-02-26 15:37:09 +01:00
.IP \[bu] 2
2023-02-26 15:44:09 +01:00
spmenu -h height - Set spmenu line height to height
2023-02-26 15:37:09 +01:00
.IP \[bu] 2
2023-02-26 15:44:09 +01:00
spmenu -g grid - Set the number of grids to grid
2023-02-26 15:37:09 +01:00
.IP \[bu] 2
2023-02-26 15:44:09 +01:00
spmenu -gc - Generate image cache
2023-02-26 15:37:09 +01:00
.IP \[bu] 2
2023-03-06 20:06:00 +01:00
spmenu -ngc - Don\[cq]t generate image cache
.IP \[bu] 2
2023-02-26 15:44:09 +01:00
spmenu -rw - Enable relative input width
2023-02-26 15:37:09 +01:00
.IP \[bu] 2
2023-02-26 15:44:09 +01:00
spmenu -nrw - Disable relative input width
2023-02-26 15:37:09 +01:00
.IP \[bu] 2
2023-02-26 15:44:09 +01:00
spmenu -f - Grabs keyboard before reading stdin
2023-02-26 15:37:09 +01:00
.IP \[bu] 2
2023-02-26 15:44:09 +01:00
spmenu -F - Enable fuzzy matching
2023-02-26 15:37:09 +01:00
.IP \[bu] 2
2023-02-26 15:44:09 +01:00
spmenu -P - Hide characters
2023-02-26 15:37:09 +01:00
.IP \[bu] 2
spmenu -Ps symbol - Set the password symbol to symbol
.IP \[bu] 2
2023-02-26 15:44:09 +01:00
spmenu -p text - Set spmenu prompt text to text
2023-02-26 15:37:09 +01:00
.IP \[bu] 2
spmenu -ip - Indent items to prompt width
2023-02-26 15:37:09 +01:00
.IP \[bu] 2
spmenu -nip - Don\[cq]t indent items to prompt width
2023-02-26 15:37:09 +01:00
.IP \[bu] 2
spmenu -a - Enable alpha
2023-02-26 15:37:09 +01:00
.IP \[bu] 2
spmenu -na - Disable alpha
2023-02-26 15:37:09 +01:00
.IP \[bu] 2
2023-02-26 15:44:09 +01:00
spmenu -tp - Allow the user to type
2023-02-26 15:37:09 +01:00
.IP \[bu] 2
2023-02-26 15:44:09 +01:00
spmenu -nt - Don\[cq]t allow typing, the user must select an option
2023-02-26 15:37:09 +01:00
.IP \[bu] 2
2023-02-26 15:44:09 +01:00
spmenu -x x offset - Offset spmenu x position by x offset
2023-02-26 15:37:09 +01:00
.IP \[bu] 2
2023-02-26 15:44:09 +01:00
spmenu -y y offset - Offset spmenu y position by y offset
2023-02-26 15:37:09 +01:00
.IP \[bu] 2
2023-02-26 15:44:09 +01:00
spmenu -n line - Preselect line in the list of items
2023-02-26 15:37:09 +01:00
.IP \[bu] 2
2023-02-26 15:44:09 +01:00
spmenu -z width - Width of the spmenu window
2023-02-26 15:37:09 +01:00
.IP \[bu] 2
2023-02-26 15:44:09 +01:00
spmenu -nmt text - Set normal mode text to text
2023-02-26 15:37:09 +01:00
.IP \[bu] 2
2023-02-26 15:44:09 +01:00
spmenu -imt text - Set insert mode text to text
2023-02-26 15:37:09 +01:00
.IP \[bu] 2
2023-02-26 15:44:09 +01:00
spmenu -bw - Width of the border.
2023-02-26 15:37:09 +01:00
0 will disable the border
.IP \[bu] 2
2023-03-04 15:51:26 +01:00
spmenu -so - Sort matches
.IP \[bu] 2
spmenu -nso - Don\[cq]t sort matches
.IP \[bu] 2
2023-03-09 10:10:29 +01:00
spmenu -pri priority - Specify a list of items that take priority
.IP \[bu] 2
2023-02-26 15:44:09 +01:00
spmenu -s - Use case-sensitive matching
2023-02-26 15:37:09 +01:00
.IP \[bu] 2
2023-02-26 15:44:09 +01:00
spmenu -i - Use case-insensitive matching
2023-02-26 15:37:09 +01:00
.IP \[bu] 2
2023-02-26 15:44:09 +01:00
spmenu -nm - Start spmenu in normal mode
2023-02-26 15:37:09 +01:00
.IP \[bu] 2
2023-02-26 15:44:09 +01:00
spmenu -im - Start spmenu in insert mode
2023-02-26 15:37:09 +01:00
.IP \[bu] 2
2023-02-26 15:44:09 +01:00
spmenu -t - Position spmenu at the top of the screen
2023-02-26 15:37:09 +01:00
.IP \[bu] 2
2023-02-26 15:44:09 +01:00
spmenu -b - Position spmenu at the bottom of the screen
2023-02-26 15:37:09 +01:00
.IP \[bu] 2
2023-02-26 15:44:09 +01:00
spmenu -c - Position spmenu at the center of the screen
2023-02-26 15:37:09 +01:00
.IP \[bu] 2
2023-02-26 15:44:09 +01:00
spmenu -hm - Hide mode indicator
2023-02-26 15:37:09 +01:00
.IP \[bu] 2
2023-02-26 15:44:09 +01:00
spmenu -hmc - Hide match count
2023-02-26 15:37:09 +01:00
.IP \[bu] 2
spmenu -hla - Hide left arrow
.IP \[bu] 2
spmenu -hra - Hide right arrow
.IP \[bu] 2
spmenu -hpr - Hide prompt
.IP \[bu] 2
spmenu -hc - Hide cursor
.IP \[bu] 2
spmenu -hhl - Hide highlight
.IP \[bu] 2
spmenu -hi - Hide image
.IP \[bu] 2
2023-02-26 15:44:09 +01:00
spmenu -sm - Show mode indicator
2023-02-26 15:37:09 +01:00
.IP \[bu] 2
2023-02-26 15:44:09 +01:00
spmenu -smc - Show match count
2023-02-26 15:37:09 +01:00
.IP \[bu] 2
spmenu -sla - Show left arrow
.IP \[bu] 2
spmenu -sra - Show right arrow
.IP \[bu] 2
spmenu -spr - Show prompt
.IP \[bu] 2
spmenu -sc - Show cursor
.IP \[bu] 2
spmenu -shl - Show highlight
.IP \[bu] 2
spmenu -si - Show image
.IP \[bu] 2
2023-02-26 15:44:09 +01:00
spmenu -xrdb - Load .Xresources on runtime
2023-02-26 15:37:09 +01:00
.IP \[bu] 2
2023-02-26 15:44:09 +01:00
spmenu -w window id - Embed spmenu inside window id
2023-02-26 15:37:09 +01:00
.IP \[bu] 2
2023-02-26 15:44:09 +01:00
spmenu -H hist file - Specify a path to save the history to
2023-02-26 15:37:09 +01:00
.IP \[bu] 2
2023-02-26 15:44:09 +01:00
spmenu -ig gaps - Set image gaps to gaps
2023-02-26 15:37:09 +01:00
.IP \[bu] 2
2023-02-26 15:44:09 +01:00
spmenu -lp padding - Set the vertical padding
2023-02-26 15:37:09 +01:00
.IP \[bu] 2
2023-02-26 15:44:09 +01:00
spmenu -hp padding - Set the horizontal padding
2023-02-26 15:37:09 +01:00
.IP \[bu] 2
2023-02-26 15:44:09 +01:00
spmenu -la symbol - Set the left arrow to symbol
2023-02-26 15:37:09 +01:00
.IP \[bu] 2
2023-02-26 15:44:09 +01:00
spmenu -ra symbol - Set the right arrow to symbol
2023-02-26 15:37:09 +01:00
.IP \[bu] 2
2023-02-26 15:44:09 +01:00
spmenu -is size - Image size
2023-02-26 15:37:09 +01:00
.IP \[bu] 2
2023-02-26 15:44:09 +01:00
spmenu -it - Position the image at the top
2023-02-26 15:37:09 +01:00
.IP \[bu] 2
2023-02-26 15:44:09 +01:00
spmenu -ib - Position the image at the bottom
2023-02-26 15:37:09 +01:00
.IP \[bu] 2
2023-02-26 15:44:09 +01:00
spmenu -ic - Position the image in the center
2023-02-26 15:37:09 +01:00
.IP \[bu] 2
2023-02-26 15:44:09 +01:00
spmenu -itc - Position the image in the top center
2023-02-26 15:37:09 +01:00
.IP \[bu] 2
spmenu -wm - Spawn spmenu as a window manager controlled client
2023-02-26 15:37:09 +01:00
.IP \[bu] 2
2023-02-26 15:44:09 +01:00
spmenu -v - Print spmenu version to stdout
2023-02-26 15:37:09 +01:00
.IP \[bu] 2
2023-02-26 15:44:09 +01:00
spmenu -fn font - Set the spmenu font to font
2023-02-26 15:37:09 +01:00
.IP \[bu] 2
2023-02-26 15:44:09 +01:00
spmenu -nif color - Set the normal item foreground color
2023-02-26 15:37:09 +01:00
.IP \[bu] 2
2023-02-26 15:44:09 +01:00
spmenu -nib color - Set the normal item background color
2023-02-26 15:37:09 +01:00
.IP \[bu] 2
2023-02-26 15:44:09 +01:00
spmenu -sif color - Set the selected item foreground color
2023-02-26 15:37:09 +01:00
.IP \[bu] 2
2023-02-26 15:44:09 +01:00
spmenu -sib color - Set the selected item background color
2023-02-26 15:37:09 +01:00
.IP \[bu] 2
2023-03-09 10:10:29 +01:00
spmenu -npf color - Set the normal item (high priority) foreground color
.IP \[bu] 2
spmenu -npb color - Set the normal item (high priority) background color
.IP \[bu] 2
spmenu -spf color - Set the selected item (high priority) foreground
color
.IP \[bu] 2
spmenu -spb color - Set the selected item (high priority) background
color
.IP \[bu] 2
2023-02-26 15:44:09 +01:00
spmenu -pfg color - Set the prompt foreground color
2023-02-26 15:37:09 +01:00
.IP \[bu] 2
2023-02-26 15:44:09 +01:00
spmenu -pbg color - Set the prompt background color
2023-02-26 15:37:09 +01:00
.IP \[bu] 2
2023-02-26 15:44:09 +01:00
spmenu -ifg color - Set input foreground color
2023-02-26 15:37:09 +01:00
.IP \[bu] 2
2023-02-26 15:44:09 +01:00
spmenu -ibg color - Set input background color
2023-02-26 15:37:09 +01:00
.IP \[bu] 2
2023-02-26 15:44:09 +01:00
spmenu -mbg color - Set the menu background color
2023-02-26 15:37:09 +01:00
.IP \[bu] 2
2023-02-26 15:44:09 +01:00
spmenu -nhf color - Set the normal highlight foreground color
2023-02-26 15:37:09 +01:00
.IP \[bu] 2
2023-02-26 15:44:09 +01:00
spmenu -nhb color - Set the normal highlight background color
2023-02-26 15:37:09 +01:00
.IP \[bu] 2
2023-02-26 15:44:09 +01:00
spmenu -shf color - Set the selected highlight foreground color
2023-02-26 15:37:09 +01:00
.IP \[bu] 2
2023-02-26 15:44:09 +01:00
spmenu -shb color - Set the selected highlight background color
2023-02-26 15:37:09 +01:00
.IP \[bu] 2
2023-02-26 15:44:09 +01:00
spmenu -shb color - Set the selected highlight background color
2023-02-26 15:37:09 +01:00
.IP \[bu] 2
2023-02-26 15:44:09 +01:00
spmenu -nfg color - Set the foreground color for the match count
2023-02-26 15:37:09 +01:00
.IP \[bu] 2
2023-02-26 15:44:09 +01:00
spmenu -nbg color - Set the background color for the match count
2023-02-26 15:37:09 +01:00
.IP \[bu] 2
2023-02-26 15:44:09 +01:00
spmenu -mfg color - Set the foreground color for the mode indicator
2023-02-26 15:37:09 +01:00
.IP \[bu] 2
2023-02-26 15:44:09 +01:00
spmenu -mbg color - Set the background color for the mode indicator
2023-02-26 15:37:09 +01:00
.IP \[bu] 2
2023-02-26 15:44:09 +01:00
spmenu -laf color - Set the left arrow foreground color
2023-02-26 15:37:09 +01:00
.IP \[bu] 2
2023-02-26 15:44:09 +01:00
spmenu -raf color - Set the right arrow foreground color
2023-02-26 15:37:09 +01:00
.IP \[bu] 2
2023-02-26 15:44:09 +01:00
spmenu -lab color - Set the left arrow background color
2023-02-26 15:37:09 +01:00
.IP \[bu] 2
2023-02-26 15:44:09 +01:00
spmenu -rab color - Set the right arrow background color
2023-02-26 15:37:09 +01:00
.IP \[bu] 2
2023-02-26 15:44:09 +01:00
spmenu -cc color - Set the caret color
2023-02-26 15:37:09 +01:00
.IP \[bu] 2
2023-02-26 15:44:09 +01:00
spmenu -bc color - Set the border color
2023-02-26 15:37:09 +01:00
.IP \[bu] 2
2023-02-26 15:44:09 +01:00
spmenu -sgr0 - Set the SGR 0 color
2023-02-26 15:37:09 +01:00
.IP \[bu] 2
2023-02-26 15:44:09 +01:00
spmenu -sgr1 - Set the SGR 1 color
2023-02-26 15:37:09 +01:00
.IP \[bu] 2
2023-02-26 15:44:09 +01:00
spmenu -sgr2 - Set the SGR 2 color
2023-02-26 15:37:09 +01:00
.IP \[bu] 2
2023-02-26 15:44:09 +01:00
spmenu -sgr3 - Set the SGR 3 color
2023-02-26 15:37:09 +01:00
.IP \[bu] 2
2023-02-26 15:44:09 +01:00
spmenu -sgr4 - Set the SGR 4 color
2023-02-26 15:37:09 +01:00
.IP \[bu] 2
2023-02-26 15:44:09 +01:00
spmenu -sgr5 - Set the SGR 5 color
2023-02-26 15:37:09 +01:00
.IP \[bu] 2
2023-02-26 15:44:09 +01:00
spmenu -sgr6 - Set the SGR 6 color
2023-02-26 15:37:09 +01:00
.IP \[bu] 2
2023-02-26 15:44:09 +01:00
spmenu -sgr7 - Set the SGR 7 color
2023-02-26 15:37:09 +01:00
.IP \[bu] 2
2023-02-26 15:44:09 +01:00
spmenu -sgr8 - Set the SGR 8 color
2023-02-26 15:37:09 +01:00
.IP \[bu] 2
2023-02-26 15:44:09 +01:00
spmenu -sgr9 - Set the SGR 9 color
2023-02-26 15:37:09 +01:00
.IP \[bu] 2
2023-02-26 15:44:09 +01:00
spmenu -sgr10 - Set the SGR 10 color
2023-02-26 15:37:09 +01:00
.IP \[bu] 2
2023-02-26 15:44:09 +01:00
spmenu -sgr11 - Set the SGR 11 color
2023-02-26 15:37:09 +01:00
.IP \[bu] 2
2023-02-26 15:44:09 +01:00
spmenu -sgr12 - Set the SGR 12 color
2023-02-26 15:37:09 +01:00
.IP \[bu] 2
2023-02-26 15:44:09 +01:00
spmenu -sgr13 - Set the SGR 13 color
2023-02-26 15:37:09 +01:00
.IP \[bu] 2
2023-02-26 15:44:09 +01:00
spmenu -sgr14 - Set the SGR 14 color
2023-02-26 15:37:09 +01:00
.IP \[bu] 2
2023-02-26 15:44:09 +01:00
spmenu -sgr15 - Set the SGR 15 color
2023-02-26 15:37:09 +01:00
.PP
There are also extra arguments recognized for dmenu compatibility.
These are:
.IP \[bu] 2
2023-03-04 15:51:26 +01:00
spmenu -S - Don\[cq]t sort matches
.IP \[bu] 2
2023-02-26 15:44:09 +01:00
spmenu -nb color - Set the normal background color
2023-02-26 15:37:09 +01:00
.IP \[bu] 2
2023-02-26 15:44:09 +01:00
spmenu -nf color - Set the normal foreground color
2023-02-26 15:37:09 +01:00
.IP \[bu] 2
2023-02-26 15:44:09 +01:00
spmenu -sb color - Set the selected background color
2023-02-26 15:37:09 +01:00
.IP \[bu] 2
2023-02-26 15:44:09 +01:00
spmenu -sf color - Set the selected foreground color
2023-02-26 15:37:09 +01:00
.SS 4. Keybinds
.PP
See \f[V]keybinds.h\f[R] for a list.
.SS 5. Modes
.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.
.SS 6. -p option
.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.
.SS 7. Images
.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].
2023-02-26 15:37:09 +01:00
.SS 8. Colored text
.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
A list of SGR sequences will not be provided here, but spmenu supports
most color sequences.
There are also a few arguments, you can override SGR colors on-the-fly
using the \f[V]-sgr\f[R] arguments.