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

NAME

6       wofi - API functions and documentation
7
8

DESCRIPTION

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

STRUCTURES

15       struct cache_line {
16           char* line;
17           struct wl_list link;
18       };
19
20

API FUNCTIONS

22       The following functions are used to interact with wofi.
23
24
25       char* wofi_parse_image_escapes(const char* text)
26              This function takes in text containing image escapes  and  pango
27              markup and will return the plain text with all of that stripped.
28              The string returned is newly allocated and should  be  freed  by
29              the caller when they are done with it.
30
31              const  char*  text - The input text containing image escapes and
32              pango markup.
33
34
35       void wofi_write_cache(struct mode* mode, const char* cmd)
36              Writes an entry to the cache file.
37
38              struct mode* mode - The struct mode* given to your mode's init()
39              function.
40
41              const  char* cmd - The entry to write to the cache file. If this
42              entry already exists the number of times  it  has  been  written
43              will be incremented.
44
45
46       void wofi_remove_cache(struct mode* mode, const char* cmd)
47              Removes an entry from the cache file.
48
49              struct mode* mode - The struct mode* given to your mode's init()
50              function.
51
52              const char* cmd - The entry to remove from the cache file.  This
53              does NOT decrement the number of times written, it fully removes
54              the entry.
55
56
57       struct wl_list* wofi_read_cache(struct mode* mode)
58              Reads the cache and returns a  struct  wl_list*  containing  the
59              entires.  The list is made up of struct cache_line* entries. The
60              wayland documentation should be referred to for the usage  of  a
61              wl_list.
62
63              struct mode* mode - The struct mode* given to your mode's init()
64              function.
65
66
67       struct widget*  wofi_create_widget(struct  mode*  mode,  char*  text[],
68       char* search_text, char* actions[], size_t action_count)
69              Creates  a  widget  from  the specified information. This widget
70              should be returned by the mode's get_widget() function in  order
71              to be displayed.
72
73              struct mode* mode - The struct mode* given to your mode's init()
74              function.
75
76              char* text[] - The array of text to  display  on  the  entry  in
77              wofi.  Each  element  in  the  array  represents  the text for 1
78              action. The array should only be larger than 1 if you're  creat‐
79              ing a multi-action entry. Multi-action entries need to provide 1
80              string for every action the entry has.
81
82              char* search_text - The text which the user can  search  for  to
83              find this widget.
84
85              char*  actions[] - The array of actions for the entry. An action
86              is the text given to a mode's  exec()  function  when  the  user
87              selects  an entry. Multi-action entries need to provide 1 action
88              string for every action the entry has.
89
90              size_t action_count - The number of actions the entry will have.
91
92
93       void wofi_insert_widgets(struct mode* mode)
94              This will requery the mode for more widgets.
95
96              struct mode* mode - The struct mode* given to your mode's init()
97              function.
98
99
100       bool wofi_allow_images(void)
101              Returns true if the user enabled images, false otherwise.
102
103
104       bool wofi_allow_markup(void)
105              Returns true if the user enabled pango markup, false otherwise.
106
107
108       uint64_t wofi_get_image_size(void)
109              Returns  the user specified image size, 32 by default. Wofi will
110              scale images for you, this is  just  informational  and  is  not
111              required but can be helpful if multiple sizes are available.
112
113
114       bool wofi_mod_shift(void)
115              Returns  true  if  the  user was holding shift when selecting an
116              entry, false otherwise.
117
118
119       bool wofi_mod_control(void)
120              Returns true if the user was holding control when  selecting  an
121              entry, false otherwise.
122
123
124       void wofi_term_run(const char* cmd)
125              Runs  the  provided  cmd  in  a terminal emulator. The following
126              order is used for picking a terminal emulator: The  user  speci‐
127              fied  terminal, kitty, termite, gnome-terminal, weston-terminal.
128              If none of these can be found execution will fail.
129
130              const char* cmd - The command to run, this is invoked  by  doing
131              term -- cmd.
132
133
134
135                                                                   wofi-api(3)
Impressum