Documentation ¶
Overview ¶
Example ¶
package main import ( "context" "fmt" "log" "git.sr.ht/~marianozunino/go-rofi/dmenu" "git.sr.ht/~marianozunino/go-rofi/entry" ) func main() { d := dmenu.New( dmenu.WithPrompt("Prompt"), dmenu.WithEntries( entry.New("with icon", entry.WithIcon("folder")), entry.New("plain"), entry.New("with meta", entry.WithMeta("find me")), ), ) ctx := context.Background() s, err := d.Select(ctx) if err != nil { log.Fatal(err) } fmt.Println("choice was", s) }
Output:
Index ¶
- func WithActive(a string) opt
- func WithBallotSelectedString(s string) opt
- func WithBallotUnselectedString(s string) opt
- func WithCaseInsentitive() opt
- func WithDisplayColumnSeparator(s string) opt
- func WithDisplayColumns(c string) opt
- func WithEntries(e ...*entry.Entry) opt
- func WithExecPath(path string) opt
- func WithFormat(f string) opt
- func WithInput(f string) opt
- func WithKeepRight() opt
- func WithLines(n int) opt
- func WithMarkupRows() opt
- func WithMessage(m string) opt
- func WithMultiSelect() opt
- func WithNoCustom() opt
- func WithOnlyMatch() opt
- func WithPassword() opt
- func WithPrompt(p string) opt
- func WithSelect(s string) opt
- func WithSync() opt
- func WithUrgent(u string) opt
- func WithWindowID(id string) opt
- func WithWindowTitle(t string) opt
- type Dmenu
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WithActive ¶
func WithActive(a string) opt
Active row, mark X as active. Where X is a comma-separated list of python(1)-style indices and ranges, e.g. indices start at 0, -1 refers to the last row with -2 preceding it, ranges are left-open and right-close, and so on. You can specify:
- A single row: '5'
- A range of (last 3) rows: '-3:'
- 4 rows starting from row 7: '7:11' (or in legacy notation: '7-10')
- A set of rows: '2,0,-9'
- Or any combination: '5,-3:,7:11,2,0,-9'
func WithBallotSelectedString ¶
func WithBallotSelectedString(s string) opt
When multi-select is enabled, prefix this string when element is selected.
default: "☑ "
func WithBallotUnselectedString ¶
func WithBallotUnselectedString(s string) opt
When multi-select is enabled, prefix this string when element is not selected.
default: "☐ "
func WithDisplayColumnSeparator ¶
func WithDisplayColumnSeparator(s string) opt
The column separator. This is a regex.
default: '\t'
func WithDisplayColumns ¶
func WithDisplayColumns(c string) opt
A comma separated list of columns to show.
func WithEntries ¶
func WithExecPath ¶
func WithExecPath(path string) opt
WithExecPath sets the path to the rofi executable
func WithFormat ¶
func WithFormat(f string) opt
Allows the output of dmenu to be customized (N is the total number of input entries):
's' selected string 'i' index (0 - (N-1)) 'd' index (1 - N) 'q' quote string 'p' Selected string stripped from Pango markup (Needs to be a valid string) 'f' filter string (user input) 'F' quoted filter string (user input)
default: 's'
func WithKeepRight ¶
func WithKeepRight() opt
Set ellipsize mode to start. So, the end of the string is visible.
func WithLines ¶
func WithLines(n int) opt
Maximum number of lines the menu may show before scrolling.
default: 15
func WithMarkupRows ¶
func WithMarkupRows() opt
Tell rofi that DMenu input is Pango markup encoded, and should be rendered. See here ⟨https://developer.gnome.org/pygtk/stable/pango-markup- language.html⟩ for details about Pango markup.
func WithMessage ¶
func WithMessage(m string) opt
Add a message line below the filter entry box. Supports Pango markup. For more information on supported markup, see here ⟨https://docs.gtk.org/Pango/pango_markup.html⟩
func WithMultiSelect ¶
func WithMultiSelect() opt
Allow multiple lines to be selected. Adds a small selection indicator to the left of each entry.
func WithNoCustom ¶
func WithNoCustom() opt
Only return a selected item, do not allow custom entry. This mode returns directly when no entries given.
func WithOnlyMatch ¶
func WithOnlyMatch() opt
Only return a selected item, do not allow custom entry. This mode always returns an entry. It will not return if no matching entry is selected.
func WithPassword ¶
func WithPassword() opt
Hide the input text. This should not be considered secure!
func WithSync ¶
func WithSync() opt
Force rofi mode to first read all data from stdin before showing the selection window. This is original dmenu behavior. Note: the default asynchronous mode will also be automatically disabled if used with conflicting options, such as -dump, -only-match or -auto-select.
func WithUrgent ¶
func WithUrgent(u string) opt
Urgent row, mark X as active. Where X is a comma-separated list of python(1)-style indices and ranges, e.g. indices start at 0, -1 refers to the last row with -2 preceding it, ranges are left-open and right-close, and so on. You can specify:
- A single row: '5'
- A range of (last 3) rows: '-3:'
- 4 rows starting from row 7: '7:11' (or in legacy notation: '7-10')
- A set of rows: '2,0,-9'
- Or any combination: '5,-3:,7:11,2,0,-9'
func WithWindowID ¶
func WithWindowID(id string) opt
Position rofi over the window with the given X11 window ID.
func WithWindowTitle ¶
func WithWindowTitle(t string) opt
Set name used for the window title. Will be shown as Rofi - title