rofi  1.5.4
dmenu.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 <stdint.h>
#include <errno.h>
#include <gio/gio.h>
#include <gio/gunixinputstream.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include "rofi.h"
#include "settings.h"
#include "widgets/textbox.h"
#include "dialogs/dmenu.h"
#include "helper.h"
#include "xrmoptions.h"
#include "view.h"
#include "rofi-icon-fetcher.h"
#include "dialogs/dmenuscriptshared.h"
#include "mode-private.h"
Include dependency graph for dmenu.c:

Go to the source code of this file.

Data Structures

struct  DmenuModePrivateData
 

Macros

#define G_LOG_DOMAIN   "Dialogs.DMenu"
 

Functions

static unsigned int bitget (uint32_t *array, unsigned int index)
 
static void bittoggle (uint32_t *array, unsigned int index)
 
static void async_close_callback (GObject *source_object, GAsyncResult *res, G_GNUC_UNUSED gpointer user_data)
 
static void read_add (DmenuModePrivateData *pd, char *data, gsize len)
 
static void async_read_callback (GObject *source_object, GAsyncResult *res, gpointer user_data)
 
static void async_read_cancel (G_GNUC_UNUSED GCancellable *cancel, G_GNUC_UNUSED gpointer data)
 
static int get_dmenu_async (DmenuModePrivateData *pd, int sync_pre_read)
 
static void get_dmenu_sync (DmenuModePrivateData *pd)
 
static unsigned int dmenu_mode_get_num_entries (const Mode *sw)
 
static gchar * dmenu_format_output_string (const DmenuModePrivateData *pd, const char *input)
 
static char * get_display_data (const Mode *data, unsigned int index, int *state, G_GNUC_UNUSED GList **list, int get_entry)
 
static void dmenu_mode_free (Mode *sw)
 
static int dmenu_mode_init (Mode *sw)
 
static int dmenu_token_match (const Mode *sw, rofi_int_matcher **tokens, unsigned int index)
 
static char * dmenu_get_message (const Mode *sw)
 
static cairo_surface_t * dmenu_get_icon (const Mode *sw, unsigned int selected_line, int height)
 
static void dmenu_finish (RofiViewState *state, int retv)
 
static void dmenu_print_results (DmenuModePrivateData *pd, const char *input)
 
static void dmenu_finalize (RofiViewState *state)
 
int dmenu_switcher_dialog (void)
 
void print_dmenu_options (void)
 

Variables

Mode dmenu_mode
 

Macro Definition Documentation

◆ G_LOG_DOMAIN

#define G_LOG_DOMAIN   "Dialogs.DMenu"

The log domain of this dialog.

Definition at line 30 of file dmenu.c.

Function Documentation

◆ async_close_callback()

static void async_close_callback ( GObject *  source_object,
GAsyncResult *  res,
G_GNUC_UNUSED gpointer  user_data 
)
static

Definition at line 103 of file dmenu.c.

Referenced by async_read_callback(), get_dmenu_async(), and get_dmenu_sync().

Here is the caller graph for this function:

◆ async_read_callback()

static void async_read_callback ( GObject *  source_object,
GAsyncResult *  res,
gpointer  user_data 
)
static

Definition at line 130 of file dmenu.c.

References async_close_callback(), DmenuModePrivateData::cancel, DmenuModePrivateData::data_input_stream, read_add(), rofi_view_get_active(), rofi_view_reload(), rofi_view_set_overlay(), and DmenuModePrivateData::separator.

Referenced by get_dmenu_async().

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

◆ async_read_cancel()

static void async_read_cancel ( G_GNUC_UNUSED GCancellable *  cancel,
G_GNUC_UNUSED gpointer  data 
)
static

Definition at line 173 of file dmenu.c.

Referenced by dmenu_mode_init().

Here is the caller graph for this function:

◆ bitget()

static unsigned int bitget ( uint32_t *  array,
unsigned int  index 
)
inlinestatic

Definition at line 56 of file dmenu.c.

Referenced by dmenu_finalize(), dmenu_print_results(), and get_display_data().

Here is the caller graph for this function:

◆ bittoggle()

static void bittoggle ( uint32_t *  array,
unsigned int  index 
)
inlinestatic

Definition at line 63 of file dmenu.c.

Referenced by dmenu_finalize().

Here is the caller graph for this function:

◆ dmenu_finalize()

◆ dmenu_finish()

static void dmenu_finish ( RofiViewState state,
int  retv 
)
static

Definition at line 435 of file dmenu.c.

References dmenu_mode, mode_destroy(), rofi_set_return_code(), rofi_view_free(), and rofi_view_set_active().

Referenced by dmenu_finalize().

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

◆ dmenu_format_output_string()

static gchar* dmenu_format_output_string ( const DmenuModePrivateData pd,
const char *  input 
)
static

Definition at line 216 of file dmenu.c.

References DmenuModePrivateData::column_separator, and DmenuModePrivateData::columns.

Referenced by get_display_data().

Here is the caller graph for this function:

◆ dmenu_get_icon()

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

◆ dmenu_get_message()

static char* dmenu_get_message ( const Mode sw)
static

Definition at line 391 of file dmenu.c.

References DmenuModePrivateData::message, and mode_get_private_data().

Here is the call graph for this function:

◆ dmenu_mode_free()

◆ dmenu_mode_get_num_entries()

static unsigned int dmenu_mode_get_num_entries ( const Mode sw)
static

Definition at line 210 of file dmenu.c.

References DmenuModePrivateData::cmd_list_length, and mode_get_private_data().

Here is the call graph for this function:

◆ dmenu_mode_init()

◆ dmenu_print_results()

static void dmenu_print_results ( DmenuModePrivateData pd,
const char *  input 
)
static

◆ dmenu_token_match()

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

Definition at line 386 of file dmenu.c.

References DmenuModePrivateData::cmd_list, DmenuScriptEntry::entry, helper_token_match(), and mode_get_private_data().

Here is the call graph for this function:

◆ get_display_data()

static char* get_display_data ( const Mode data,
unsigned int  index,
int *  state,
G_GNUC_UNUSED GList **  list,
int  get_entry 
)
static

◆ get_dmenu_async()

static int get_dmenu_async ( DmenuModePrivateData pd,
int  sync_pre_read 
)
static

Definition at line 178 of file dmenu.c.

References async_close_callback(), async_read_callback(), DmenuModePrivateData::cancel, DmenuModePrivateData::data_input_stream, DmenuModePrivateData::input_stream, read_add(), and DmenuModePrivateData::separator.

Referenced by dmenu_switcher_dialog().

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

◆ get_dmenu_sync()

static void get_dmenu_sync ( DmenuModePrivateData pd)
static

Definition at line 195 of file dmenu.c.

References async_close_callback(), DmenuModePrivateData::cancel, DmenuModePrivateData::data_input_stream, DmenuModePrivateData::input_stream, read_add(), and DmenuModePrivateData::separator.

Referenced by dmenu_switcher_dialog().

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

◆ read_add()

static void read_add ( DmenuModePrivateData pd,
char *  data,
gsize  len 
)
static

Variable Documentation

◆ dmenu_mode

Mode dmenu_mode
Initial value:
=
{
.name = "dmenu",
.cfg_name_key = "display-combi",
._init = dmenu_mode_init,
._get_num_entries = dmenu_mode_get_num_entries,
._result = NULL,
._destroy = dmenu_mode_free,
._token_match = dmenu_token_match,
._get_display_value = get_display_data,
._get_icon = dmenu_get_icon,
._get_completion = NULL,
._preprocess_input = NULL,
._get_message = dmenu_get_message,
.private_data = NULL,
.free = NULL,
.display_name = "dmenu"
}

dmenu Mode object.

Definition at line 416 of file dmenu.c.

Referenced by dmenu_finish(), and dmenu_switcher_dialog().

get_display_data
static char * get_display_data(const Mode *data, unsigned int index, int *state, G_GNUC_UNUSED GList **list, int get_entry)
Definition: dmenu.c:244
dmenu_mode_free
static void dmenu_mode_free(Mode *sw)
Definition: dmenu.c:268
dmenu_mode_init
static int dmenu_mode_init(Mode *sw)
Definition: dmenu.c:306
dmenu_token_match
static int dmenu_token_match(const Mode *sw, rofi_int_matcher **tokens, unsigned int index)
Definition: dmenu.c:386
dmenu_get_icon
static cairo_surface_t * dmenu_get_icon(const Mode *sw, unsigned int selected_line, int height)
Definition: dmenu.c:399
dmenu_get_message
static char * dmenu_get_message(const Mode *sw)
Definition: dmenu.c:391
dmenu_mode_get_num_entries
static unsigned int dmenu_mode_get_num_entries(const Mode *sw)
Definition: dmenu.c:210