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 en‐
59              tires.  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 ac‐
78              tion. The array should only be larger than 1 if you're  creating
79              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  se‐
87              lects  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       char* wofi_get_dso_path(struct mode* mode)
101              Returns  the  path  to this mode's DSO if it's an external mode,
102              returns NULL otherwise.
103
104              struct mode* mode - The struct mode* given to your mode's init()
105              function.
106
107
108       bool wofi_allow_images(void)
109              Returns true if the user enabled images, false otherwise.
110
111
112       bool wofi_allow_markup(void)
113              Returns true if the user enabled pango markup, false otherwise.
114
115
116       uint64_t wofi_get_image_size(void)
117              Returns  the user specified image size, 32 by default. Wofi will
118              scale images for you, this is just informational and is not  re‐
119              quired but can be helpful if multiple sizes are available.
120
121
122       bool wofi_mod_shift(void)
123              Returns true if the user was holding shift when selecting an en‐
124              try, false otherwise.
125
126
127       bool wofi_mod_control(void)
128              Returns true if the user was holding control when  selecting  an
129              entry, false otherwise.
130
131
132       void wofi_term_run(const char* cmd)
133              Runs  the provided cmd in a terminal emulator. The following or‐
134              der is used for picking a terminal emulator: The user  specified
135              terminal,  kitty,  termite, alacritty, foot, gnome-terminal, we‐
136              ston-terminal. If none of these  can  be  found  execution  will
137              fail.
138
139              const  char*  cmd - The command to run, this is invoked by doing
140              term -- cmd.
141
142
143
144                                                                   wofi-api(3)
Impressum