i3
config.c File Reference
#include "all.h"
#include <libgen.h>
#include <unistd.h>
#include <xkbcommon/xkbcommon.h>
Include dependency graph for config.c:

Go to the source code of this file.

Macros

#define INIT_COLOR(x, cborder, cbackground, ctext, cindicator)

Functions

void ungrab_all_keys (xcb_connection_t *conn)
 Ungrabs all keys, to be called before re-grabbing the keys because of a mapping_notify event or a configuration file reload.
static void free_configuration (void)
bool load_configuration (const char *override_configpath, config_load_t load_type)
 (Re-)loads the configuration file (sets useful defaults before).

Variables

char * current_configpath = NULL
Config config
struct modes_head modes
struct barconfig_head barconfigs = TAILQ_HEAD_INITIALIZER(barconfigs)
struct includedfiles_head included_files = TAILQ_HEAD_INITIALIZER(included_files)

Macro Definition Documentation

◆ INIT_COLOR

#define INIT_COLOR ( x,
cborder,
cbackground,
ctext,
cindicator )
Value:
do { \
x.border = draw_util_hex_to_color(cborder); \
x.background = draw_util_hex_to_color(cbackground); \
x.text = draw_util_hex_to_color(ctext); \
x.indicator = draw_util_hex_to_color(cindicator); \
x.child_border = draw_util_hex_to_color(cbackground); \
} while (0)
color_t draw_util_hex_to_color(const char *color)
Parses the given color in hex format to an internal color representation.

Referenced by load_configuration().

Function Documentation

◆ free_configuration()

void free_configuration ( void )
static

Definition at line 34 of file config.c.

References Assignment::A_COMMAND, Assignment::A_TO_OUTPUT, Assignment::A_TO_WORKSPACE, Assignment::A_TO_WORKSPACE_NUMBER, Barconfig::bar_colors::active_workspace_bg, Barconfig::bar_colors::active_workspace_border, Barconfig::bar_colors::active_workspace_text, all_cons, assignments, Barconfig::bar_colors::background, barconfigs, binding_free(), Barconfig::bar_colors::binding_mode_bg, Barconfig::bar_colors::binding_mode_border, Barconfig::bar_colors::binding_mode_text, bindings, Mode::bindings, Barconfig::colors, Assignment::command, Barbinding::command, config, conn, Con::deco_render_params, Assignment::dest, Barconfig::bar_colors::focused_background, Barconfig::bar_colors::focused_separator, Barconfig::bar_colors::focused_statusline, Barconfig::bar_colors::focused_workspace_bg, Barconfig::bar_colors::focused_workspace_border, Barconfig::bar_colors::focused_workspace_text, Barconfig::font, FREE, free_font(), Barconfig::i3bar_command, Barconfig::id, Barconfig::bar_colors::inactive_workspace_bg, Barconfig::bar_colors::inactive_workspace_border, Barconfig::bar_colors::inactive_workspace_text, Assignment::match, match_free(), modes, Mode::name, Workspace_Assignment::name, Window::nr_assignments, Barconfig::num_outputs, Assignment::output, tray_output_t::output, Workspace_Assignment::output, Barconfig::outputs, Window::ran_assignments, Barconfig::bar_colors::separator, SLIST_EMPTY, SLIST_FIRST, SLIST_REMOVE, Barconfig::socket_path, Barconfig::status_command, Barconfig::bar_colors::statusline, switch_mode(), TAILQ_EMPTY, TAILQ_FIRST, TAILQ_FOREACH, TAILQ_REMOVE, Assignment::type, ungrab_all_keys(), Barconfig::bar_colors::urgent_workspace_bg, Barconfig::bar_colors::urgent_workspace_border, Barconfig::bar_colors::urgent_workspace_text, Con::window, Assignment::workspace, Barconfig::workspace_command, and ws_assignments.

Referenced by load_configuration().

Here is the call graph for this function:

◆ load_configuration()

bool load_configuration ( const char * override_configfile,
config_load_t load_type )

(Re-)loads the configuration file (sets useful defaults before).

If you specify override_configpath, only this path is used to look for a configuration file.

load_type specifies the type of loading: C_VALIDATE is used to only verify the correctness of the config file (used with the flag -C). C_LOAD will load the config for normal use and display errors in the nagbar. C_RELOAD will also clear the previous config.

Definition at line 169 of file config.c.

References barconfigs, bindings, Mode::bindings, BS_NORMAL, C_RELOAD, C_VALIDATE, config, conn, ctx, current_binding_mode, current_configpath, die, draw_util_hex_to_color(), ELOG, extract_workspace_names_from_bindings(), FOCUS_WRAPPING_ON, Barconfig::font, FREE, free_configuration(), free_variables(), gaps_reapply_workspace_assignments(), get_config_path(), grab_all_keys(), included_files, INIT_COLOR, load_font(), LOG, logical_px(), modes, Mode::name, NO_ORIENTATION, parse_file(), IncludedFile::path, IncludedFile::raw_contents, regrab_all_buttons(), reorder_bindings(), scalloc(), set_font(), SLIST_INIT, SLIST_INSERT_HEAD, sstrdup(), TAILQ_EMPTY, TAILQ_FIRST, TAILQ_FOREACH, TAILQ_INIT, TAILQ_INSERT_TAIL, TAILQ_REMOVE, TILING_DRAG_MODIFIER, translate_keysyms(), tree_render(), and IncludedFile::variable_replaced_contents.

Referenced by cmd_reload(), and main().

Here is the call graph for this function:

◆ ungrab_all_keys()

void ungrab_all_keys ( xcb_connection_t * conn)

Ungrabs all keys, to be called before re-grabbing the keys because of a mapping_notify event or a configuration file reload.

Definition at line 29 of file config.c.

References conn, DLOG, and root.

Referenced by free_configuration(), handle_event(), handle_mapping_notify(), and switch_mode().

Variable Documentation

◆ barconfigs

struct barconfig_head barconfigs = TAILQ_HEAD_INITIALIZER(barconfigs)

◆ config

◆ current_configpath

char* current_configpath = NULL

Definition at line 18 of file config.c.

Referenced by IPC_HANDLER(), load_configuration(), translate_keysyms(), and x_set_i3_atoms().

◆ included_files

struct includedfiles_head included_files = TAILQ_HEAD_INITIALIZER(included_files)

◆ modes