rofi 1.7.9
theme.h File Reference
#include "rofi-types.h"
#include <cairo.h>
#include <glib.h>
#include <widgets/widget.h>
Include dependency graph for theme.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

ThemeWidgetrofi_theme_find_or_create_name (ThemeWidget *base, const char *name)
void rofi_theme_print (ThemeWidget *widget)
void rofi_theme_print_index (ThemeWidget *widget, int index)
Propertyrofi_theme_property_create (PropertyType type)
void rofi_theme_property_free (Property *p)
Propertyrofi_theme_property_copy (const Property *p, G_GNUC_UNUSED void *)
void rofi_theme_free (ThemeWidget *widget)
gboolean rofi_theme_parse_file (const char *file)
gboolean rofi_theme_parse_string (const char *string)
void rofi_theme_widget_add_properties (ThemeWidget *widget, GHashTable *table)
RofiDistance rofi_theme_get_distance (const widget *widget, const char *property, int def)
int rofi_theme_get_integer (const widget *widget, const char *property, int def)
int rofi_theme_get_position (const widget *widget, const char *property, int def)
int rofi_theme_get_boolean (const widget *widget, const char *property, int def)
RofiOrientation rofi_theme_get_orientation (const widget *widget, const char *property, RofiOrientation def)
RofiCursorType rofi_theme_get_cursor_type (const widget *widget, const char *property, RofiCursorType def)
const char * rofi_theme_get_string (const widget *widget, const char *property, const char *def)
double rofi_theme_get_double (const widget *widget, const char *property, double def)
void rofi_theme_get_color (const widget *widget, const char *property, cairo_t *d)
gboolean rofi_theme_get_image (const widget *widget, const char *property, cairo_t *d)
gboolean rofi_theme_has_property (const widget *widget, const char *property)
RofiPadding rofi_theme_get_padding (const widget *widget, const char *property, RofiPadding pad)
RofiHighlightColorStyle rofi_theme_get_highlight (widget *widget, const char *property, RofiHighlightColorStyle th)
int distance_get_pixel (RofiDistance d, RofiOrientation ori)
void distance_get_linestyle (RofiDistance d, cairo_t *draw)
ThemeWidgetrofi_theme_find_widget (const char *name, const char *state, gboolean exact)
void rofi_theme_reset (void)
char * rofi_theme_parse_prepare_file (const char *file)
void rofi_theme_parse_process_conditionals (void)
void rofi_theme_parse_process_links (void)
void rofi_theme_parse_merge_widgets (ThemeWidget *parent, ThemeWidget *child)
ThemeMediaType rofi_theme_parse_media_type (const char *type)
RofiDistance rofi_theme_property_copy_distance (RofiDistance const distance)
int rofi_theme_rasi_validate (const char *filename)
void rofi_theme_free_parsed_files (void)
void rofi_theme_print_parsed_files (int is_term)
GList * rofi_theme_get_list_distance (const widget *widget, const char *property)
GList * rofi_theme_get_list_strings (const widget *widget, const char *property)

Variables

ThemeWidgetrofi_theme
ThemeWidgetrofi_configuration

Function Documentation

◆ distance_get_linestyle()

void distance_get_linestyle ( RofiDistance d,
cairo_t * draw )
Parameters
dThe distance handle.
drawThe cairo drawable.

Set linestyle.

Definition at line 1409 of file theme.c.

References ROFI_HL_DASH, and RofiDistance::style.

Referenced by widget_draw().

Here is the caller graph for this function:

◆ distance_get_pixel()

◆ rofi_theme_find_or_create_name()

ThemeWidget * rofi_theme_find_or_create_name ( ThemeWidget * base,
const char * name )
Parameters
baseHandle to the current level in the theme.
nameName of the new element.

Create a new element in the theme structure.

Returns
handle to the new entry.

Definition at line 81 of file theme.c.

References ThemeWidget::name, ThemeWidget::num_widgets, ThemeWidget::parent, and ThemeWidget::widgets.

Referenced by dmenu_mode_init(), and rofi_theme_parse_merge_widgets().

Here is the caller graph for this function:

◆ rofi_theme_find_widget()

ThemeWidget * rofi_theme_find_widget ( const char * name,
const char * state,
gboolean exact )

◆ rofi_theme_free()

void rofi_theme_free ( ThemeWidget * widget)
Parameters
widget

Free the widget and alll children.

Definition at line 240 of file theme.c.

References ThemeWidget::media, ThemeWidget::name, ThemeWidget::num_widgets, ThemeWidget::properties, rofi_theme_free(), and ThemeWidget::widgets.

Referenced by cleanup(), main(), rofi_theme_free(), rofi_theme_parse_process_conditionals_int(), and rofi_theme_reset().

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

◆ rofi_theme_free_parsed_files()

void rofi_theme_free_parsed_files ( void )

Free memory.

cleanup (free) the list of parsed config files.

Definition at line 54 of file theme.c.

References parsed_config_files.

Referenced by cleanup().

Here is the caller graph for this function:

◆ rofi_theme_get_boolean()

int rofi_theme_get_boolean ( const widget * widget,
const char * property,
int def )
Parameters
widgetThe widget to query
propertyThe property to query.
defThe default value.

Obtain the boolean of the widget.

Returns
The boolean value of this property for this widget.

Definition at line 901 of file theme.c.

References _widget::name, P_BOOLEAN, rofi_theme_find_property(), rofi_theme_find_widget(), rofi_theme_get_boolean_inside(), and _widget::state.

Referenced by __create_window(), box_add(), icon_create(), listview_create(), scrollbar_draw(), textbox_create(), textbox_draw(), and widget_init().

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

◆ rofi_theme_get_color()

void rofi_theme_get_color ( const widget * widget,
const char * property,
cairo_t * d )
Parameters
widgetThe widget to query
propertyThe property to query.
dThe drawable to apply color.

Obtain the color of the widget and applies this to the drawable d.

Definition at line 1065 of file theme.c.

References _widget::name, P_COLOR, rofi_theme_find_property(), rofi_theme_find_widget(), rofi_theme_get_color_inside(), and _widget::state.

Referenced by scrollbar_draw(), textbox_draw(), and widget_draw().

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

◆ rofi_theme_get_cursor_type()

RofiCursorType rofi_theme_get_cursor_type ( const widget * widget,
const char * property,
RofiCursorType def )
Parameters
widgetThe widget to query
propertyThe property to query.
defThe default value.

Obtain the cursor indicated by property of the widget.

Returns
The cursor for this widget or def if not found.

Definition at line 960 of file theme.c.

References _widget::name, P_CURSOR, rofi_theme_find_property(), rofi_theme_find_widget(), rofi_theme_get_cursor_type_inside(), and _widget::state.

Referenced by widget_init().

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

◆ rofi_theme_get_distance()

RofiDistance rofi_theme_get_distance ( const widget * widget,
const char * property,
int def )

Public API

Parameters
widgetThe widget to query
propertyThe property to query.
defThe default value.

Obtain the distance of the widget.

Returns
The distance value of this property for this widget.

Definition at line 875 of file theme.c.

References _widget::name, P_PADDING, rofi_theme_find_property(), rofi_theme_find_widget(), rofi_theme_get_distance_inside(), and _widget::state.

Referenced by box_create(), box_get_desired_width(), icon_create(), listview_create(), rofi_view_calculate_height(), rofi_view_calculate_window_position(), rofi_view_calculate_window_width(), scrollbar_create(), textbox_draw(), and textbox_get_desired_width().

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

◆ rofi_theme_get_double()

double rofi_theme_get_double ( const widget * widget,
const char * property,
double def )
Parameters
widgetThe widget to query
propertyThe property to query.
defThe default value.

Obtain the double of the widget.

Returns
The double value of this property for this widget.

Definition at line 1038 of file theme.c.

References _widget::name, P_DOUBLE, rofi_theme_find_property(), rofi_theme_find_widget(), rofi_theme_get_double_inside(), and _widget::state.

Referenced by icon_create(), textbox_create(), and textbox_draw().

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

◆ rofi_theme_get_highlight()

RofiHighlightColorStyle rofi_theme_get_highlight ( widget * widget,
const char * property,
RofiHighlightColorStyle th )
Parameters
widgetThe widget to query
propertyThe property to query.
thThe default value.

Obtain the highlight .

Returns
The highlight of this property for this widget.

Definition at line 1309 of file theme.c.

References _widget::name, P_COLOR, P_HIGHLIGHT, rofi_theme_find_property(), rofi_theme_find_widget(), rofi_theme_get_highlight_inside(), and _widget::state.

Referenced by __textbox_update_pango_text(), and update_callback().

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

◆ rofi_theme_get_image()

gboolean rofi_theme_get_image ( const widget * widget,
const char * property,
cairo_t * d )
Parameters
widgetThe widget to query
propertyThe property to query.
dThe drawable to apply color.

Obtain the image of the widget and applies this to the drawable d.

Returns
true if image is set.

Definition at line 1173 of file theme.c.

References _widget::name, P_IMAGE, rofi_theme_find_property(), rofi_theme_find_widget(), rofi_theme_get_image_inside(), and _widget::state.

Referenced by widget_draw().

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

◆ rofi_theme_get_integer()

int rofi_theme_get_integer ( const widget * widget,
const char * property,
int def )
Parameters
widgetThe widget to query
propertyThe property to query.
defThe default value.

Obtain the integer of the widget.

Returns
The integer value of this property for this widget.

Definition at line 840 of file theme.c.

References _widget::name, P_INTEGER, rofi_theme_find_property(), rofi_theme_find_widget(), rofi_theme_get_integer_inside(), and _widget::state.

Referenced by listview_create(), rofi_view_set_overlay_timeout(), and rofi_view_setup_fake_transparency().

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

◆ rofi_theme_get_list_distance()

GList * rofi_theme_get_list_distance ( const widget * widget,
const char * property )
Parameters
widgetThe widget handle.
propertyThe property to query.

Returns a list of allocated RofiDistance objects that should be freed.

Returns
a GList of RofiDistance objects.

Definition at line 1233 of file theme.c.

References _PropertyValue::i, RofiPadding::left, _widget::name, P_INTEGER, P_LIST, P_PADDING, _PropertyValue::padding, ROFI_DISTANCE_MODIFIER_NONE, ROFI_HL_SOLID, ROFI_PU_PX, rofi_theme_find_property(), rofi_theme_find_widget(), rofi_theme_get_list_inside(), _widget::state, Property::type, and Property::value.

Referenced by textbox_tab_stops().

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

◆ rofi_theme_get_list_strings()

GList * rofi_theme_get_list_strings ( const widget * widget,
const char * property )
Parameters
widgetThe widget handle.
propertyThe property to query.

Returns a list of allocated strings othat should be freed.

Returns
a GList of strings.

Definition at line 1259 of file theme.c.

References _widget::name, P_LIST, P_STRING, rofi_theme_find_property(), rofi_theme_find_widget(), rofi_theme_get_list_inside(), _PropertyValue::s, _widget::state, Property::type, and Property::value.

Referenced by listview_add_widget(), listview_create_row(), rofi_view_add_widget(), and rofi_view_create().

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

◆ rofi_theme_get_orientation()

RofiOrientation rofi_theme_get_orientation ( const widget * widget,
const char * property,
RofiOrientation def )
Parameters
widgetThe widget to query
propertyThe property to query.
defThe default value.

Obtain the orientation indicated by property of the widget.

Returns
The orientation of this property for this widget or def not found.

Definition at line 929 of file theme.c.

References _widget::name, P_ORIENTATION, rofi_theme_find_property(), rofi_theme_find_widget(), rofi_theme_get_orientation_inside(), and _widget::state.

Referenced by box_create(), and listview_create().

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

◆ rofi_theme_get_padding()

RofiPadding rofi_theme_get_padding ( const widget * widget,
const char * property,
RofiPadding pad )
Parameters
widgetThe widget to query
propertyThe property to query.
padThe default value.

Obtain the padding of the widget.

Returns
The padding of this property for this widget.

Definition at line 1207 of file theme.c.

References _widget::name, P_PADDING, rofi_theme_find_property(), rofi_theme_find_widget(), rofi_theme_get_padding_inside(), and _widget::state.

Referenced by widget_init(), and widget_set_state().

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

◆ rofi_theme_get_position()

int rofi_theme_get_position ( const widget * widget,
const char * property,
int def )
Parameters
widgetThe widget to query
propertyThe property to query.
defThe default value.

Obtain the position of the widget.

Returns
The position value of this property for this widget.

Definition at line 816 of file theme.c.

References _widget::name, P_POSITION, rofi_theme_find_property(), rofi_theme_find_widget(), rofi_theme_get_position_inside(), and _widget::state.

Referenced by rofi_view_calculate_window_position().

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

◆ rofi_theme_get_string()

const char * rofi_theme_get_string ( const widget * widget,
const char * property,
const char * def )
Parameters
widgetThe widget to query
propertyThe property to query.
defThe default value.

Obtain the string of the widget.

Returns
The string value of this property for this widget.

Definition at line 987 of file theme.c.

References _widget::name, P_STRING, rofi_theme_find_property(), rofi_theme_find_widget(), rofi_theme_get_string_inside(), and _widget::state.

Referenced by __create_window(), icon_create(), listview_add_widget(), rofi_view_add_widget(), textbox_button_trigger_action(), textbox_create(), and textbox_initialize_font().

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

◆ rofi_theme_has_property()

gboolean rofi_theme_has_property ( const widget * widget,
const char * property )
Parameters
widgetThe widget to query
propertyThe property to query.

Check if a rofi theme has a property set.

Definition at line 1654 of file theme.c.

References _widget::name, P_STRING, rofi_theme_find_property(), rofi_theme_find_widget(), rofi_theme_has_property_inside(), and _widget::state.

Here is the call graph for this function:

◆ rofi_theme_parse_file()

gboolean rofi_theme_parse_file ( const char * file)
Parameters
filefilename to parse.

Parse the input theme file.

Returns
returns TRUE when error.

Referenced by main(), and rofi_theme_rasi_validate().

Here is the caller graph for this function:

◆ rofi_theme_parse_media_type()

ThemeMediaType rofi_theme_parse_media_type ( const char * type)

◆ rofi_theme_parse_merge_widgets()

void rofi_theme_parse_merge_widgets ( ThemeWidget * parent,
ThemeWidget * child )
Parameters
parenttarget theme tree
childsource theme three

Merge all the settings from child into parent.

Definition at line 1429 of file theme.c.

References ThemeWidget::media, ThemeWidget::name, ThemeWidget::num_widgets, ThemeWidget::properties, rofi_theme, rofi_theme_find_or_create_name(), rofi_theme_parse_merge_widgets(), rofi_theme_widget_add_properties(), and ThemeWidget::widgets.

Referenced by rofi_theme_parse_merge_widgets(), and rofi_theme_parse_process_conditionals_int().

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

◆ rofi_theme_parse_prepare_file()

char * rofi_theme_parse_prepare_file ( const char * file)
Parameters
fileFile name to prepare.

Tries to find full path relative to parent file.

Returns
full path to file.

Definition at line 1418 of file theme.c.

References parsed_config_files.

◆ rofi_theme_parse_process_conditionals()

void rofi_theme_parse_process_conditionals ( void )

Process conditionals.

Definition at line 1602 of file theme.c.

References mon, monitor_active(), rofi_theme, and rofi_theme_parse_process_conditionals_int().

Referenced by main().

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

◆ rofi_theme_parse_process_links()

void rofi_theme_parse_process_links ( void )

Process links.

Definition at line 1598 of file theme.c.

References rofi_theme, and rofi_theme_parse_process_links_int().

Referenced by main(), and rofi_theme_rasi_validate().

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

◆ rofi_theme_parse_string()

gboolean rofi_theme_parse_string ( const char * string)
Parameters
stringto parse.

Parse the input string in addition to theme file.

Returns
returns TRUE when error.

Referenced by config_parse_cmd_options(), main(), and parse_header_entry().

Here is the caller graph for this function:

◆ rofi_theme_print()

void rofi_theme_print ( ThemeWidget * widget)
Parameters
widgetThe widget handle.

Print out the widget to the commandline.

Definition at line 593 of file theme.c.

References rofi_theme_print_index().

Referenced by main().

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

◆ rofi_theme_print_index()

void rofi_theme_print_index ( ThemeWidget * widget,
int index )
Parameters
widgetThe widget handle.
indexThe indenting index.

Print out the widget to the commandline indented by index.

Definition at line 533 of file theme.c.

References ThemeWidget::media, Property::name, ThemeWidget::name, ThemeWidget::num_widgets, ThemeWidget::parent, ThemeWidget::properties, rofi_theme_print_index(), rofi_theme_print_property_index(), and ThemeWidget::widgets.

Referenced by config_parse_dump_config_rasi_format(), rofi_theme_print(), and rofi_theme_print_index().

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

◆ rofi_theme_print_parsed_files()

void rofi_theme_print_parsed_files ( int is_term)
Parameters
is_termIndicate if printed to terminal.

Print the list of parsed config files.

◆ rofi_theme_property_copy()

Property * rofi_theme_property_copy ( const Property * p,
G_GNUC_UNUSED void * data )

◆ rofi_theme_property_copy_distance()

RofiDistance rofi_theme_property_copy_distance ( RofiDistance const distance)
Parameters
distanceThe distance object to copy.
Returns
a copy of the distance.

Definition at line 119 of file theme.c.

References RofiDistance::base, RofiDistanceUnit::left, RofiDistanceUnit::right, and rofi_theme_property_copy_distance_unit().

Referenced by rofi_theme_property_copy().

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

◆ rofi_theme_property_create()

Property * rofi_theme_property_create ( PropertyType type)
Parameters
typeThe type of the property to create.

Create a theme property of type.

Returns
a new property.

Properties

Definition at line 101 of file theme.c.

References Property::type.

Referenced by dmenu_mode_init(), and rofi_theme_property_copy().

Here is the caller graph for this function:

◆ rofi_theme_property_free()

◆ rofi_theme_rasi_validate()

int rofi_theme_rasi_validate ( const char * filename)
Parameters
filenameThe file to validate.
Returns
the program exit code.

Definition at line 1245 of file rofi.c.

References list_of_error_msgs, list_of_warning_msgs, rofi_theme_parse_file(), and rofi_theme_parse_process_links().

Referenced by main().

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

◆ rofi_theme_reset()

void rofi_theme_reset ( void )

Reset the current theme.

Definition at line 234 of file theme.c.

References rofi_theme, and rofi_theme_free().

Referenced by main().

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

◆ rofi_theme_widget_add_properties()

void rofi_theme_widget_add_properties ( ThemeWidget * widget,
GHashTable * table )
Parameters
widgetThe widget handle.
tableHashTable containing properties set.

Merge properties with widgets current property.

Definition at line 654 of file theme.c.

References ThemeWidget::properties, rofi_theme_copy_property_int(), and rofi_theme_property_free().

Referenced by dmenu_mode_init(), and rofi_theme_parse_merge_widgets().

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

Variable Documentation

◆ rofi_configuration

ThemeWidget* rofi_configuration
extern

Used to store config options.

Definition at line 46 of file xrmoptions.c.

Referenced by cleanup(), config_parse_dump_config_rasi_format(), main(), and rofi_config_find_widget().

◆ rofi_theme