rofi 1.7.5
script.c File Reference
#include "modes/script.h"
#include "helper.h"
#include "rofi.h"
#include <assert.h>
#include <ctype.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h>
#include <unistd.h>
#include "widgets/textbox.h"
#include "mode-private.h"
#include "rofi-icon-fetcher.h"
#include "modes/dmenuscriptshared.h"
Include dependency graph for script.c:

Go to the source code of this file.

Data Structures

struct  ScriptModePrivateData
 
struct  ScriptUser
 

Macros

#define G_LOG_DOMAIN   "Modes.Script"
 

Typedefs

typedef struct ScriptUser ScriptUser
 

Functions

void dmenuscript_parse_entry_extras (G_GNUC_UNUSED Mode *sw, DmenuScriptEntry *entry, char *buffer, G_GNUC_UNUSED size_t length)
 
static void parse_header_entry (Mode *sw, char *line, ssize_t length)
 
static DmenuScriptEntryexecute_executor (Mode *sw, char *arg, unsigned int *length, int value, DmenuScriptEntry *entry)
 
static void script_switcher_free (Mode *sw)
 
static int script_mode_init (Mode *sw)
 
static unsigned int script_mode_get_num_entries (const Mode *sw)
 
static void script_mode_reset_highlight (Mode *sw)
 
static ModeMode script_mode_result (Mode *sw, int mretv, char **input, unsigned int selected_line)
 
static void script_mode_destroy (Mode *sw)
 
static unsigned int get_index (unsigned int length, int index)
 
static char * _get_display_value (const Mode *sw, unsigned int selected_line, G_GNUC_UNUSED int *state, G_GNUC_UNUSED GList **list, int get_entry)
 
static int script_token_match (const Mode *sw, rofi_int_matcher **tokens, unsigned int index)
 
static char * script_get_message (const Mode *sw)
 
static cairo_surface_t * script_get_icon (const Mode *sw, unsigned int selected_line, unsigned int height)
 
void script_mode_cleanup (void)
 
void script_mode_gather_user_scripts (void)
 
static int script_mode_has_user_script (char const *const user)
 
Modescript_mode_parse_setup (const char *str)
 
gboolean script_mode_is_valid (const char *token)
 
void script_user_list (gboolean is_term)
 

Variables

ScriptUseruser_scripts = NULL
 
size_t num_scripts = 0
 

Macro Definition Documentation

◆ G_LOG_DOMAIN

#define G_LOG_DOMAIN   "Modes.Script"

The log domain of this dialog.

Definition at line 29 of file script.c.

Typedef Documentation

◆ ScriptUser

typedef struct ScriptUser ScriptUser

Function Documentation

◆ _get_display_value()

static char * _get_display_value ( const Mode * sw,
unsigned int selected_line,
G_GNUC_UNUSED int * state,
G_GNUC_UNUSED GList ** list,
int get_entry )
static

◆ dmenuscript_parse_entry_extras()

void dmenuscript_parse_entry_extras ( G_GNUC_UNUSED Mode * sw,
DmenuScriptEntry * entry,
char * buffer,
G_GNUC_UNUSED size_t length )

Shared function between DMENU and Script mode.

Definition at line 82 of file script.c.

References DmenuScriptEntry::icon_name, DmenuScriptEntry::info, DmenuScriptEntry::meta, and DmenuScriptEntry::nonselectable.

Referenced by execute_executor(), read_add(), and read_add_block().

Here is the caller graph for this function:

◆ execute_executor()

◆ get_index()

static unsigned int get_index ( unsigned int length,
int index )
inlinestatic

Definition at line 386 of file script.c.

Referenced by _get_display_value().

Here is the caller graph for this function:

◆ parse_header_entry()

◆ script_get_icon()

static cairo_surface_t * script_get_icon ( const Mode * sw,
unsigned int selected_line,
unsigned int height )
static

Definition at line 446 of file script.c.

References ScriptModePrivateData::cmd_list, DmenuScriptEntry::icon_fetch_size, DmenuScriptEntry::icon_fetch_uid, DmenuScriptEntry::icon_name, mode_get_private_data(), rofi_icon_fetcher_get(), and rofi_icon_fetcher_query().

Referenced by script_mode_parse_setup().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ script_get_message()

static char * script_get_message ( const Mode * sw)
static

Definition at line 442 of file script.c.

References ScriptModePrivateData::message, and rofi_mode::private_data.

Referenced by script_mode_parse_setup().

Here is the caller graph for this function:

◆ script_mode_destroy()

◆ script_mode_get_num_entries()

static unsigned int script_mode_get_num_entries ( const Mode * sw)
static

Definition at line 278 of file script.c.

References ScriptModePrivateData::cmd_list_length, and rofi_mode::private_data.

Referenced by script_mode_parse_setup().

Here is the caller graph for this function:

◆ script_mode_has_user_script()

static int script_mode_has_user_script ( char const *const user)
static

Definition at line 509 of file script.c.

References num_scripts, and user_scripts.

Referenced by script_mode_is_valid(), and script_mode_parse_setup().

Here is the caller graph for this function:

◆ script_mode_init()

static int script_mode_init ( Mode * sw)
static

Definition at line 269 of file script.c.

References ScriptModePrivateData::cmd_list, ScriptModePrivateData::cmd_list_length, ScriptModePrivateData::delim, execute_executor(), and rofi_mode::private_data.

Referenced by script_mode_parse_setup().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ script_mode_reset_highlight()

static void script_mode_reset_highlight ( Mode * sw)
static

◆ script_mode_result()

◆ script_switcher_free()

static void script_switcher_free ( Mode * sw)
static

Definition at line 260 of file script.c.

References rofi_mode::ed, and rofi_mode::name.

Referenced by script_mode_parse_setup().

Here is the caller graph for this function:

◆ script_token_match()

static int script_token_match ( const Mode * sw,
rofi_int_matcher ** tokens,
unsigned int index )
static

Definition at line 422 of file script.c.

References ScriptModePrivateData::cmd_list, DmenuScriptEntry::entry, helper_token_match(), DmenuScriptEntry::meta, and rofi_mode::private_data.

Referenced by script_mode_parse_setup().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ num_scripts

size_t num_scripts = 0

◆ user_scripts