rofi  1.6.1
theme.h File Reference
#include <glib.h>
#include <cairo.h>
#include <widgets/widget.h>
#include "rofi-types.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.

Data Structures

struct  ThemeMedia
 
struct  ThemeWidget
 

Typedefs

typedef struct ThemeMedia ThemeMedia
 
typedef struct ThemeWidget ThemeWidget
 

Enumerations

enum  ThemeMediaType {
  THEME_MEDIA_TYPE_MIN_WIDTH, THEME_MEDIA_TYPE_MAX_WIDTH, THEME_MEDIA_TYPE_MIN_HEIGHT, THEME_MEDIA_TYPE_MAX_HEIGHT,
  THEME_MEDIA_TYPE_MON_ID, THEME_MEDIA_TYPE_MIN_ASPECT_RATIO, THEME_MEDIA_TYPE_MAX_ASPECT_RATIO, THEME_MEDIA_TYPE_INVALID
}
 

Functions

ThemeWidgetrofi_theme_find_or_create_name (ThemeWidget *base, const char *name)
 
void rofi_theme_print (ThemeWidget *widget)
 
Propertyrofi_theme_property_create (PropertyType type)
 
void rofi_theme_property_free (Property *p)
 
Propertyrofi_theme_property_copy (Property *p)
 
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)
 
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_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)
 
Propertyrofi_theme_find_property (ThemeWidget *widget, PropertyType type, const char *property, gboolean exact)
 
GList * rofi_theme_get_list (const widget *widget, const char *property, const char *defaults)
 
gboolean rofi_theme_is_empty (void)
 
void rofi_theme_reset (void)
 
char * helper_get_theme_path (const char *file)
 
char * rofi_theme_parse_prepare_file (const char *file, const char *parent_file)
 
void rofi_theme_parse_process_conditionals (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)
 

Variables

ThemeWidgetrofi_theme
 

Typedef Documentation

◆ ThemeMedia

typedef struct ThemeMedia ThemeMedia

Theme Media description.

◆ ThemeWidget

Enumeration Type Documentation

◆ ThemeMediaType

Describe the media constraint type.

Enumerator
THEME_MEDIA_TYPE_MIN_WIDTH 

Minimum width constraint.

THEME_MEDIA_TYPE_MAX_WIDTH 

Maximum width constraint.

THEME_MEDIA_TYPE_MIN_HEIGHT 

Minimum height constraint.

THEME_MEDIA_TYPE_MAX_HEIGHT 

Maximum height constraint.

THEME_MEDIA_TYPE_MON_ID 

Monitor id constraint.

THEME_MEDIA_TYPE_MIN_ASPECT_RATIO 

Minimum aspect ratio constraint.

THEME_MEDIA_TYPE_MAX_ASPECT_RATIO 

Maximum aspect ratio constraint.

THEME_MEDIA_TYPE_INVALID 

Invalid entry.

Definition at line 38 of file theme.h.

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 1031 of file theme.c.

References ROFI_HL_DASH, and RofiDistance::style.

◆ distance_get_pixel()

int distance_get_pixel ( RofiDistance  d,
RofiOrientation  ori 
)

◆ helper_get_theme_path()

char* helper_get_theme_path ( const char *  file)
Parameters
fileFile name passed to option.
Returns
path to theme or copy of filename if not found.

Definition at line 1080 of file helper.c.

References rofi_expand_path().

Here is the call graph for this function:

◆ 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 59 of file theme.c.

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

Referenced by rofi_theme_insert_listview_backwards_fix(), rofi_theme_parse_merge_widgets(), and rofi_theme_parse_merge_widgets_no_media().

Here is the caller graph for this function:

◆ rofi_theme_find_property()

Property* rofi_theme_find_property ( ThemeWidget widget,
PropertyType  type,
const char *  property,
gboolean  exact 
)
Parameters
widgetThe widget to find the property on.
typeThe PropertyType to find.
propertyThe property to find.
exactIf the property should only be found on this widget, or on parents if not found.

Find the property on the widget. If not exact, the parents are searched recursively until match is found.

Returns
the Property if found, otherwise NULL.

Definition at line 683 of file theme.c.

References _PropertyValue::link, _widget::name, P_INHERIT, P_INTEGER, P_LINK, P_PADDING, _widget::parent, PropertyTypeName, _PropertyValue::ref, rofi_theme_resolve_link_property(), Property::type, and Property::value.

Referenced by combi_mgrv(), rofi_theme_get_boolean(), rofi_theme_get_color(), rofi_theme_get_distance(), rofi_theme_get_double(), rofi_theme_get_highlight(), rofi_theme_get_integer(), rofi_theme_get_list(), rofi_theme_get_orientation(), rofi_theme_get_padding(), rofi_theme_get_position(), rofi_theme_get_string(), and rofi_theme_has_property().

Here is the call graph for this function:
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 
)

Low-level functions. These can be used by non-widgets to obtain values.

Parameters
nameThe name of the element to find.
stateThe state of the element.
exactIf the match should be exact, or parent can be included.

Find the theme element. If not exact, the closest specified element is returned.

Returns
the ThemeWidget if found, otherwise NULL.

Definition at line 721 of file theme.c.

References rofi_theme, rofi_theme_find(), and rofi_theme_find_single().

Referenced by combi_mgrv(), rofi_theme_get_boolean(), rofi_theme_get_color(), rofi_theme_get_distance(), rofi_theme_get_double(), rofi_theme_get_highlight(), rofi_theme_get_integer(), rofi_theme_get_list(), rofi_theme_get_orientation(), rofi_theme_get_padding(), rofi_theme_get_position(), rofi_theme_get_string(), and rofi_theme_has_property().

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

◆ rofi_theme_free()

void rofi_theme_free ( ThemeWidget widget)
Parameters
widgetFree the widget and alll children.

Definition at line 246 of file theme.c.

References _widget::name, and rofi_theme_free().

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

Here is the call graph for this function:
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 785 of file theme.c.

References _PropertyValue::b, _widget::name, P_BOOLEAN, P_INHERIT, _widget::parent, rofi_theme_find_property(), rofi_theme_find_widget(), rofi_theme_get_boolean(), _widget::state, Property::type, and Property::value.

Referenced by __create_window(), box_add(), listview_create(), rofi_theme_get_boolean(), textbox_create(), 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 861 of file theme.c.

References ThemeColor::alpha, ThemeColor::blue, _PropertyValue::color, ThemeColor::green, _widget::name, P_COLOR, P_INHERIT, _widget::parent, ThemeColor::red, rofi_theme_find_property(), rofi_theme_find_widget(), rofi_theme_get_color(), _widget::state, Property::type, and Property::value.

Referenced by rofi_theme_get_color(), 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_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 763 of file theme.c.

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

Referenced by box_create(), box_get_desired_width(), icon_create(), listview_create(), rofi_theme_get_distance(), rofi_view_calculate_height(), rofi_view_calculate_window_position(), rofi_view_calculate_window_width(), scrollbar_create(), 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 834 of file theme.c.

References _PropertyValue::f, _PropertyValue::i, _widget::name, P_DOUBLE, P_INHERIT, P_INTEGER, _widget::parent, rofi_theme_find_property(), rofi_theme_find_widget(), rofi_theme_get_double(), _widget::state, Property::type, and Property::value.

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

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 932 of file theme.c.

References _PropertyValue::highlight, _widget::name, P_HIGHLIGHT, P_INHERIT, _widget::parent, rofi_theme_find_property(), rofi_theme_find_widget(), rofi_theme_get_highlight(), _widget::state, Property::type, and Property::value.

Referenced by rofi_theme_get_highlight(), and update_callback().

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 747 of file theme.c.

References _PropertyValue::i, _widget::name, P_INHERIT, P_INTEGER, _widget::parent, rofi_theme_find_property(), rofi_theme_find_widget(), rofi_theme_get_integer(), _widget::state, Property::type, and Property::value.

Referenced by listview_create(), rofi_theme_get_integer(), and rofi_view_add_widget().

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

◆ rofi_theme_get_list()

GList* rofi_theme_get_list ( const widget widget,
const char *  property,
const char *  defaults 
)
Parameters
widgetThe widget to query
propertyThe property to query.
defaultsThe default value.

Obtain list of elements (strings) of the widget.

Returns
a GList holding the names in the list of this property for this widget.

Definition at line 906 of file theme.c.

References _PropertyValue::list, _widget::name, P_INHERIT, P_LIST, _widget::parent, rofi_g_list_strdup(), rofi_theme_find_property(), rofi_theme_find_widget(), rofi_theme_get_list(), _widget::state, Property::type, and Property::value.

Referenced by listview_add_widget(), listview_create_row(), rofi_theme_get_list(), 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 801 of file theme.c.

References _PropertyValue::b, _widget::name, P_INHERIT, P_ORIENTATION, _widget::parent, rofi_theme_find_property(), rofi_theme_find_widget(), rofi_theme_get_orientation(), _widget::state, Property::type, and Property::value.

Referenced by box_create(), listview_create(), and rofi_theme_get_orientation().

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 883 of file theme.c.

References RofiDistance::base, _PropertyValue::i, _widget::name, P_INHERIT, P_PADDING, _PropertyValue::padding, _widget::parent, ROFI_DISTANCE_MODIFIER_NONE, ROFI_HL_SOLID, ROFI_PU_PX, rofi_theme_find_property(), rofi_theme_find_widget(), rofi_theme_get_padding(), _widget::state, Property::type, and Property::value.

Referenced by rofi_theme_get_padding(), 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 730 of file theme.c.

References _PropertyValue::i, _widget::name, P_INHERIT, P_POSITION, _widget::parent, rofi_theme_find_property(), rofi_theme_find_widget(), rofi_theme_get_position(), _widget::state, Property::type, and Property::value.

Referenced by rofi_theme_get_position(), and 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 818 of file theme.c.

References _widget::name, P_INHERIT, P_STRING, _widget::parent, rofi_theme_find_property(), rofi_theme_find_widget(), rofi_theme_get_string(), _PropertyValue::s, _widget::state, Property::type, and Property::value.

Referenced by __create_window(), icon_create(), rofi_theme_get_string(), 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 1379 of file theme.c.

References _widget::name, P_INHERIT, P_STRING, _widget::parent, rofi_theme_find_property(), rofi_theme_find_widget(), rofi_theme_has_property(), _widget::state, and Property::type.

Referenced by rofi_theme_has_property().

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

◆ rofi_theme_is_empty()

gboolean rofi_theme_is_empty ( void  )

Checks if a theme is set, or is empty.

Returns
TRUE when empty.

Definition at line 1042 of file theme.c.

References ThemeWidget::name, ThemeWidget::num_widgets, ThemeWidget::properties, rofi_theme, and ThemeWidget::widgets.

Referenced by main().

Here is the caller 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().

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 1237 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().

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,
const char *  parent_file 
)
Parameters
fileFile name to prepare.
parent_fileFilename of parent file.

Tries to find full path relative to parent file.

Returns
full path to file.

Definition at line 1202 of file theme.c.

References rofi_expand_path().

Here is the call graph for this function:

◆ rofi_theme_parse_process_conditionals()

void rofi_theme_parse_process_conditionals ( void  )

Process conditionals.

Definition at line 1346 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_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 main().

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 536 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_property_copy()

◆ rofi_theme_property_copy_distance()

RofiDistance rofi_theme_property_copy_distance ( RofiDistance const  distance)

Definition at line 97 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 78 of file theme.c.

References Property::type.

Referenced by rofi_theme_insert_listview_backwards_fix(), and rofi_theme_property_copy().

Here is the caller graph for this function:

◆ rofi_theme_property_free()

void rofi_theme_property_free ( Property p)

◆ rofi_theme_reset()

void rofi_theme_reset ( void  )

Reset the current theme.

Definition at line 237 of file theme.c.

References ThemeWidget::name, rofi_theme, rofi_theme_free(), and rofi_theme_insert_listview_backwards_fix().

Here is the call 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 592 of file theme.c.

References rofi_theme_copy_property_int(), and rofi_theme_property_free().

Referenced by rofi_theme_insert_listview_backwards_fix(), rofi_theme_parse_merge_widgets(), and rofi_theme_parse_merge_widgets_no_media().

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

Variable Documentation

◆ rofi_theme