Skip site navigation (1)Skip section navigation (2)

  
 
  

home | help
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.

     char* wofi_parse_image_escapes(const char* 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.

	    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  -  The struct mode* given to your mode's init()
	    function.

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

     void wofi_remove_cache(struct mode* mode, const char* cmd)
	    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 en-
	    try.

     struct wl_list* wofi_read_cache(struct mode* mode)
	    Reads the cache and returns a struct  wl_list*  containing	the  en-
	    tires.  The  list is made up of struct cache_line* entries. The way-
	    land 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.

     struct widget* wofi_create_widget(struct mode* mode, char* text[], char*
     search_text, char* actions[], size_t action_count)
	    Creates  a widget from the specified information. This widget should
	    be returned by the mode's get_widget() function in order to be  dis-
	    played.

	    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 ar-
	    ray should only be larger than 1 if you're creating  a  multi-action
	    entry.  Multi-action  entries need to provide 1 string for every ac-
	    tion 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.

     void wofi_insert_widgets(struct mode* mode)
	    This will requery the mode for more widgets.

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

     char* wofi_get_dso_path(struct mode* mode)
	    Returns  the  path	to this mode's DSO if it's an external mode, re-
	    turns NULL otherwise.

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

     bool wofi_allow_images(void)
	    Returns true if the user enabled images, false otherwise.

     bool wofi_allow_markup(void)
	    Returns true if the user enabled pango markup, false otherwise.

     uint64_t wofi_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.

     bool wofi_mod_shift(void)
	    Returns true if the user was holding shift when selecting an  entry,
	    false otherwise.

     bool wofi_mod_control(void)
	    Returns  true  if the user was holding control when selecting an en-
	    try, false otherwise.

     void wofi_term_run(const char* cmd)
	    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,  we-
	    ston-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.

     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 pass  EXIT_SUC-
	    CESS. If you call the libc exit() function then the custom exit code
	    will always be used even if an error should be reported

								     wofi-api(3)

Want to link to this manual page? Use this URL:
<https://man.freebsd.org/cgi/man.cgi?query=wofi-api&sektion=3&manpath=FreeBSD+Ports+15.1.quarterly>

home | help