2 #define I3__FILE__ "config.c"
14 #include <xkbcommon/xkbcommon.h>
27 DLOG(
"Ungrabbing all keys\n");
28 xcb_ungrab_key(conn, XCB_GRAB_ANY,
root, XCB_BUTTON_MASK_ANY);
51 char *xdg_config_home, *xdg_config_dirs, *config_path;
53 static const char *saved_configpath = NULL;
55 if (override_configpath != NULL) {
56 saved_configpath = override_configpath;
57 return sstrdup(saved_configpath);
60 if (saved_configpath != NULL)
61 return sstrdup(saved_configpath);
70 if ((xdg_config_home = getenv(
"XDG_CONFIG_HOME")) == NULL)
71 xdg_config_home =
"~/.config";
74 sasprintf(&config_path,
"%s/i3/config", xdg_config_home);
75 free(xdg_config_home);
82 config_path = SYSCONFDIR
"/i3/config";
87 if ((xdg_config_dirs = getenv(
"XDG_CONFIG_DIRS")) == NULL)
88 xdg_config_dirs =
"/etc/xdg";
90 char *buf =
sstrdup(xdg_config_dirs);
91 char *tok = strtok(buf,
":");
94 sasprintf(&config_path,
"%s/i3/config", tok);
101 tok = strtok(NULL,
":");
105 die(
"Unable to find the configuration file (looked at "
106 "~/.i3/config, $XDG_CONFIG_HOME/i3/config, " SYSCONFDIR
"/i3/config and $XDG_CONFIG_DIRS/i3/config)");
117 LOG(
"Parsing configfile %s\n", path);
122 if (!use_nagbar &&
bindings == NULL) {
203 workspace_set_name(ws, NULL);
225 #define REQUIRED_OPTION(name) \
226 if (config.name == NULL) \
227 die("You did not specify required configuration option " #name "\n");
230 memset(&config, 0,
sizeof(config));
233 #define INIT_COLOR(x, cborder, cbackground, ctext, cindicator) \
235 x.border = get_colorpixel(cborder); \
236 x.background = get_colorpixel(cbackground); \
237 x.text = get_colorpixel(ctext); \
238 x.indicator = get_colorpixel(cindicator); \
273 if (config.
font.
type == FONT_TYPE_NONE) {
274 ELOG(
"You did not specify required configuration option \"font\"\n");
290 if (ws->name != NULL) {
293 if (ws->text_width == 0)
295 config.
font, ws->name, ws->name_len);
299 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
bool parse_configuration(const char *override_configpath, bool use_nagbar)
Finds the configuration file to use (either the one specified by override_configpath), the user’s one or the system default) and calls parse_file().
#define SLIST_INSERT_HEAD(head, elm, field)
char * urgent_workspace_text
union Assignment::@17 dest
destination workspace/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
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.
bool parse_file(const char *f, bool use_nagbar)
Parses the given file by first replacing the variables, then calling parse_config and launching i3-na...
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
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 binding_free(Binding *bind)
Frees the binding.
#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)
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.