rofi  1.7.0
script.c File Reference
#include "dialogs/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 "dialogs/dmenuscriptshared.h"
Include dependency graph for script.c:

Go to the source code of this file.

Data Structures

struct  ScriptModePrivateData
 

Macros

#define G_LOG_DOMAIN   "Dialogs.Script"
 

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, int height)
 
Modescript_switcher_parse_setup (const char *str)
 
gboolean script_switcher_is_valid (const char *token)
 

Macro Definition Documentation

◆ G_LOG_DOMAIN

#define G_LOG_DOMAIN   "Dialogs.Script"

The log domain of this dialog.

Definition at line 29 of file script.c.

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 79 of file script.c.

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

Referenced by execute_executor(), and read_add().

Here is the caller graph for this function:

◆ execute_executor()

static DmenuScriptEntry* execute_executor ( Mode sw,
char *  arg,
unsigned int *  length,
int  value,
DmenuScriptEntry entry 
)
static

Definition at line 141 of file script.c.

References ScriptModePrivateData::delim, dmenuscript_parse_entry_extras(), rofi_mode::ed, DmenuScriptEntry::info, parse_header_entry(), rofi_mode::private_data, and rofi_view_error_dialog().

Referenced by script_mode_init(), and script_mode_result().

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

◆ get_index()

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

Definition at line 345 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,
int  height 
)
static

Definition at line 406 of file script.c.

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

Referenced by script_switcher_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 401 of file script.c.

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

Referenced by script_switcher_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 251 of file script.c.

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

Referenced by script_switcher_parse_setup().

Here is the caller graph for this function:

◆ script_mode_init()

static int script_mode_init ( Mode sw)
static

Definition at line 242 of file script.c.

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

Referenced by script_switcher_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 233 of file script.c.

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

Referenced by script_switcher_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 381 of file script.c.

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

Referenced by script_switcher_parse_setup().

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