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

static 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, Config::fake_outputs, 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, Config::ipc_socket_path, 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, Config::restart_state_path, 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 Config::config_client::background, Config::bar, barconfigs, bindings, Mode::bindings, gaps_t::bottom, BS_NORMAL, C_RELOAD, C_VALIDATE, Config::client, config, conn, ctx, current_binding_mode, current_configpath, Config::default_border, Config::default_border_width, Config::default_floating_border, Config::default_floating_border_width, Config::default_orientation, die, draw_util_hex_to_color(), ELOG, extract_workspace_names_from_bindings(), Config::focus_wrapping, FOCUS_WRAPPING_ON, Config::config_bar::focused, Config::config_client::focused, Config::config_client::focused_inactive, Barconfig::font, Config::font, FREE, free_configuration(), free_variables(), Config::gaps, gaps_reapply_workspace_assignments(), get_config_path(), Config::config_client::got_focused_tab_title, grab_all_keys(), included_files, INIT_COLOR, gaps_t::inner, gaps_t::left, load_font(), LOG, logical_px(), modes, Mode::name, NO_ORIENTATION, parse_file(), IncludedFile::path, Font::pattern, Config::config_client::placeholder, IncludedFile::raw_contents, regrab_all_buttons(), reorder_bindings(), gaps_t::right, scalloc(), set_font(), Config::show_marks, SLIST_INIT, SLIST_INSERT_HEAD, sstrdup(), Config::swap_modifier, TAILQ_EMPTY, TAILQ_FIRST, TAILQ_FOREACH, TAILQ_INIT, TAILQ_INSERT_TAIL, TAILQ_REMOVE, Config::tiling_drag, TILING_DRAG_MODIFIER, gaps_t::top, translate_keysyms(), tree_render(), Font::type, Config::config_bar::unfocused, Config::config_client::unfocused, Config::config_bar::urgent, Config::config_client::urgent, IncludedFile::variable_replaced_contents, and Config::workspace_urgency_timer.

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

struct modes_head modes