wofi-api(3)
π wofi-api(3) β the manual, but make it bestie π
Library Functions Manual Β· wofi-api(3)
β¨ NAME β¨
wofi β API functions and documentation π«Ά
πΈ DESCRIPTION πΈ
okay so. the functions we're documenting right here are the ones you use to talk to wofi. they live in wofi_api.h, no cap. if you're writing a mode and you wanna vibe with wofi's internals, this is your girl. π
π STRUCTURES π
the one and only:
struct cache_line {
char* line;
struct wl_list link;
};
she's little, she's iconic, she's the building block of your cache reads. π
π API FUNCTIONS π
these are the functions you use to interact with wofi. go off, bestie.
char* wofi_parse_image_escapes(const char* text)β so you hand her sometextthat's full of image escapes and pango markup, and she hands you back the plain text with all of that stripped out. the string you get back is newly allocated, so the caller (that's you, babe) has tofreeit when you're done. don't leak her, she deserves better. πconst char* textβ the input text containing image escapes and pango markup.
void wofi_write_cache(struct mode* mode, const char* cmd)β writes an entry to the cache file. βοΈstruct mode* modeβ thestruct mode*given to your mode'sinit()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 gets incremented. so it's not just "added", it's counted. π
void wofi_remove_cache(struct mode* mode, const char* cmd)β removes an entry from the cache file. ποΈstruct mode* modeβ thestruct mode*given to your mode'sinit()function.const char* cmdβ the entry to remove from the cache file.
β οΈ listen. this does NOT decrement the number of times written. it fully removes the entry. she's gone. periodt. π
struct wl_list* wofi_read_cache(struct mode* mode)β reads the cache and returns astruct wl_list*containing the entries. that list is made up ofstruct cache_line*entries, and for how to actually use awl_listyou should go read the wayland documentation. not me outsourcing the wl_list lore but here we are. π¦struct mode* modeβ thestruct mode*given to your mode'sinit()function.
struct widget* wofi_create_widget(struct mode* mode, char* text[], char* search_text, char* actions[], size_t action_count)β creates a widget from all the info you give her. π and then β important β this widget should be returned by the mode'sget_widget()function so it actually shows up on screen. no returning it = no display, that's the whole vibe check. πstruct mode* modeβ thestruct mode*given to your mode'sinit()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. and multi-action entries need to provide 1 string for every action the entry has. one string per action, no skipping. π―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'sexec()function when the user selects an entry. multi-action entries need to provide 1 action string for every action the entry has. (see? one per action again. consistency slay.) β¨size_t action_countβ the number of actions the entry will have.
void wofi_insert_widgets(struct mode* mode)β this will requery the mode for more widgets. more widgets, more life. π§struct mode* modeβ thestruct mode*given to your mode'sinit()function.
char* wofi_get_dso_path(struct mode* mode)β returns the path to this mode's DSO if it's an external mode. returnsNULLotherwise. so likeβ¦ internal modes, y'all get nothing, sorry bestie. πstruct mode* modeβ thestruct mode*given to your mode'sinit()function.
bool wofi_allow_images(void)β returnstrueif the user enabled images,falseotherwise. πΌοΈbool wofi_allow_markup(void)β returnstrueif the user enabled pango markup,falseotherwise. π¨uint64_t wofi_get_image_size(void)β returns the user specified image size,32by default. wofi will scale images for you, so this is just informational and is not required β but it's lowkey helpful if multiple sizes are available. πbool wofi_mod_shift(void)β returnstrueif the user was holding shift when selecting an entry,falseotherwise. π«Άbool wofi_mod_control(void)β returnstrueif the user was holding control when selecting an entry,falseotherwise. πvoid wofi_term_run(const char* cmd)β runs the providedcmdin a terminal emulator. π₯οΈ and the order she uses for picking a terminal emulator is, in order:- the user specified terminal
kittyalacrittyweztermfoottermitegnome-terminalweston-terminal
if none of these can be found, execution will fail. that's it, that's the list, that's the whole rollout. π
const char* cmdβ the command to run. this is invoked by doingterm -- cmd.
void wofi_exit(void)β this function is how you should call to exit wofi. πͺβ¨ it checks the status given and only sets a custom exit code if you passEXIT_SUCCESS.
β οΈ real talk: if you call the libc exit() function instead, then the custom exit code will always be used, even if an error should be reported. so don't do that, use this one, she knows what she's doing. π₯
and that's the whole page, bestie!! π this was wofi-api(3) from the Library Functions Manual β go build something iconic with it, mwah π ππ¦π
π¦ where this page comes from
- alpine 3.24: wofi-doc 1.5.3-r0 Β· GPL-3.0-only
- arch rolling: wofi 1.5.3-1 Β· GPL-3.0-or-later
- debian trixie: wofi 1.4.1-1+b2 Β· GPL-3.0-or-later
- fedora 43: wofi-devel 1.4.1-7.fc43 Β· GPL-3.0-only
- fedora 43: wofi-devel 1.4.1-7.fc43 Β· GPL-3.0-only
- fedora 43: wofi-devel 1.5.3-1.fc43 Β· GPL-3.0-only
- fedora 43: wofi-devel 1.5.3-1.fc43 Β· GPL-3.0-only
- fedora 44: wofi-devel 1.5.3-2.fc44 Β· GPL-3.0-only
- fedora 44: wofi-devel 1.5.3-2.fc44 Β· GPL-3.0-only
- nixos 26.05: wofi 1.5.3
- nixpkgs unstable: wofi 1.5.3
- opensuse-leap 16.0: wofi 1.4.1-bp160.1.13 Β· GPL-3.0-only
- opensuse-leap 16.0: wofi 1.4.1-bp160.1.13 Β· GPL-3.0-only
- opensuse-leap 16.0: wofi 1.4.1-bp160.1.13 Β· GPL-3.0-only
- opensuse-leap 16.0: wofi 1.4.1-bp160.1.13 Β· GPL-3.0-only
- ubuntu noble: wofi 1.4.1-1build2 Β· GPL-3.0-or-later
- ubuntu questing: wofi 1.4.1-1build2
- ubuntu resolute: wofi 1.5.1-1 Β· GPL-3.0-or-later
- ubuntu stonking: wofi 1.5.3-1 Β· GPL-3.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms