.Dd $Mdocdate$ .Dt MYMENU 1 .Os .Sh NAME .Nm mymenu .Nd simple menu for XOrg .Sh SYNOPSIS .Nm .Bk -words .Op Fl Aahmv .Op Fl B Ar colors .Op Fl b Ar size .Op Fl C Ar color .Op Fl c Ar color .Op Fl d Ar separator .Op Fl e Ar window .Op Fl f Ar font .Op Fl G Ar color .Op Fl g Ar size .Op Fl H Ar height .Op Fl I Ar color .Op Fl i Ar size .Op Fl J Ar color .Op Fl j Ar size .Op Fl l Ar layout .Op Fl P Ar padding .Op Fl p Ar prompt .Op Fl S Ar color .Op Fl s Ar color .Op Fl T Ar color .Op Fl t Ar color .Op Fl W Ar width .Op Fl x Ar coord .Op Fl y Ar coord .Ek .Sh DESCRIPTION The .Nm utility a simple graphical menu for XOrg. It read the items from .Ic stdin and print the user selection to .Ic stdout on exit. The following options are available and take the maximum precedence over the (respective) ones defined in the .Sy X Resource Database .Bl -tag -width indent-two .It Fl A The user must chose one of the option (or none) and is not able to arbitrary enter text .It Fl a The first completion (if any) is always selected. This is like dmenu. .It Fl B Ar colors Override the borders color. Parsed as MyMenu.border.color. .It Fl b Ar borders Override the borders size. Parsed as MyMenu.border.size. .It Fl C Ar color Override the completion background color. See MyMenu.completion.background. .It Fl c Ar color Override the completion foreground color. See MyMenu.completion.foreground. .It Fl d Ar separator Define a string to be used as a separator (mnemonic: delimiter). Only the text after the separator will be rendered, but the original string will be returned. Useful to embed custom data on every entry. See the mpd example for hints on how this can be useful. .It Fl e Ar windowid Embed into the given window id. .It Fl f Ar font Override the font. See MyMenu.font. .It Fl G Ar color Override the border colors of the prompt. See MyMenu.prompt.border.color. .It Fl g Ar size Override the border size of the prompt. See MyMenu.prompt.border.size. .It Fl H Ar val Override the height. Parsed as MyMenu.height. .It Fl h Print a small usage message to stderr. .It Fl I Ar color Override the border colors of the completion. See MyMenu.completion.border.color. .It Fl i Ar size Override the border size of the completion. See MyMenu.completion.border.size. .It Fl J Ar color Override the border colors of the completion. See MyMenu.completion_highlighted.border.color. .It Fl j Ar size Override the border size of the completion. See MyMenu.completion_highlighted.border.size. .It Fl l Ar layout Override the layout. Parsed as MyMenu.layout. .It Fl m The user can select multiple entry via C-m. Please consult .Sx KEYS for more info. .It Fl P Ar padding Override the padding. See the MyMenu.prompt.padding resource. .It Fl p Ar prompt Override the prompt .It Fl S Ar color Override the highlighted completion background color. See MyMenu.completion_highlighted.background. .It Fl s Ar color Override the highlighted completion foreground color. See MyMenu.completion_highlighted.foreground. .It Fl T Ar color Override the prompt background color. See MyMenu.prompt.background. .It Fl t Ar color Override the prompt foreground color. See MyMenu.prompt.foreground. .It Fl v Print version and exit. .It Fl W Ar val Override the width. Parsed as MyMenu.width. .It Fl x Ar val Override the positioning on the X axis, parsed as the resource MyMenu.x .It Fl y Ar val Override the positioning on the Y axis, parsed as the resource MyMenu.y .El .Sh RESOURCES .Bl -tag -width Ds .It MyMenu.font The font name to use. By default is set to "fixed" if compiled without Xft(3) support, "monospace" otherwise. Without Xft(3) only bitmap font are supported. .It MyMenu.layout The layout of the menu. The possible values are "horizontal" and "vertical", with the default being "horizontal". Every other value than "horizontal" is treated like "vertical", but this is kinda an implementation detail and not something to be relied on, since in the future other layout could be added as well. .It MyMenu.prompt A string that is rendered before the user input. Default to "$ ". .It MyMenu.prompt.border.size Parsed like MyMenu.border.size, but affects only the prompt. Default to 0. .It MyMenu.prompt.border.color Parsed like MyMenu.border.color, but affects only the prompt. Default to #000 (black). .It MyMenu.prompt.padding Parsed like MyMenu.border.size. The padding is the space between the end of the borderd and the start of the text, in any direction (top, bottom, left, right). Default to 10. .It MyMenu.width The width of the menu. If a numeric value is given (e.g. 400) is interpreted as pixel, if it ends with a percentage symbol `%' (e.g. 40%) the relative percentage will be computed (relative to the monitor width). .It MyMenu.height The height of the menu. Like MyMenu.width if a numeric value is given is interpreted as pixel, if it ends with a percentage symbol `%' the relative percentage will be computed (relative to the monitor height). .It MyMenu.x The X coordinate of the topmost left corner of the window. Much like MyMenu.height and MyMenu.width both a pixel dimension and percentage could be supplied. In addition to it, some special value can be used. .Bl -tag .It start Alias for 0; .It middle Compute the correct value to make sure that mymenu will be horizontally centered; .It end Compute the correct value to make sure that mymenu will be right aligned. .El .It MyMenu.y The Y coordinate of the topmost left corner of the window. Like the X coordinate a pixel dimension, percentage dimension or the special value "start", "middle", "end" could be supplied. .It MyMenu.border.size A list of number separated by spaces to specify the border of the window. The field is parsed like some CSS properties (i.e. padding), that is: if only one value is provided then it'll be used for all borders; if two value are given than the first will be used for the top and bottom border and the former for the left and right border; with three value the first is used for the top border, the second for the left and right border and the third for the bottom border. If four value are given, they'll be applied to the respective border clockwise. Other values will be ignored. The default value is 0. This particular option accepts a percentage (e.g. 10%) relative to the screen width. .It MyMenu.border.color A list of colors for the borders. This field is parsed like the MyMenu.border.size. The default value is black. .It MyMenu.prompt.background The background of the prompt. .It MyMenu.prompt.foreground The text color (foreground) of the prompt. .It MyMenu.completion.background The background of the completions. .It MyMenu.completion.foreground The text color of the completions. .It MyMenu.completion.border.size Parsed like MyMenu.border.size, but affects only the completion. Default to 0. .It MyMenu.completion.border.color Parsed like MyMenu.border.color, but affects only the completion. Default to #000 (black). .It MyMenu.completion.padding Parsed like MyMenu.prompt.padding. Default to 10. .It MyMenu.completion_highlighted.background The background of the selected completion. .It MyMenu.completion_highlighted.foreground The foreground of the selected completion. .It MyMenu.completion_highlighted.border.size Parsed like MyMenu.border.size, but affects only the completion highlighted. Default to 0. .It MyMenu.completion_highlighted.border.color Parsed like MyMenu.border.color, but affects only the completion highlighted. Default to #000 (black). .It MyMenu.completion_highlighted.padding Parsed like MyMenu.prompt.padding. Default to 10. .El .Sh COLORS MyMenu accept colors only in the form of: .Bl -bullet .It #rgb .It #rrggbb .It #aarrggbb .El The opacity is assumed 0xff (no transparency) if not provided. .Sh KEYS This is the list of keybinding recognized by .Li Nm Ns . In the following examples, C-c means Control-c. .Bl -tag -width indent-two .It Esc Close the menu without selecting any entry .It C-c The same as Esc .It Enter Close the menu and print to stdout what the user typed .It C-m Confirm but keep looping (if enabled), otherwise complete only .It Tab Expand the prompt to the next possible completion .It Shift Tab Expand the prompt to the previous possible completion .It C-n The same as Tab .It C-p The same as Shift-Tab .It Backspace Delete the last character .It C-h The same as Backspace .It C-w Delete the last word .It C-u Delete the whole line .It C-i Toggle the ``first selected'' style. Sometimes, especially with the -a option, could be handy to disable that behaviour. Let's say that you've typed ``fire'' and the first completion is ``firefox'' but you really want to choose ``fire''. While you can type some spaces, this keybinding is a more elegant way to change, at runtime, the behaviour of the first completion. .El .Sh EXIT STATUS 0 when the user select an entry, 1 when the user press Esc, EX_USAGE if used with wrong flags and EX_UNAVAILABLE if the connection to X fails. .Sh EXAMPLES .Bl -bullet -bullet .It Create a simple menu with a couple of entry .Bd -literal -offset indent cat < .Sh CAVEATS .Bl -bullet .It If, instead of a numeric value, a not-valid number that terminates with the % sign is supplied, then the default value for that field will be treated as a percentage. Since this is a misuse of the resources this behavior isn't strictly considered a bug. .It Keep in mind that sometimes the order of the options matter. First are parsed (if any) the xrdb options, then the command line flags .Sy in the provided order! That meas that if you're providing first the x coordinate, let's say "middle", and .Sy after that you are overriding the width, the window .Sy will not be centered. As a general rule of thumb, if you're overriding the width and/or the height of the window, remember to override the x and y coordinates as well. .El