rofi 1.7.9
helper.h
Go to the documentation of this file.
1/*
2 * rofi
3 *
4 * MIT/X11 License
5 * Copyright © 2013-2023 Qball Cow <qball@gmpclient.org>
6 *
7 * Permission is hereby granted, free of charge, to any person obtaining
8 * a copy of this software and associated documentation files (the
9 * "Software"), to deal in the Software without restriction, including
10 * without limitation the rights to use, copy, modify, merge, publish,
11 * distribute, sublicense, and/or sell copies of the Software, and to
12 * permit persons to whom the Software is furnished to do so, subject to
13 * the following conditions:
14 *
15 * The above copyright notice and this permission notice shall be
16 * included in all copies or substantial portions of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
21 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
22 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 *
26 */
27
28#ifndef ROFI_HELPER_H
29#define ROFI_HELPER_H
30#include "rofi-types.h"
31#include <cairo.h>
32G_BEGIN_DECLS
33
43
54int helper_parse_setup(char *string, char ***output, int *length, ...);
55
64rofi_int_matcher **helper_tokenize(const char *input, int case_sensitive);
65
72
82int find_arg_char(const char *const key, char *val);
83
92int find_arg_uint(const char *const key, unsigned int *val);
93
102int find_arg_int(const char *const key, int *val);
103
112int find_arg_str(const char *const key, char **val);
113
121const char **find_arg_strv(const char *const key);
129int find_arg(const char *const key);
130
139int helper_token_match(rofi_int_matcher *const *tokens, const char *input);
148int execute_generator(const char *cmd) __attribute__((nonnull));
149
156int create_pid_file(const char *pidfile, gboolean kill_running);
157
161void remove_pid_file(int fd);
162
170int config_sanity_check(void);
171
179char helper_parse_char(const char *arg);
180
187void cmd_set_arguments(int argc, char **argv);
188
196char *rofi_expand_path(const char *input);
197
209unsigned int levenshtein(const char *needle, const glong needlelen,
210 const char *haystack, const glong haystacklen,
211 const int case_sensitive);
212
222char *rofi_force_utf8(const gchar *data, ssize_t length);
223
232char *rofi_latin_to_utf8_strdup(const char *input, gssize length);
233
268int rofi_scorer_fuzzy_evaluate(const char *pattern, glong plen, const char *str,
269 glong slen, const int case_sensitive);
271
283int utf8_strncmp(const char *a, const char *b, size_t n)
284 __attribute__((nonnull(1, 2)));
285
289typedef struct {
291 const gchar *name;
293 const gchar *binary;
295 const gchar *description;
297 const gchar *icon;
299 const gchar *app_id;
301 const gchar *wmclass;
303 const gchar *command;
305
317gboolean helper_execute(const char *wd, char **args, const char *error_precmd,
318 const char *error_cmd,
319 RofiHelperExecuteContext *context);
320
332gboolean helper_execute_command(const char *wd, const char *cmd,
333 gboolean run_in_term,
334 RofiHelperExecuteContext *context);
335
343cairo_surface_t *cairo_image_surface_create_from_svg(const gchar *file,
344 int height);
345
349
357void parse_ranges(char *input, rofi_range_pair **list, unsigned int *length);
358
364int parse_case_sensitivity(const char *input);
365
384void rofi_output_formatted_line(const char *format, const char *string,
385 int selected_line, const char *filter);
386
402char *helper_string_replace_if_exists(char *string, ...);
403
414char *helper_get_theme_path(const char *file, const char **ext,
415 const char *parent_dir)
416 __attribute__((nonnull(1, 2)));
417
428ConfigEntry *rofi_config_find_widget(const char *name, const char *state,
429 gboolean exact);
430
444 const char *property, gboolean exact);
445
449const char *helper_get_matching_mode_str(void);
458
463#if __has_attribute(__fallthrough__)
464#define rofi_fallthrough __attribute__((__fallthrough__))
465#else
466#define rofi_fallthrough \
467 do { \
468 } while (0) /* fallthrough */
469#endif
470
471G_END_DECLS
472
474#endif // ROFI_HELPER_H
char * rofi_latin_to_utf8_strdup(const char *input, gssize length)
Definition helper.c:850
void parse_ranges(char *input, rofi_range_pair **list, unsigned int *length)
Definition helper.c:1276
void cmd_set_arguments(int argc, char **argv)
Definition helper.c:98
rofi_int_matcher ** helper_tokenize(const char *input, int case_sensitive)
Definition helper.c:287
unsigned int levenshtein(const char *needle, const glong needlelen, const char *haystack, const glong haystacklen, const int case_sensitive)
Definition helper.c:813
Property * rofi_theme_find_property(ConfigEntry *widget, PropertyType type, const char *property, gboolean exact)
Definition theme.c:743
int find_arg_char(const char *const key, char *val)
Definition helper.c:432
gboolean helper_execute_command(const char *wd, const char *cmd, gboolean run_in_term, RofiHelperExecuteContext *context)
Definition helper.c:1071
void helper_select_next_matching_mode(void)
Definition helper.c:84
void helper_tokenize_free(rofi_int_matcher **tokens)
Definition helper.c:147
char helper_parse_char(const char *arg)
Definition helper.c:384
void rofi_output_formatted_line(const char *format, const char *string, int selected_line, const char *filter)
Definition helper.c:1315
const char * helper_get_matching_mode_str(void)
Definition helper.c:81
gboolean helper_execute(const char *wd, char **args, const char *error_precmd, const char *error_cmd, RofiHelperExecuteContext *context)
Definition helper.c:1043
char * helper_get_theme_path(const char *file, const char **ext, const char *parent_dir) __attribute__((nonnull(1
char * helper_string_replace_if_exists(char *string,...)
Definition helper.c:1401
const char ** find_arg_strv(const char *const key)
Definition helper.c:345
char ConfigEntry * rofi_config_find_widget(const char *name, const char *state, gboolean exact)
Definition theme.c:780
int helper_parse_setup(char *string, char ***output, int *length,...)
Definition helper.c:103
int execute_generator(const char *cmd) __attribute__((nonnull))
Definition helper.c:563
void helper_select_previous_matching_mode(void)
Definition helper.c:90
int find_arg_int(const char *const key, int *val)
Definition helper.c:365
char * rofi_expand_path(const char *input)
Definition helper.c:781
void remove_pid_file(int fd)
Definition helper.c:645
int find_arg_str(const char *const key, char **val)
Definition helper.c:335
int utf8_strncmp(const char *a, const char *b, size_t n) __attribute__((nonnull(1
cairo_surface_t * cairo_image_surface_create_from_svg(const gchar *file, int height)
int parse_case_sensitivity(const char *input)
Definition helper.c:1294
int rofi_scorer_fuzzy_evaluate(const char *pattern, glong plen, const char *str, glong slen, const int case_sensitive)
Definition helper.c:962
int find_arg_uint(const char *const key, unsigned int *val)
Definition helper.c:374
int find_arg(const char *const key)
Definition helper.c:326
int helper_token_match(rofi_int_matcher *const *tokens, const char *input)
Definition helper.c:542
int create_pid_file(const char *pidfile, gboolean kill_running)
Definition helper.c:586
int config_sanity_check(void)
Definition helper.c:672
char * rofi_force_utf8(const gchar *data, ssize_t length)
Definition helper.c:856
struct _widget widget
Definition widget.h:51
ThemeWidget ConfigEntry
Definition rofi-types.h:346
PropertyType
Definition rofi-types.h:10
struct rofi_int_matcher_t rofi_int_matcher
char * pidfile
Definition rofi.c:78
const gchar * binary
Definition helper.h:293
const gchar * wmclass
Definition helper.h:301
const gchar * app_id
Definition helper.h:299
const gchar * description
Definition helper.h:295
const gchar * name
Definition helper.h:291
const gchar * icon
Definition helper.h:297
const gchar * command
Definition helper.h:303