Documentation ¶
Index ¶
- func WithActive(active string) opt
- func WithData(data string) opt
- func WithEntries(entries ...*entry.Entry) opt
- func WithKeepSelection() opt
- func WithMarkupRows() opt
- func WithMessage(message string) opt
- func WithNewSelection() opt
- func WithNoCustom() opt
- func WithPrompt(prompt string) opt
- func WithTheme(theme string) opt
- func WithUrgent(urgent string) opt
- func WithUseHotKeys() opt
- type CustomRunner
- type Runnable
- type Runner
- type Script
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WithActive ¶
func WithActive(active 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 WithData ¶
func WithData(data string) opt
Passed data to the next execution of the script via ROFI_DATA.
func WithEntries ¶
func WithKeepSelection ¶
func WithKeepSelection() opt
If set, the selection is not moved to the first entry, but the current position is maintained. The filter is cleared.
func WithNewSelection ¶
func WithNewSelection() opt
If keep-selection is set, this allows you to override the selected entry (absolute position).
func WithTheme ¶
func WithTheme(theme string) opt
Small theme snippet to f.e. change the background color of a widget.
func WithUrgent ¶
func WithUrgent(urgent string) opt
Urgent row, mark X as urgent. 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 WithUseHotKeys ¶
func WithUseHotKeys() opt
If set to true, it enabled the Custom keybindings for script. Warning this breaks the normal rofi flow.
Types ¶
type CustomRunner ¶
CustomRunner represents an object that accepts custom answers
type Runnable ¶
type Runnable interface { FirstRun() (string, error) OnSelection(selection, info, data string) (string, error) }
Runnable represents an object that can provide options for rofi-script to run successfully.
type Script ¶
type Script struct {
// contains filtered or unexported fields
}
func (*Script) AddEntries ¶
func (*Script) Build ¶
Example ¶
package main import ( "fmt" "git.sr.ht/~marianozunino/go-rofi/script" ) func main() { r := script.New() fmt.Print(r.Build()) }
Output:
Example (Second) ¶
package main import ( "fmt" "git.sr.ht/~marianozunino/go-rofi/entry" "git.sr.ht/~marianozunino/go-rofi/script" ) func main() { r := script.New(script.WithEntries( entry.New("option 1"), entry.New("option 2"), )) fmt.Print(r.Build()) }
Output: option 1 option 2