i3
Macros | Functions | Variables
config_directives.c File Reference
#include "all.h"
#include <float.h>
#include <stdarg.h>
Include dependency graph for config_directives.c:

Go to the source code of this file.

Macros

#define APPLY_COLORS(classname)
 
#define APPLY_COLORS(classname)
 

Functions

 CFGFUN (criteria_init, int _state)
 
 CFGFUN (criteria_pop_state)
 
 CFGFUN (criteria_add, const char *ctype, const char *cvalue)
 
static bool eval_boolstr (const char *str)
 
i3_event_state_mask_t event_state_from_str (const char *str)
 A utility function to convert a string containing the group and modifiers to the corresponding bit mask. More...
 
 CFGFUN (font, const char *font)
 
 CFGFUN (binding, const char *bindtype, const char *modifiers, const char *key, const char *release, const char *border, const char *whole_window, const char *exclude_titlebar, const char *command)
 
 CFGFUN (mode_binding, const char *bindtype, const char *modifiers, const char *key, const char *release, const char *border, const char *whole_window, const char *exclude_titlebar, const char *command)
 
 CFGFUN (enter_mode, const char *pango_markup, const char *modename)
 
 CFGFUN (exec, const char *exectype, const char *no_startup_id, const char *command)
 
 CFGFUN (for_window, const char *command)
 
 CFGFUN (floating_minimum_size, const long width, const long height)
 
 CFGFUN (floating_maximum_size, const long width, const long height)
 
 CFGFUN (floating_modifier, const char *modifiers)
 
 CFGFUN (default_orientation, const char *orientation)
 
 CFGFUN (workspace_layout, const char *layout)
 
 CFGFUN (new_window, const char *windowtype, const char *border, const long width)
 
 CFGFUN (hide_edge_borders, const char *borders)
 
 CFGFUN (focus_follows_mouse, const char *value)
 
 CFGFUN (mouse_warping, const char *value)
 
 CFGFUN (force_xinerama, const char *value)
 
 CFGFUN (disable_randr15, const char *value)
 
 CFGFUN (force_focus_wrapping, const char *value)
 
 CFGFUN (workspace_back_and_forth, const char *value)
 
 CFGFUN (fake_outputs, const char *outputs)
 
 CFGFUN (force_display_urgency_hint, const long duration_ms)
 
 CFGFUN (focus_on_window_activation, const char *mode)
 
 CFGFUN (show_marks, const char *value)
 
 CFGFUN (workspace, const char *workspace, const char *output)
 
 CFGFUN (ipc_socket, const char *path)
 
 CFGFUN (restart_state, const char *path)
 
 CFGFUN (popup_during_fullscreen, const char *value)
 
 CFGFUN (color_single, const char *colorclass, const char *color)
 
 CFGFUN (color, const char *colorclass, const char *border, const char *background, const char *text, const char *indicator, const char *child_border)
 
 CFGFUN (assign, const char *workspace)
 
 CFGFUN (no_focus)
 
 CFGFUN (bar_font, const char *font)
 
 CFGFUN (bar_separator_symbol, const char *separator)
 
 CFGFUN (bar_mode, const char *mode)
 
 CFGFUN (bar_hidden_state, const char *hidden_state)
 
 CFGFUN (bar_id, const char *bar_id)
 
 CFGFUN (bar_output, const char *output)
 
 CFGFUN (bar_verbose, const char *verbose)
 
 CFGFUN (bar_modifier, const char *modifier)
 
static void bar_configure_binding (const char *button, const char *command)
 
 CFGFUN (bar_wheel_up_cmd, const char *command)
 
 CFGFUN (bar_wheel_down_cmd, const char *command)
 
 CFGFUN (bar_bindsym, const char *button, const char *command)
 
 CFGFUN (bar_position, const char *position)
 
 CFGFUN (bar_i3bar_command, const char *i3bar_command)
 
 CFGFUN (bar_color, const char *colorclass, const char *border, const char *background, const char *text)
 
 CFGFUN (bar_socket_path, const char *socket_path)
 
 CFGFUN (bar_tray_output, const char *output)
 
 CFGFUN (bar_tray_padding, const long padding_px)
 
 CFGFUN (bar_color_single, const char *colorclass, const char *color)
 
 CFGFUN (bar_status_command, const char *command)
 
 CFGFUN (bar_binding_mode_indicator, const char *value)
 
 CFGFUN (bar_workspace_buttons, const char *value)
 
 CFGFUN (bar_strip_workspace_numbers, const char *value)
 
 CFGFUN (bar_start)
 
 CFGFUN (bar_finish)
 

Variables

static int criteria_next_state
 
static char * font_pattern
 
static char * current_mode
 
static bool current_mode_pango_markup
 
static Barconfigcurrent_bar
 

Macro Definition Documentation

◆ APPLY_COLORS [1/2]

#define APPLY_COLORS (   classname)
Value:
do { \
if (strcmp(colorclass, "client." #classname) == 0) { \
config.client.classname.border = draw_util_hex_to_color(border); \
config.client.classname.background = draw_util_hex_to_color(background); \
config.client.classname.text = draw_util_hex_to_color(text); \
if (indicator != NULL) { \
config.client.classname.indicator = draw_util_hex_to_color(indicator); \
} \
if (child_border != NULL) { \
config.client.classname.child_border = draw_util_hex_to_color(child_border); \
} else { \
config.client.classname.child_border = config.client.classname.background; \
} \
} \
} while (0)
color_t draw_util_hex_to_color(const char *color)
Parses the given color in hex format to an internal color representation.
struct Config::config_client client
Config config
Definition: config.c:17

Referenced by CFGFUN().

◆ APPLY_COLORS [2/2]

#define APPLY_COLORS (   classname)
Value:
do { \
if (strcmp(colorclass, #classname) == 0) { \
if (text != NULL) { \
/* New syntax: border, background, text */ \
current_bar->colors.classname##_border = sstrdup(border); \
current_bar->colors.classname##_bg = sstrdup(background); \
current_bar->colors.classname##_text = sstrdup(text); \
} else { \
/* Old syntax: text, background */ \
current_bar->colors.classname##_bg = sstrdup(background); \
current_bar->colors.classname##_text = sstrdup(border); \
} \
} \
} while (0)
char * sstrdup(const char *str)
Safe-wrapper around strdup which exits if malloc returns NULL (meaning that there is no more memory a...

Function Documentation

◆ bar_configure_binding()

static void bar_configure_binding ( const char *  button,
const char *  command 
)
static

Definition at line 466 of file config_directives.c.

References Barconfig::bar_bindings, bindings, Barbinding::command, ELOG, Barbinding::input_code, scalloc(), sstrdup(), TAILQ_FOREACH, and TAILQ_INSERT_TAIL.

Referenced by CFGFUN().

Here is the call graph for this function:

◆ CFGFUN() [1/58]

CFGFUN ( criteria_init  ,
int  _state 
)

Definition at line 26 of file config_directives.c.

References criteria_next_state, current_match, DLOG, match_free(), and match_init().

Here is the call graph for this function:

◆ CFGFUN() [2/58]

CFGFUN ( criteria_pop_state  )

Definition at line 34 of file config_directives.c.

References criteria_next_state.

◆ CFGFUN() [3/58]

CFGFUN ( criteria_add  ,
const char *  ctype,
const char *  cvalue 
)

Definition at line 43 of file config_directives.c.

References current_match, and match_parse_property().

Here is the call graph for this function:

◆ CFGFUN() [4/58]

CFGFUN ( font  ,
const char *  font 
)

Definition at line 100 of file config_directives.c.

References config, Config::font, font_pattern, FREE, load_font(), set_font(), and sstrdup().

Here is the call graph for this function:

◆ CFGFUN() [5/58]

CFGFUN ( binding  ,
const char *  bindtype,
const char *  modifiers,
const char *  key,
const char *  release,
const char *  border,
const char *  whole_window,
const char *  exclude_titlebar,
const char *  command 
)

Definition at line 109 of file config_directives.c.

References configure_binding(), and DEFAULT_BINDING_MODE.

Here is the call graph for this function:

◆ CFGFUN() [6/58]

CFGFUN ( mode_binding  ,
const char *  bindtype,
const char *  modifiers,
const char *  key,
const char *  release,
const char *  border,
const char *  whole_window,
const char *  exclude_titlebar,
const char *  command 
)

Definition at line 120 of file config_directives.c.

References configure_binding(), current_mode, and current_mode_pango_markup.

Here is the call graph for this function:

◆ CFGFUN() [7/58]

CFGFUN ( enter_mode  ,
const char *  pango_markup,
const char *  modename 
)

Definition at line 124 of file config_directives.c.

References current_mode, current_mode_pango_markup, DEFAULT_BINDING_MODE, DLOG, ELOG, FREE, modes, Mode::name, SLIST_FOREACH, and sstrdup().

Here is the call graph for this function:

◆ CFGFUN() [8/58]

CFGFUN ( exec  ,
const char *  exectype,
const char *  no_startup_id,
const char *  command 
)

Definition at line 143 of file config_directives.c.

References autostarts, autostarts_always, smalloc(), sstrdup(), and TAILQ_INSERT_TAIL.

Here is the call graph for this function:

◆ CFGFUN() [9/58]

CFGFUN ( for_window  ,
const char *  command 
)

◆ CFGFUN() [10/58]

CFGFUN ( floating_minimum_size  ,
const long  width,
const long  height 
)

◆ CFGFUN() [11/58]

CFGFUN ( floating_maximum_size  ,
const long  width,
const long  height 
)

◆ CFGFUN() [12/58]

CFGFUN ( floating_modifier  ,
const char *  modifiers 
)

Definition at line 177 of file config_directives.c.

References config, event_state_from_str(), and Config::floating_modifier.

Here is the call graph for this function:

◆ CFGFUN() [13/58]

CFGFUN ( default_orientation  ,
const char *  orientation 
)

Definition at line 181 of file config_directives.c.

References config, Config::default_orientation, HORIZ, NO_ORIENTATION, and VERT.

◆ CFGFUN() [14/58]

CFGFUN ( workspace_layout  ,
const char *  layout 
)

Definition at line 190 of file config_directives.c.

References config, Config::default_layout, L_DEFAULT, L_STACKED, and L_TABBED.

◆ CFGFUN() [15/58]

CFGFUN ( new_window  ,
const char *  windowtype,
const char *  border,
const long  width 
)

◆ CFGFUN() [16/58]

CFGFUN ( hide_edge_borders  ,
const char *  borders 
)

Definition at line 231 of file config_directives.c.

References config, eval_boolstr(), HEBM_BOTH, HEBM_HORIZONTAL, HEBM_NONE, HEBM_SMART, HEBM_VERTICAL, and Config::hide_edge_borders.

Here is the call graph for this function:

◆ CFGFUN() [17/58]

CFGFUN ( focus_follows_mouse  ,
const char *  value 
)

Definition at line 248 of file config_directives.c.

References config, Config::disable_focus_follows_mouse, and eval_boolstr().

Here is the call graph for this function:

◆ CFGFUN() [18/58]

CFGFUN ( mouse_warping  ,
const char *  value 
)

◆ CFGFUN() [19/58]

CFGFUN ( force_xinerama  ,
const char *  value 
)

Definition at line 259 of file config_directives.c.

References config, eval_boolstr(), and Config::force_xinerama.

Here is the call graph for this function:

◆ CFGFUN() [20/58]

CFGFUN ( disable_randr15  ,
const char *  value 
)

Definition at line 263 of file config_directives.c.

References config, Config::disable_randr15, and eval_boolstr().

Here is the call graph for this function:

◆ CFGFUN() [21/58]

CFGFUN ( force_focus_wrapping  ,
const char *  value 
)

Definition at line 267 of file config_directives.c.

References config, eval_boolstr(), and Config::force_focus_wrapping.

Here is the call graph for this function:

◆ CFGFUN() [22/58]

CFGFUN ( workspace_back_and_forth  ,
const char *  value 
)

Definition at line 271 of file config_directives.c.

References config, eval_boolstr(), and Config::workspace_auto_back_and_forth.

Here is the call graph for this function:

◆ CFGFUN() [23/58]

CFGFUN ( fake_outputs  ,
const char *  outputs 
)

Definition at line 275 of file config_directives.c.

References config, Config::fake_outputs, and sstrdup().

Here is the call graph for this function:

◆ CFGFUN() [24/58]

CFGFUN ( force_display_urgency_hint  ,
const long  duration_ms 
)

Definition at line 280 of file config_directives.c.

References config, and Config::workspace_urgency_timer.

◆ CFGFUN() [25/58]

CFGFUN ( focus_on_window_activation  ,
const char *  mode 
)

Definition at line 284 of file config_directives.c.

References config, DLOG, ELOG, and Config::focus_on_window_activation.

◆ CFGFUN() [26/58]

CFGFUN ( show_marks  ,
const char *  value 
)

Definition at line 301 of file config_directives.c.

References config, eval_boolstr(), and Config::show_marks.

Here is the call graph for this function:

◆ CFGFUN() [27/58]

CFGFUN ( workspace  ,
const char *  workspace,
const char *  output 
)

Definition at line 305 of file config_directives.c.

References DLOG, ELOG, Workspace_Assignment::name, Workspace_Assignment::output, scalloc(), sstrdup(), TAILQ_FOREACH, TAILQ_INSERT_TAIL, and ws_assignments.

Here is the call graph for this function:

◆ CFGFUN() [28/58]

CFGFUN ( ipc_socket  ,
const char *  path 
)

Definition at line 328 of file config_directives.c.

References config, Config::ipc_socket_path, and sstrdup().

Here is the call graph for this function:

◆ CFGFUN() [29/58]

CFGFUN ( restart_state  ,
const char *  path 
)

Definition at line 333 of file config_directives.c.

References config, Config::restart_state_path, and sstrdup().

Here is the call graph for this function:

◆ CFGFUN() [30/58]

CFGFUN ( popup_during_fullscreen  ,
const char *  value 
)

Definition at line 338 of file config_directives.c.

References config, and Config::popup_during_fullscreen.

◆ CFGFUN() [31/58]

CFGFUN ( color_single  ,
const char *  colorclass,
const char *  color 
)

Definition at line 348 of file config_directives.c.

References Config::config_client::background, Config::client, config, and draw_util_hex_to_color().

Here is the call graph for this function:

◆ CFGFUN() [32/58]

CFGFUN ( color  ,
const char *  colorclass,
const char *  border,
const char *  background,
const char *  text,
const char *  indicator,
const char *  child_border 
)

Definition at line 353 of file config_directives.c.

References APPLY_COLORS, and focused.

◆ CFGFUN() [33/58]

CFGFUN ( assign  ,
const char *  workspace 
)

◆ CFGFUN() [34/58]

CFGFUN ( no_focus  )

Definition at line 393 of file config_directives.c.

References assignments, current_match, DLOG, ELOG, Assignment::match, match_copy(), match_is_empty(), scalloc(), TAILQ_INSERT_TAIL, and Assignment::type.

Here is the call graph for this function:

◆ CFGFUN() [35/58]

CFGFUN ( bar_font  ,
const char *  font 
)

Definition at line 412 of file config_directives.c.

References Barconfig::font, FREE, and sstrdup().

Here is the call graph for this function:

◆ CFGFUN() [36/58]

CFGFUN ( bar_separator_symbol  ,
const char *  separator 
)

Definition at line 417 of file config_directives.c.

References FREE, Barconfig::separator_symbol, and sstrdup().

Here is the call graph for this function:

◆ CFGFUN() [37/58]

CFGFUN ( bar_mode  ,
const char *  mode 
)

Definition at line 422 of file config_directives.c.

References Barconfig::mode.

◆ CFGFUN() [38/58]

CFGFUN ( bar_hidden_state  ,
const char *  hidden_state 
)

Definition at line 426 of file config_directives.c.

References Barconfig::hidden_state.

◆ CFGFUN() [39/58]

CFGFUN ( bar_id  ,
const char *  bar_id 
)

Definition at line 430 of file config_directives.c.

References Barconfig::id, and sstrdup().

Here is the call graph for this function:

◆ CFGFUN() [40/58]

CFGFUN ( bar_output  ,
const char *  output 
)

Definition at line 434 of file config_directives.c.

References Barconfig::num_outputs, Barconfig::outputs, srealloc(), and sstrdup().

Here is the call graph for this function:

◆ CFGFUN() [41/58]

CFGFUN ( bar_verbose  ,
const char *  verbose 
)

Definition at line 441 of file config_directives.c.

References eval_boolstr(), and Barconfig::verbose.

Here is the call graph for this function:

◆ CFGFUN() [42/58]

CFGFUN ( bar_modifier  ,
const char *  modifier 
)

Definition at line 445 of file config_directives.c.

References Barconfig::modifier.

◆ CFGFUN() [43/58]

CFGFUN ( bar_wheel_up_cmd  ,
const char *  command 
)

Definition at line 492 of file config_directives.c.

References bar_configure_binding(), and ELOG.

Here is the call graph for this function:

◆ CFGFUN() [44/58]

CFGFUN ( bar_wheel_down_cmd  ,
const char *  command 
)

Definition at line 497 of file config_directives.c.

References bar_configure_binding(), and ELOG.

Here is the call graph for this function:

◆ CFGFUN() [45/58]

CFGFUN ( bar_bindsym  ,
const char *  button,
const char *  command 
)

Definition at line 502 of file config_directives.c.

References bar_configure_binding().

Here is the call graph for this function:

◆ CFGFUN() [46/58]

CFGFUN ( bar_position  ,
const char *  position 
)

Definition at line 506 of file config_directives.c.

References Barconfig::position.

◆ CFGFUN() [47/58]

CFGFUN ( bar_i3bar_command  ,
const char *  i3bar_command 
)

Definition at line 510 of file config_directives.c.

References FREE, Barconfig::i3bar_command, and sstrdup().

Here is the call graph for this function:

◆ CFGFUN() [48/58]

CFGFUN ( bar_color  ,
const char *  colorclass,
const char *  border,
const char *  background,
const char *  text 
)

Definition at line 515 of file config_directives.c.

References APPLY_COLORS.

◆ CFGFUN() [49/58]

CFGFUN ( bar_socket_path  ,
const char *  socket_path 
)

Definition at line 541 of file config_directives.c.

References FREE, Barconfig::socket_path, and sstrdup().

Here is the call graph for this function:

◆ CFGFUN() [50/58]

CFGFUN ( bar_tray_output  ,
const char *  output 
)

Definition at line 546 of file config_directives.c.

References tray_output_t::output, scalloc(), sstrdup(), TAILQ_INSERT_TAIL, Barconfig::tray_outputs, and tray_output_t::tray_outputs.

Here is the call graph for this function:

◆ CFGFUN() [51/58]

CFGFUN ( bar_tray_padding  ,
const long  padding_px 
)

Definition at line 552 of file config_directives.c.

References Barconfig::tray_padding.

◆ CFGFUN() [52/58]

CFGFUN ( bar_color_single  ,
const char *  colorclass,
const char *  color 
)

◆ CFGFUN() [53/58]

CFGFUN ( bar_status_command  ,
const char *  command 
)

Definition at line 571 of file config_directives.c.

References FREE, sstrdup(), and Barconfig::status_command.

Here is the call graph for this function:

◆ CFGFUN() [54/58]

CFGFUN ( bar_binding_mode_indicator  ,
const char *  value 
)

Definition at line 576 of file config_directives.c.

References eval_boolstr(), and Barconfig::hide_binding_mode_indicator.

Here is the call graph for this function:

◆ CFGFUN() [55/58]

CFGFUN ( bar_workspace_buttons  ,
const char *  value 
)

Definition at line 580 of file config_directives.c.

References eval_boolstr(), and Barconfig::hide_workspace_buttons.

Here is the call graph for this function:

◆ CFGFUN() [56/58]

CFGFUN ( bar_strip_workspace_numbers  ,
const char *  value 
)

Definition at line 584 of file config_directives.c.

References eval_boolstr(), and Barconfig::strip_workspace_numbers.

Here is the call graph for this function:

◆ CFGFUN() [57/58]

CFGFUN ( bar_start  )

Definition at line 588 of file config_directives.c.

References Barconfig::bar_bindings, Barconfig::modifier, scalloc(), TAILQ_INIT, Barconfig::tray_outputs, and Barconfig::tray_padding.

Here is the call graph for this function:

◆ CFGFUN() [58/58]

CFGFUN ( bar_finish  )

Definition at line 596 of file config_directives.c.

References barconfigs, config, DLOG, Barconfig::font, font_pattern, Barconfig::id, Config::number_barconfigs, sasprintf(), sstrdup(), and TAILQ_INSERT_TAIL.

Here is the call graph for this function:

◆ eval_boolstr()

static bool eval_boolstr ( const char *  str)
static

Definition at line 51 of file config_directives.c.

Referenced by CFGFUN().

◆ event_state_from_str()

i3_event_state_mask_t event_state_from_str ( const char *  str)

A utility function to convert a string containing the group and modifiers to the corresponding bit mask.

Definition at line 64 of file config_directives.c.

References I3_XKB_GROUP_MASK_1, I3_XKB_GROUP_MASK_2, I3_XKB_GROUP_MASK_3, and I3_XKB_GROUP_MASK_4.

Referenced by CFGFUN(), and configure_binding().

Variable Documentation

◆ criteria_next_state

int criteria_next_state
static

Definition at line 19 of file config_directives.c.

Referenced by CFGFUN(), and parse_config().

◆ current_bar

Barconfig* current_bar
static

Definition at line 410 of file config_directives.c.

◆ current_mode

char* current_mode
static

Definition at line 117 of file config_directives.c.

Referenced by CFGFUN(), and reorder_bindings().

◆ current_mode_pango_markup

bool current_mode_pango_markup
static

Definition at line 118 of file config_directives.c.

Referenced by CFGFUN().

◆ font_pattern

char* font_pattern
static

Definition at line 98 of file config_directives.c.

Referenced by CFGFUN().