1wofi(3)                    Library Functions Manual                    wofi(3)
2
3
4

NAME

6       wofi - Mode functions and documentation
7
8

DESCRIPTION

10       Wofi provides a C API which can be used for developing 3rd party modes.
11       These modes should be compiled to  a  shared  object  which  should  be
12       placed  in  $XDG_CONFIG_HOME/wofi/plugins.  If  $XDG_CONFIG_HOME is not
13       defined then it will default to ~/.config.
14
15       It is very important to note that this API is not stable.  It's  mostly
16       stable however if something comes up that requires a substantial change
17       things will be changed. This shouldn't happen too much but has happened
18       in the past and might in the future.
19
20

HEADER FILES

22       There  are  2  header  files  required  in  order  to use the wofi API,
23       wofi_api.h and map.h. utils.h might be useful to include if you want  a
24       few  helper functions but it is not required. utils.h will not be docu‐
25       mented here as it's outside the scope of the mode API.
26
27

MODE FUNCTIONS

29       The following list of functions are the functions which can be  defined
30       inside of your mode which will be called to do setup, and acquire vari‐
31       ous pieces of information from the mode.
32
33
34       void init(struct mode* mode, struct map* config)
35              Definining this function is required. This function is called to
36              setup  your  plugin  and provide it with serveral pointers which
37              are described below.
38
39              struct mode* mode - used to identify your mode, it is passed  to
40              a large number of the API functions to identify your mode.
41
42              struct  map*  config  -  all of the config options that the user
43              defined for your mode. Information on how to access this can  be
44              found in wofi-map(3).
45
46
47       const char** get_arg_names(void)
48              Definining this function is optional. This function is called to
49              get an array of config options which can be set by the user. All
50              of  these  options  have  the  name of your mode prefixed on the
51              front so if your array is for example {"opt1", "opt2"} the  con‐
52              fig  options defined will be mode-opt1=value and mode-opt2=value
53              where mode is the name of the shared object.
54
55
56       size_t get_arg_count(void)
57              Definining this function is optional. This function is called to
58              get the number of arguments returned by get_arg_names(void).
59
60
61       void exec(const char* cmd)
62              Definining  this  function  is required. This function is called
63              when the user selects an entry.
64
65              const char* cmd - The action registered to the  selected  entry.
66              If  your  mode allows executing searches directly then this will
67              be the search contents if no matching entries exist.
68
69
70       struct widget* get_widget(void)
71              Definining this function is optional. This function is called to
72              request the next widget to be added. See wofi_create_widget() in
73              wofi-api(3) on how to obtain a struct widget*.  NULL  should  be
74              returned to denote no more widgets are available.
75
76
77       bool no_entry(void)
78              Definining this function is optional. This function is called to
79              find out whether or not  this  mode  supports  running  searches
80              without  any matching entries. The default is false, if you wish
81              to allow your mode to take searches  directly  you  must  define
82              this and return true.
83
84
85
86                                                                       wofi(3)
Impressum