rofi  1.5.4
script.c File Reference
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <strings.h>
#include <string.h>
#include <ctype.h>
#include <assert.h>
#include <errno.h>
#include "rofi.h"
#include "dialogs/script.h"
#include "helper.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, size_t length)
 
static void parse_header_entry (Mode *sw, char *line, ssize_t length)
 
static DmenuScriptEntryget_script_output (Mode *sw, char *command, char *arg, unsigned int *length)
 
static DmenuScriptEntryexecute_executor (Mode *sw, char *result, unsigned int *length)
 
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 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 30 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,
size_t  length 
)

Shared function between DMENU and Script mode.

Definition at line 78 of file script.c.

References DmenuScriptEntry::icon_name.

Referenced by get_script_output(), and read_add().

Here is the caller graph for this function:

◆ execute_executor()

static DmenuScriptEntry* execute_executor ( Mode sw,
char *  result,
unsigned int *  length 
)
static

Definition at line 194 of file script.c.

References rofi_mode::ed, and get_script_output().

Referenced by script_mode_result().

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

◆ get_script_output()

static DmenuScriptEntry* get_script_output ( Mode sw,
char *  command,
char *  arg,
unsigned int *  length 
)
static

Definition at line 129 of file script.c.

References dmenuscript_parse_entry_extras(), DmenuScriptEntry::entry, DmenuScriptEntry::icon_fetch_uid, DmenuScriptEntry::icon_name, parse_header_entry(), and rofi_view_error_dialog().

Referenced by execute_executor(), and script_mode_init().

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

◆ parse_header_entry()

static void parse_header_entry ( Mode sw,
char *  line,
ssize_t  length 
)
static

◆ script_get_icon()

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

Definition at line 323 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 318 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 219 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 210 of file script.c.

References ScriptModePrivateData::cmd_list, ScriptModePrivateData::cmd_list_length, rofi_mode::ed, get_script_output(), 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()

static ModeMode script_mode_result ( Mode sw,
int  mretv,
char **  input,
unsigned int  selected_line 
)
static

◆ script_switcher_free()

static void script_switcher_free ( Mode sw)
static

Definition at line 200 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 313 of file script.c.

References ScriptModePrivateData::cmd_list, DmenuScriptEntry::entry, helper_token_match(), 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: