i3
Data Structures | Typedefs | Functions | Variables
include/config.h File Reference
#include <stdbool.h>
#include "queue.h"
#include "i3.h"
#include "libi3.h"
Include dependency graph for config.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  context
 Used during the config file lexing/parsing to keep the state of the lexer in order to provide useful error messages in yyerror(). More...
struct  Colortriple
 Part of the struct Config. More...
struct  Variable
 Holds a user-assigned variable for parsing the configuration file. More...
struct  Mode
 The configuration file can contain multiple sets of bindings. More...
struct  Config
 Holds part of the configuration (the part which is not already in dedicated structures in include/data.h). More...
struct  Config::config_client
struct  Config::config_bar
struct  Barconfig
 Holds the status bar configuration (i3bar). More...
struct  Barconfig::bar_colors

Typedefs

typedef struct Config Config
typedef struct Barconfig Barconfig

Functions

 SLIST_HEAD (modes_head, Mode) modes
 TAILQ_HEAD (barconfig_head, Barconfig) barconfigs
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.
void translate_keysyms ()
 Translates keysymbols to keycodes for all bindings which use keysyms.
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.
void grab_all_keys (xcb_connection_t *conn, bool bind_mode_switch)
 Grab the bound keys (tell X to send us keypress events for those keycodes)
void switch_mode (const char *new_mode)
 Switches the key bindings to the given mode, if the mode exists.
Bindingget_binding (uint16_t modifiers, xcb_keycode_t keycode)
 Returns a pointer to the Binding with the specified modifiers and keycode or NULL if no such binding exists.
void kill_configerror_nagbar (bool wait_for_it)
 Kills the configerror i3-nagbar process, if any.
void parse_file (const char *f)

Variables

char * current_configpath
Config config

Typedef Documentation

typedef struct Barconfig Barconfig

Definition at line 22 of file config.h.

typedef struct Config Config

Definition at line 21 of file config.h.


Function Documentation

Binding* get_binding ( uint16_t  modifiers,
xcb_keycode_t  keycode 
)

Returns a pointer to the Binding with the specified modifiers and keycode or NULL if no such binding exists.

Definition at line 55 of file config.c.

References bindings, Binding::keycode, Binding::mods, Binding::number_keycodes, Binding::symbol, TAILQ_END, TAILQ_FOREACH, and Binding::translated_to.

Referenced by handle_key_press().

void grab_all_keys ( xcb_connection_t *  conn,
bool  bind_mode_switch 
)

Grab the bound keys (tell X to send us keypress events for those keycodes)

Definition at line 133 of file config.c.

References BIND_MODE_SWITCH, bindings, grab_keycode_for_binding(), Binding::keycode, Binding::mods, Binding::number_keycodes, TAILQ_FOREACH, and Binding::translated_to.

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

Here is the call graph for this function:

void kill_configerror_nagbar ( bool  wait_for_it)

Kills the configerror i3-nagbar process, if any.

Called when reloading/restarting.

If wait_for_it is set (restarting), this function will waitpid(), otherwise, ev is assumed to handle it (reloading).

Definition at line 406 of file cfgparse.tab.c.

References configerror_pid.

Referenced by i3_restart().

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 261 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_text, assignments, Config::config_client::background, Barconfig::bar_colors::background, Config::bar, barconfigs, bindings, Mode::bindings, BS_NORMAL, Config::client, Barconfig::colors, Binding::command, Assignment::command, Config::default_border, Config::default_floating_border, Config::default_orientation, Assignment::dest, ELOG, Config::config_client::focused, Config::config_bar::focused, Config::config_client::focused_inactive, Barconfig::bar_colors::focused_workspace_bg, Barconfig::bar_colors::focused_workspace_text, Config::font, Barconfig::font, FREE, get_colorpixel(), grab_all_keys(), Font::id, Barconfig::id, Barconfig::bar_colors::inactive_workspace_bg, Barconfig::bar_colors::inactive_workspace_text, INIT_COLOR, load_font(), Assignment::match, match_free(), modes, Mode::name, NO_ORIENTATION, Barconfig::num_outputs, Assignment::output, Barconfig::outputs, parse_configuration(), predict_text_width(), scalloc(), 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, 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_text, and Assignment::workspace.

Referenced by main().

Here is the call graph for this function:

void parse_file ( const char *  f)
SLIST_HEAD ( modes_head  ,
Mode   
)
void switch_mode ( const char *  new_mode)

Switches the key bindings to the given mode, if the mode exists.

Definition at line 156 of file config.c.

References bindings, Mode::bindings, conn, ELOG, grab_all_keys(), LOG, modes, Mode::name, SLIST_FOREACH, translate_keysyms(), and ungrab_all_keys().

Here is the call graph for this function:

TAILQ_HEAD ( barconfig_head  ,
Barconfig   
)

Translates keysymbols to keycodes for all bindings which use keysyms.

Definition at line 84 of file config.c.

References BIND_MODE_SWITCH, bindings, conn, DLOG, ELOG, FREE, Binding::keycode, keysyms, Binding::mods, Binding::number_keycodes, srealloc(), Binding::symbol, TAILQ_FOREACH, and Binding::translated_to.

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

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

References DLOG, and root.

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


Variable Documentation

Definition at line 16 of file config.c.

Referenced by parse_configuration(), and x_set_i3_atoms().