rofi 1.7.5
helper.h
Go to the documentation of this file.
1/*
2 * rofi
3 *
4 * MIT/X11 License
5 * Copyright © 2013-2022 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
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
208unsigned int levenshtein(const char *needle, const glong needlelen,
209 const char *haystack, const glong haystacklen);
210
220char *rofi_force_utf8(const gchar *data, ssize_t length);
221
230char *rofi_latin_to_utf8_strdup(const char *input, gssize length);
231
265int rofi_scorer_fuzzy_evaluate(const char *pattern, glong plen, const char *str,
266 glong slen);
280int utf8_strncmp(const char *a, const char *b, size_t n)
281 __attribute__((nonnull(1, 2)));
282
286typedef struct {
288 const gchar *name;
290 const gchar *binary;
292 const gchar *description;
294 const gchar *icon;
296 const gchar *app_id;
298 const gchar *wmclass;
300 const gchar *command;
302
314gboolean helper_execute(const char *wd, char **args, const char *error_precmd,
315 const char *error_cmd,
316 RofiHelperExecuteContext *context);
317
329gboolean helper_execute_command(const char *wd, const char *cmd,
330 gboolean run_in_term,
331 RofiHelperExecuteContext *context);
332
340cairo_surface_t *cairo_image_surface_create_from_svg(const gchar *file,
341 int height);
342
354void parse_ranges(char *input, rofi_range_pair **list, unsigned int *length);
355
374void rofi_output_formatted_line(const char *format, const char *string,
375 int selected_line, const char *filter);
376
392char *helper_string_replace_if_exists(char *string, ...);
393
400char *helper_get_theme_path(const char *file, const char *ext);
401
402G_END_DECLS
403
405#endif // ROFI_HELPER_H
char * rofi_latin_to_utf8_strdup(const char *input, gssize length)
Definition helper.c:808
void parse_ranges(char *input, rofi_range_pair **list, unsigned int *length)
Definition helper.c:1182
void cmd_set_arguments(int argc, char **argv)
Definition helper.c:70
rofi_int_matcher ** helper_tokenize(const char *input, int case_sensitive)
Definition helper.c:263
int find_arg_char(const char *const key, char *val)
Definition helper.c:408
gboolean helper_execute_command(const char *wd, const char *cmd, gboolean run_in_term, RofiHelperExecuteContext *context)
Definition helper.c:1030
void helper_tokenize_free(rofi_int_matcher **tokens)
Definition helper.c:119
char helper_parse_char(const char *arg)
Definition helper.c:360
void rofi_output_formatted_line(const char *format, const char *string, int selected_line, const char *filter)
Definition helper.c:1199
gboolean helper_execute(const char *wd, char **args, const char *error_precmd, const char *error_cmd, RofiHelperExecuteContext *context)
Definition helper.c:1002
unsigned int levenshtein(const char *needle, const glong needlelen, const char *haystack, const glong haystacklen)
Definition helper.c:772
char * helper_string_replace_if_exists(char *string,...)
Definition helper.c:1285
const char ** find_arg_strv(const char *const key)
Definition helper.c:321
int helper_parse_setup(char *string, char ***output, int *length,...)
Definition helper.c:75
char * helper_get_theme_path(const char *file, const char *ext)
Definition helper.c:1070
int execute_generator(const char *cmd) __attribute__((nonnull))
Definition helper.c:539
int find_arg_int(const char *const key, int *val)
Definition helper.c:341
char * rofi_expand_path(const char *input)
Definition helper.c:740
void remove_pid_file(int fd)
Definition helper.c:620
int rofi_scorer_fuzzy_evaluate(const char *pattern, glong plen, const char *str, glong slen)
Definition helper.c:920
int find_arg_str(const char *const key, char **val)
Definition helper.c:311
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 find_arg_uint(const char *const key, unsigned int *val)
Definition helper.c:350
int find_arg(const char *const key)
Definition helper.c:302
int helper_token_match(rofi_int_matcher *const *tokens, const char *input)
Definition helper.c:518
int create_pid_file(const char *pidfile, gboolean kill_running)
Definition helper.c:562
int config_sanity_check(void)
Definition helper.c:647
char * rofi_force_utf8(const gchar *data, ssize_t length)
Definition helper.c:814
char * pidfile
Definition rofi.c:81
const gchar * binary
Definition helper.h:290
const gchar * wmclass
Definition helper.h:298
const gchar * app_id
Definition helper.h:296
const gchar * description
Definition helper.h:292
const gchar * name
Definition helper.h:288
const gchar * icon
Definition helper.h:294
const gchar * command
Definition helper.h:300