Scroll to navigation

wofi-api(3) Library Functions Manual wofi-api(3)

NAME

wofi - API functions and documentation

DESCRIPTION

The functions documented here are used for interacting with wofi. They are defined in wofi_api.h.

STRUCTURES

struct cache_line {

char* line;
struct wl_list link;
};

API FUNCTIONS

The following functions are used to interact with wofi.

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.

const char* text - The input text containing image escapes and pango markup.

Writes an entry to the cache file.

struct mode* mode - The struct mode* given to your mode's init() function.

const char* cmd - The entry to write to the cache file. If this entry already exists the number of times it has been written will be incremented.

Removes an entry from the cache file.

struct mode* mode - The struct mode* given to your mode's init() function.

const char* cmd - The entry to remove from the cache file. This does NOT decrement the number of times written, it fully removes the entry.

Reads the cache and returns a struct wl_list* containing the entires. The list is made up of struct cache_line* entries. The wayland documentation should be referred to for the usage of a wl_list.

struct mode* mode - The struct mode* given to your mode's init() function.

Creates a widget from the specified information. This widget should be returned by the mode's get_widget() function in order to be displayed.

struct mode* mode - The struct mode* given to your mode's init() function.

char* 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.

char* search_text - The text which the user can search for to find this widget.

char* actions[] - The array of actions for the entry. An action is the text given to a mode's exec() function when the user selects an entry. Multi-action entries need to provide 1 action string for every action the entry has.

size_t action_count - The number of actions the entry will have.

This will requery the mode for more widgets.

struct mode* mode - The struct mode* given to your mode's init() function.

Returns the path to this mode's DSO if it's an external mode, returns NULL otherwise.

struct mode* mode - The struct mode* given to your mode's init() function.

Returns true if the user enabled images, false otherwise.

Returns true if the user enabled pango markup, false otherwise.

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.

Returns true if the user was holding shift when selecting an entry, false otherwise.

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, alacritty, wezterm, foot, termite, gnome-terminal, weston-terminal. If none of these can be found execution will fail.

const char* cmd - The command to run, this is invoked by doing term -- cmd.

This function is how you should call to exit wofi. It checks the status given and only sets a custom exit code if you pass EXIT_SUCCESS. If you call the libc exit() function then the custom exit code will always be used even if an error should be reported