i3
Macros | Functions | Variables
config.c File Reference
#include "all.h"
#include <X11/Xlib.h>
Include dependency graph for config.c:

Go to the source code of this file.

Macros

#define I3__FILE__   "config.c"
 
#define REQUIRED_OPTION(name)
 
#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. More...
 
void update_barconfig ()
 Sends the current bar configuration as an event to all barconfig_update listeners. More...
 
static char * get_config_path (const char *override_configpath)
 
static void parse_configuration (const char *override_configpath)
 
void load_configuration (xcb_connection_t *conn, const char *override_configpath, bool reload)
 Reads the configuration from ~/.i3/config or /etc/i3/config if not found. More...
 

Variables

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

Macro Definition Documentation

#define I3__FILE__   "config.c"

Definition at line 2 of file config.c.

#define INIT_COLOR (   x,
  cborder,
  cbackground,
  ctext,
  cindicator 
)
Value:
do { \
x.border = get_colorpixel(cborder); \
x.background = get_colorpixel(cbackground); \
x.text = get_colorpixel(ctext); \
x.indicator = get_colorpixel(cindicator); \
} while (0)
uint32_t get_colorpixel(const char *hex) __attribute__((const ))
Returns the colorpixel to use for the given hex color (think of HTML).
uint32_t x
Definition: data.h:30

Referenced by load_configuration().

#define REQUIRED_OPTION (   name)
Value:
if (config.name == NULL) \
die("You did not specify required configuration option " #name "\n");
Config config
Definition: config.c:19
#define die(...)
Definition: util.h:17

Function Documentation

static char* get_config_path ( const char *  override_configpath)
static

Definition at line 52 of file config.c.

References die, path_exists(), resolve_tilde(), sasprintf(), and sstrdup().

Referenced by parse_configuration().

Here is the call graph for this function:

void load_configuration ( xcb_connection_t *  conn,
const char *  override_configfile,
bool  reload 
)

Reads the configuration from ~/.i3/config or /etc/i3/config if not found.

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

Definition at line 129 of file config.c.

References Assignment::A_COMMAND, Assignment::A_TO_OUTPUT, Assignment::A_TO_WORKSPACE, Barconfig::bar_colors::active_workspace_bg, Barconfig::bar_colors::active_workspace_border, Barconfig::bar_colors::active_workspace_text, all_cons, assignments, Config::config_client::background, Barconfig::bar_colors::background, Config::bar, barconfigs, Mode::bindings, bindings, BS_NORMAL, Config::client, Barconfig::colors, Binding::command, Assignment::command, croot, Con::deco_render_params, Config::default_border, Config::default_border_width, Config::default_floating_border, Config::default_floating_border_width, Config::default_orientation, Assignment::dest, ELOG, Config::config_bar::focused, Config::config_client::focused, Config::config_client::focused_inactive, Barconfig::bar_colors::focused_workspace_bg, Barconfig::bar_colors::focused_workspace_border, Barconfig::bar_colors::focused_workspace_text, Config::font, Barconfig::font, FREE, free_font(), get_colorpixel(), grab_all_keys(), Barconfig::i3bar_command, Barconfig::id, Barconfig::bar_colors::inactive_workspace_bg, Barconfig::bar_colors::inactive_workspace_border, Barconfig::bar_colors::inactive_workspace_text, INIT_COLOR, load_font(), logical_px(), Assignment::match, match_free(), modes, Mode::name, NO_ORIENTATION, Barconfig::num_outputs, Assignment::output, Barconfig::outputs, parse_configuration(), Config::config_client::placeholder, predict_text_width(), scalloc(), set_font(), SLIST_EMPTY, SLIST_FIRST, SLIST_INIT, SLIST_INSERT_HEAD, SLIST_REMOVE, Barconfig::socket_path, sstrdup(), Barconfig::status_command, Barconfig::bar_colors::statusline, TAILQ_EMPTY, TAILQ_FIRST, TAILQ_FOREACH, TAILQ_INIT, TAILQ_REMOVE, translate_keysyms(), Binding::translated_to, Barconfig::tray_output, Font::type, Assignment::type, Config::config_client::unfocused, Config::config_bar::unfocused, ungrab_all_keys(), Config::config_client::urgent, Config::config_bar::urgent, Barconfig::bar_colors::urgent_workspace_bg, Barconfig::bar_colors::urgent_workspace_border, Barconfig::bar_colors::urgent_workspace_text, Assignment::workspace, Config::workspace_urgency_timer, and x_deco_recurse().

Referenced by cmd_reload(), and main().

Here is the call graph for this function:

static void parse_configuration ( const char *  override_configpath)
static

Definition at line 117 of file config.c.

References current_configpath, FREE, get_config_path(), LOG, and parse_file().

Referenced by load_configuration().

Here is the call graph for this function:

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 28 of file config.c.

References DLOG, and root.

Referenced by handle_mapping_notify(), load_configuration(), switch_mode(), and xkb_got_event().

void update_barconfig ( )

Sends the current bar configuration as an event to all barconfig_update listeners.

Definition at line 37 of file config.c.

References barconfigs, ipc_send_barconfig_update_event(), and TAILQ_FOREACH.

Referenced by cmd_bar(), and cmd_reload().

Here is the call graph for this function:

Variable Documentation

struct barconfig_head barconfigs = TAILQ_HEAD_INITIALIZER(barconfigs)
Config config
char* current_configpath = NULL

Definition at line 18 of file config.c.

Referenced by parse_configuration(), and x_set_i3_atoms().

struct modes_head modes

Definition at line 20 of file config.c.

Referenced by load_configuration(), mode_from_name(), and switch_mode().