The functions documented here are used for interacting with wofi. They are defined in wofi_api.h.
.SHSTRUCTURES
struct cache_line {
.RS4
char* line;
.br
struct wl_list link;
.RE
};
.SHAPIFUNCTIONS
The following functions are used to interact with wofi.
.TP
.Bchar*wofi_parse_image_escapes(constchar*text)
This function takes in text containing image escapes and pango markup and will return the plain text with all of that stripped. The string returned is newly allocated and should be freed by the caller when they are done with it.
.Bconstchar*text
\- The input text containing image escapes and pango markup.
\- The \fBstruct mode*\fR given to your mode's \fBinit()\fR function.
.Bconstchar*cmd
\- The entry to remove from the cache file. This does NOT decrement the number of times written, it fully removes the entry.
.TP
.Bstructwl_list*wofi_read_cache(structmode*mode)
Reads the cache and returns a \fBstruct wl_list*\fR containing the entires. The list is made up of \fBstruct cache_line*\fR entries. The wayland documentation should be referred to for the usage of a wl_list.
.Bstructmode*mode
\- The \fBstruct mode*\fR given to your mode's \fBinit()\fR function.
Creates a widget from the specified information. This widget should be returned by the mode's \fBget_widget()\fR function in order to be displayed.
.Bstructmode*mode
\- The \fBstruct mode*\fR given to your mode's \fBinit()\fR function.
.Bchar*text[]
\- The array of text to display on the entry in wofi. Each element in the array represents the text for 1 action. The array should only be larger than 1 if you're creating a multi\-action entry. Multi\-action entries need to provide 1 string for every action the entry has.
.Bchar*search_text
\- The text which the user can search for to find this widget.
.Bchar*actions[]
\- The array of actions for the entry. An action is the text given to a mode's \fBexec()\fR function when the user selects an entry. Multi\-action entries need to provide 1 action string for every action the entry has.
.Bsize_taction_count
\- The number of actions the entry will have.
.TP
.Bvoidwofi_insert_widgets(structmode*mode)
This will requery the mode for more widgets.
.Bstructmode*mode
\- The \fBstruct mode*\fR given to your mode's \fBinit()\fR function.
Returns true if the user enabled images, false otherwise.
.TP
.Bboolwofi_allow_markup(void)
Returns true if the user enabled pango markup, false otherwise.
.TP
.Buint64_twofi_get_image_size(void)
Returns the user specified image size, 32 by default. Wofi will scale images for you, this is just informational and is not required but can be helpful if multiple sizes are available.
.TP
.Bboolwofi_mod_shift(void)
Returns true if the user was holding shift when selecting an entry, false otherwise.
.TP
.Bboolwofi_mod_control(void)
Returns true if the user was holding control when selecting an entry, false otherwise.
Runs the provided cmd in a terminal emulator. The following order is used for picking a terminal emulator: The user specified terminal, kitty, termite, alacritty, foot, gnome\-terminal, weston\-terminal. If none of these can be found execution will fail.