2 #define I3__FILE__ "config.c"
29 DLOG(
"Ungrabbing all keys\n");
30 xcb_ungrab_key(conn, XCB_GRAB_ANY,
root, XCB_BUTTON_MASK_ANY);
53 char *xdg_config_home, *xdg_config_dirs, *config_path;
55 static const char *saved_configpath = NULL;
57 if (override_configpath != NULL) {
58 saved_configpath = override_configpath;
59 return sstrdup(saved_configpath);
62 if (saved_configpath != NULL)
63 return sstrdup(saved_configpath);
72 if ((xdg_config_home = getenv(
"XDG_CONFIG_HOME")) == NULL)
73 xdg_config_home =
"~/.config";
76 sasprintf(&config_path,
"%s/i3/config", xdg_config_home);
77 free(xdg_config_home);
84 config_path = SYSCONFDIR
"/i3/config";
89 if ((xdg_config_dirs = getenv(
"XDG_CONFIG_DIRS")) == NULL)
90 xdg_config_dirs =
"/etc/xdg";
92 char *buf =
sstrdup(xdg_config_dirs);
93 char *tok = strtok(buf,
":");
96 sasprintf(&config_path,
"%s/i3/config", tok);
103 tok = strtok(NULL,
":");
107 die(
"Unable to find the configuration file (looked at "
108 "~/.i3/config, $XDG_CONFIG_HOME/i3/config, " SYSCONFDIR
"/i3/config and $XDG_CONFIG_DIRS/i3/config)");
119 LOG(
"Parsing configfile %s\n", path);
202 workspace_set_name(ws, NULL);
224 #define REQUIRED_OPTION(name) \
225 if (config.name == NULL) \
226 die("You did not specify required configuration option " #name "\n");
229 memset(&config, 0,
sizeof(config));
232 #define INIT_COLOR(x, cborder, cbackground, ctext, cindicator) \
234 x.border = get_colorpixel(cborder); \
235 x.background = get_colorpixel(cbackground); \
236 x.text = get_colorpixel(ctext); \
237 x.indicator = get_colorpixel(cindicator); \
272 if (config.
font.
type == FONT_TYPE_NONE) {
273 ELOG(
"You did not specify required configuration option \"font\"\n");
289 if (ws->name != NULL) {
292 if (ws->text_width == 0)
294 config.
font, ws->name, ws->name_len);
298 workspace_set_name(ws, NULL);
char * font
Font specification for all text rendered on the bar.
int logical_px(const int logical)
Convert a logical amount of pixels (e.g.
char * sstrdup(const char *str)
Safe-wrapper around strdup which exits if malloc returns NULL (meaning that there is no more memory a...
int predict_text_width(i3String *text)
Predict the text width in pixels for the given text.
struct Colortriple unfocused
void set_font(i3Font *font)
Defines the font to be used for the forthcoming calls.
#define TAILQ_REMOVE(head, elm, field)
int default_floating_border_width
char * inactive_workspace_bg
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.
An Assignment makes specific windows go to a specific workspace/output or run a command for that wind...
static char * get_config_path(const char *override_configpath)
void translate_keysyms(void)
Translates keysymbols to keycodes for all bindings which use keysyms.
struct all_cons_head all_cons
char * focused_workspace_bg
char * urgent_workspace_border
struct Barconfig::bar_colors colors
#define SLIST_INSERT_HEAD(head, elm, field)
char * urgent_workspace_text
union Assignment::@17 dest
destination workspace/output/command, depending on the type
char * urgent_workspace_bg
#define TAILQ_FIRST(head)
float workspace_urgency_timer
By default, urgency is cleared immediately when switching to another workspace leads to focusing the ...
void x_deco_recurse(Con *con)
Recursively calls x_draw_decoration.
struct Config::config_client client
struct Colortriple unfocused
static void parse_configuration(const char *override_configpath)
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)
Holds a keybinding, consisting of a keycode combined with modifiers and the command which is executed...
void update_barconfig()
Sends the current bar configuration as an event to all barconfig_update listeners.
int default_orientation
Default orientation for new containers.
char * active_workspace_border
void free_font(void)
Frees the resources taken by the current font.
struct bindings_head * bindings
char * command
Command, like in command mode.
int sasprintf(char **strp, const char *fmt,...)
Safe-wrapper around asprintf which exits if it returns -1 (meaning that there is no more memory avail...
The configuration file can contain multiple sets of bindings.
char * tray_output
Output on which the tray should be shown.
struct Colortriple focused
uint32_t get_colorpixel(const char *hex) __attribute__((const ))
Returns the colorpixel to use for the given hex color (think of HTML).
#define SLIST_EMPTY(head)
struct deco_render_params * deco_render_params
Cache for the decoration rendering.
char * id
Automatically generated ID for this bar config.
enum Font::@21 type
The type of font.
char * focused_workspace_text
#define TAILQ_EMPTY(head)
char * focused_workspace_border
struct assignments_head assignments
struct Colortriple focused
char * active_workspace_text
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 con...
char * i3bar_command
Command that should be run to execute i3bar, give a full path if i3bar is not in your $PATH...
char * resolve_tilde(const char *path)
This function resolves ~ in pathnames.
char * current_configpath
Holds part of the configuration (the part which is not already in dedicated structures in include/dat...
struct Colortriple urgent
border_style_t default_border
The default border style for new windows.
A 'Con' represents everything from the X11 root window down to a single X11 window.
void * scalloc(size_t size)
Safe-wrapper around calloc which exits if malloc returns NULL (meaning that there is no more memory a...
struct bindings_head * bindings
void parse_file(const char *f)
Parses the given file by first replacing the variables, then calling parse_config and possibly launch...
#define INIT_COLOR(x, cborder, cbackground, ctext, cindicator)
#define SLIST_REMOVE(head, elm, type, field)
border_style_t default_floating_border
The default border style for new floating windows.
struct Config::config_bar bar
#define TAILQ_HEAD_INITIALIZER(head)
struct Colortriple focused_inactive
bool path_exists(const char *path)
Checks if the given path exists by calling stat().
struct barconfig_head barconfigs
char ** outputs
Outputs on which this bar should show up on.
enum Assignment::@16 type
type of this assignment:
struct Colortriple urgent
Match match
the criteria to check if a window matches
#define TAILQ_FOREACH(var, head, field)
xcb_keycode_t * translated_to
Only in use if symbol != NULL.
char * active_workspace_bg
char * inactive_workspace_text
char * status_command
Command that should be run to get a statusline, for example 'i3status'.
Holds the status bar configuration (i3bar).
char * socket_path
Path to the i3 IPC socket.
char * inactive_workspace_border
i3Font load_font(const char *pattern, const bool fallback)
Loads a font for usage, also getting its height.
#define SLIST_FIRST(head)
void match_free(Match *match)
Frees the given match.
struct Colortriple placeholder
int num_outputs
Number of outputs in the outputs array.
void ipc_send_barconfig_update_event(Barconfig *barconfig)
For the barconfig update events, we send the serialized barconfig.