diff options
-rw-r--r-- | doc/tofi.1.scd | 114 | ||||
-rw-r--r-- | doc/tofi.5.scd | 212 | ||||
-rw-r--r-- | meson.build | 16 | ||||
-rw-r--r-- | src/main.c | 2 | ||||
-rw-r--r-- | src/tofi.h | 1 |
5 files changed, 263 insertions, 82 deletions
diff --git a/doc/tofi.1.scd b/doc/tofi.1.scd index 4e58a56..961a0bc 100644 --- a/doc/tofi.1.scd +++ b/doc/tofi.1.scd @@ -1,104 +1,62 @@ -greetd-mini-wl-greeter(1) +tofi(1) # NAME -greetd-mini-wl-greeter - An extremely simple raw Wayland greeter for greetd +tofi - Tiny dynamic menu for Wayland, inspired by *rofi*(1) and *dmenu*(1). # SYNOPSIS -*greetd-mini-wl-greeter* -u user -c command [-bBCeEfFhHnoOrRw] +*tofi* [options...] +*tofi-run* [options...] +*tofi-compgen* # DESCRIPTION -greetd-mini-wl-greeter is a raw Wayland greeter for greetd, designed for a -single user. It requires a Wayland compositor to run, such as *cage*(1) or -*sway*(1). +*tofi* is a tiny dynamic menu for Wayland compositors supporting the +layer-shell protocol. It reads newline-separated items from stdin, and displays +a graphical selection menu. When a selection is made, it is printed to stdout. -# OPTIONS - -All options which take a color expect a 3- or 6-digit hex code, e.g. F9A733. - -*-u, --user* <username> - The user to login as. - -*-c, --command* <command> - The command to run on login. - -*-b, --background-image* <image> - An image to use as the background. Currently only PNG images are supported. - -*-B, --background-color* <color> - Color of the background in the absence of an image. - -*-o, --outline-width* <value> - Width of the outlines around the border, in pixels. - -*-O, --outline-color* <color> - Color of the outlines around the border. - -*-r, --border-width* <value> - Width of the border in pixels. +When invoked via the name *tofi-run*, *tofi* will not accept items on stdin, +instead presenting a list of executables in the user's $PATH. -*-R, --border-color* <color> - Color of the border. +*tofi-compgen* just prints the list of executables used by *tofi-run*. -*-e, --entry-padding* <value> - Padding around the password text in pixels. - -*-E, --entry-color* <color> - Color of the password entry box. - -*-f, --font-name* <name> - Font to use for the password entry. - -*-F, --font-size* <value> - Point size of the password text. - -*-T, --text-color* <value> - Color of the password text. +# OPTIONS -*-C, --password-character* <character> - Character to use to hide the password. Defaults to full-stop. +*-h, --help* + Print help and exit. -*-n, --width-characters* <value> - Make the password entry box big enough to fit this many characters. +*-c, --config* <path> + Specify path to custom config file. -*-w, --wide-layout* - By default, the password entry box will be shrunk vertically to exactly fit - the specified password character. Use this option if you'd rather that it got - laid out like normal text, i.e. the box remains one full character tall. +All config file options described in *tofi(5)* are also accepted, in the form +*--key=value*. -*-H, --hide-cursor* - Hide the cursor. +# KEYS -*-h, --help* - Print help and exit. +<Up> | <Left> + Move the selection back one entry. -# EXAMPLES +<Down> | <Right> + Move the selection back forward entry. -greetd-mini-wl-greeter aims to be as fast and simple as possible by default. If -none of the *-f*, *-C* or *-w* options are given, a simple circle will be used -for the password character, avoiding the need to use Pango, thus lowering -startup time. This is only likely noticeable on very slow machines however. +<Enter> + Confirm the current selection and quit. -When using sway as the compositor for greetd-mini-greeter, something like the -following sway config lines produce a nice look: +<Escape> + Quit without making a selection. -``` -# Remove any window borders -default_border none -hide_edge_borders both +# FILES -# Add a background image, to avoid a flicker of default background color -output * background /path/to/image fill +_$XDG_CONFIG_HOME/tofi/config_ + The default configuration file. -# Use the same background image for the greeter -exec greetd-mini-wl-greeter -u username -c command -b /path/to/image -``` +_$XDG_CACHE_HOME/tofi-compgen_ + Cached list of executables under $PATH, regenerated as necessary. -Fun can be had with the *-C* option, as it should support any character from -your locale, which is probably a UTF-8 one. For example, the Unicode "Combining -Dot Below" character ( ̣) produces a nice effect. +_$XDG_STATE_HOME/tofi-history_ + Numeric count of commands selected in *tofi-run*, to enable sorting + results by run count. # AUTHORS @@ -106,4 +64,4 @@ Philip Jones <philj56@gmail.com> # SEE ALSO -*greetd*(1) +*tofi*(5), *dmenu*(1) *rofi*(1) diff --git a/doc/tofi.5.scd b/doc/tofi.5.scd new file mode 100644 index 0000000..08c608d --- /dev/null +++ b/doc/tofi.5.scd @@ -0,0 +1,212 @@ +tofi(5) + +# NAME + +tofi - configuration file + +# DESCRIPTION + +The config file format is basic .ini/.cfg style. Options are set one per line, +with the syntax: + + option = value + +Whitespace is ignored. Values starting or ending with whitespace can be given +by enclosing them in double quotes like so: + + option = " value " + +Lines beginning with # or ; are treated as comments. Section headers of the +form [header] are currently ignored. All options and values are +case-insensitive, except where not possible (e.g. paths). Later options +override earlier options, and command line options override config file +options. + +# OPTIONS + +*font-name*=_font_ + Font to use. If _font_ is a path to a font file, *tofi* will not have + to use Pango or Fontconfig. This greatly speeds up startup, but any + characters not in the chosen font will fail to render. + + If a path is not given, _font_ is interpreted as a font name in Pango + format. + + Default: "Sans" + +*font-size*=_pt_ + Point size of text. + + Default: 24 + +*background-color*=_color_ + Color of the background. See *COLORS* for more information. + + Default: #1B1D1E + +*outline-width*=_px_ + Width of the border outlines. + + Default: 4 + +*outline-color*=_color_ + Color of the border outlines. See *COLORS* for more information. + + Default: #080800 + +*border-width*=_px_ + Width of the border. + + Default: 12 + +*border-color*=_color_ + Color of the border. See *COLORS* for more information. + + Default: #F92672 + +*text-color*=_color_ + Color of text. See *COLORS* for more information. + + Default: #FFFFFF + +*prompt-text*=_string_ + Prompt text. + + Default: "run: " + +*num-results*=_n_ + Maximum number of results to display. + + Default: 5 + +*selection-color*=_color_ + Color of selected result. See *COLORS* for more information. + + Default: #F92672 + +*result-spacing*=_px_ + Spacing between results. Can be negative. + + Default: 0 + +*min-input-width*=_px_ + Minimum width of input in horizontal mode. + + Default: 0 + +*width*=_px|%_ + Width of the window. See *PERCENTAGE VALUES* for more information. + + Default: 1280 + +*height*=_px|%_ + Height of the window. See *PERCENTAGE VALUES* for more information. + + Default: 720 + +*corner-radius*=_px_ + Radius of the window corners. + + Default: 0 + +*anchor*=_position_ + Location on screen to anchor the window. Supported values are + _top-left_, _top_, _top-right_, _right_, _bottom-right_, _bottom_, + _bottom-left_, _left_, and _center_. + + Default: center + +*margin-top*=_px|%_ + Offset from top of screen. See *PERCENTAGE VALUES* for more + information. Only has an effect when anchored to the top of the screen. + + Default: 0 + +*margin-bottom*=_px|%_ + Offset from bottom of screen. See *PERCENTAGE VALUES* for more + information. Only has an effect when anchored to the bottom of the + screen. + + Default: 0 + +*margin-left*=_px|%_ + Offset from left of screen. See *PERCENTAGE VALUES* for more + information. Only has an effect when anchored to the left of the + screen. + + Default: 0 + +*margin-right*=_px|%_ + Offset from right of screen. See *PERCENTAGE VALUES* for more + information. Only has an effect when anchored to the right of the + screen. + + Default: 0 + +*padding-top*=_px|%_ + Padding between top border and text. See *PERCENTAGE VALUES* for more + information. + + Default: 8 + +*padding-bottom*=_px|%_ + Padding between bottom border and text. See *PERCENTAGE VALUES* for + more information. + + Default: 8 + +*padding-left*=_px|%_ + Padding between left border and text. See *PERCENTAGE VALUES* for more + information. + + Default: 8 + +*padding-right*=_px|%_ + Padding between right border and text. See *PERCENTAGE VALUES* for more + information. + + Default: 8 + +*hide-cursor*=_true|false_ + Hide the cursor. + + Default: false + +*horizontal*=_true|false_ + List results horizontally. + + Default: false + +*history*=_true|false_ + Sort results by number of usages. + + Default: true + +*hint-font*=_true|false_ + Perform font hinting. Only applies when a path to a font has been + specified via *font-name*. Disabling font hinting speeds up text + rendering appreciably, but will likely look poor at small font pixel + sizes. + + Default: true + +# COLORS + +Colors can be specified in the form _RGB_, _RGBA_, _RRGGBB_ or _RRGGBBAA_. + +# PERCENTAGE VALUES + +Some pixel values can optionally have a % suffix, like so: + + width = 50% + +This will be interpreted as a percentage of the screen resolution in the +relevant direction. + +# AUTHORS + +Philip Jones <philj56@gmail.com> + +# SEE ALSO + +*tofi*(5), *dmenu*(1) *rofi*(1) diff --git a/meson.build b/meson.build index 810780b..a9af71d 100644 --- a/meson.build +++ b/meson.build @@ -140,11 +140,11 @@ if scdoc.found() sed = find_program('sed') sh = find_program('sh') mandir = get_option('mandir') - manpage = 'doc/tofi.1.scd' + output = 'tofi.1' custom_target( output, - input: manpage, + input: 'doc/tofi.1.scd', output: output, command: [ sh, '-c', '@0@ < @INPUT@ > @1@'.format(scdoc.path(), output) @@ -152,4 +152,16 @@ if scdoc.found() install: true, install_dir: '@0@/man1'.format(mandir) ) + + output = 'tofi.5' + custom_target( + output, + input: 'doc/tofi.5.scd', + output: output, + command: [ + sh, '-c', '@0@ < @INPUT@ > @1@'.format(scdoc.path(), output) + ], + install: true, + install_dir: '@0@/man5'.format(mandir) + ) endif @@ -577,6 +577,7 @@ static void usage() " --min-input-width <px> Minimum width of input in horizontal mode.\n" " --width <px|%> Width of the window.\n" " --height <px|%> Height of the window.\n" +" --corner-radius <px> Radius of window corners.\n" " --anchor <position> Location on screen to anchor window.\n" " --margin-top <px|%> Offset from top of screen.\n" " --margin-bottom <px|%> Offset from bottom of screen.\n" @@ -695,7 +696,6 @@ int main(int argc, char *argv[]) /* Default options. */ struct tofi tofi = { .window = { - .background_color = {0.89f, 0.8f, 0.824f, 1.0f}, .scale = 1, .width = 1280, .height = 720, @@ -36,7 +36,6 @@ struct tofi { struct { struct surface surface; struct zwlr_layer_surface_v1 *zwlr_layer_surface; - struct color background_color; struct entry entry; uint32_t width; uint32_t height; |