2011-10-19 23:58:19 +02:00
|
|
|
/*
|
|
|
|
* vim:ts=4:sw=4:expandtab
|
|
|
|
*
|
|
|
|
* i3bar - an xcb-based status- and ws-bar for i3
|
2015-04-04 02:17:56 +02:00
|
|
|
* © 2010 Axel Wagner and contributors (see also: LICENSE)
|
2011-10-19 23:58:19 +02:00
|
|
|
*
|
2011-10-25 22:19:38 +02:00
|
|
|
* config.c: Parses the configuration (received from i3).
|
2011-10-19 23:58:19 +02:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
#include <string.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <errno.h>
|
|
|
|
#include <i3/ipc.h>
|
|
|
|
#include <yajl/yajl_parse.h>
|
|
|
|
#include <yajl/yajl_version.h>
|
|
|
|
|
2011-12-12 06:58:57 +01:00
|
|
|
#include <X11/Xlib.h>
|
|
|
|
|
2011-10-19 23:58:19 +02:00
|
|
|
#include "common.h"
|
|
|
|
|
|
|
|
static char *cur_key;
|
2015-05-23 22:48:29 +02:00
|
|
|
static bool parsing_bindings;
|
2015-10-16 11:34:19 +02:00
|
|
|
static bool parsing_tray_outputs;
|
2011-10-19 23:58:19 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Parse a key.
|
|
|
|
*
|
|
|
|
* Essentially we just save it in cur_key.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
static int config_map_key_cb(void *params_, const unsigned char *keyVal, size_t keyLen) {
|
|
|
|
FREE(cur_key);
|
2015-10-17 22:14:48 +02:00
|
|
|
sasprintf(&(cur_key), "%.*s", keyLen, keyVal);
|
2011-10-19 23:58:19 +02:00
|
|
|
|
2015-10-16 11:34:19 +02:00
|
|
|
if (strcmp(cur_key, "bindings") == 0) {
|
2015-05-23 22:48:29 +02:00
|
|
|
parsing_bindings = true;
|
2015-10-16 11:34:19 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (strcmp(cur_key, "tray_outputs") == 0) {
|
|
|
|
parsing_tray_outputs = true;
|
|
|
|
}
|
2015-06-13 14:58:41 +02:00
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2015-05-23 22:48:29 +02:00
|
|
|
static int config_end_array_cb(void *params_) {
|
|
|
|
parsing_bindings = false;
|
2015-10-16 11:34:19 +02:00
|
|
|
parsing_tray_outputs = false;
|
2011-10-19 23:58:19 +02:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2011-10-21 21:04:55 +02:00
|
|
|
/*
|
2015-03-23 20:56:49 +01:00
|
|
|
* Parse a null value (current_workspace)
|
2011-10-21 21:04:55 +02:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
static int config_null_cb(void *params_) {
|
|
|
|
if (!strcmp(cur_key, "id")) {
|
|
|
|
/* If 'id' is NULL, the bar config was not found. Error out. */
|
|
|
|
ELOG("No such bar config. Use 'i3-msg -t get_bar_config' to get the available configs.\n");
|
|
|
|
ELOG("Are you starting i3bar by hand? You should not:\n");
|
|
|
|
ELOG("Configure a 'bar' block in your i3 config and i3 will launch i3bar automatically.\n");
|
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
}
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2011-10-19 23:58:19 +02:00
|
|
|
/*
|
|
|
|
* Parse a string
|
|
|
|
*
|
|
|
|
*/
|
2011-10-23 17:39:18 +02:00
|
|
|
static int config_string_cb(void *params_, const unsigned char *val, size_t _len) {
|
|
|
|
int len = (int)_len;
|
2012-01-20 23:29:10 +01:00
|
|
|
/* The id and socket_path are ignored, we already know them. */
|
|
|
|
if (!strcmp(cur_key, "id") || !strcmp(cur_key, "socket_path"))
|
2011-10-19 23:58:19 +02:00
|
|
|
return 1;
|
|
|
|
|
2015-05-23 22:48:29 +02:00
|
|
|
if (parsing_bindings) {
|
|
|
|
if (strcmp(cur_key, "command") == 0) {
|
|
|
|
binding_t *binding = TAILQ_LAST(&(config.bindings), bindings_head);
|
|
|
|
if (binding == NULL) {
|
|
|
|
ELOG("There is no binding to put the current command onto. This is a bug in i3.\n");
|
|
|
|
return 0;
|
|
|
|
}
|
2015-06-13 14:58:41 +02:00
|
|
|
|
2015-05-23 22:48:29 +02:00
|
|
|
if (binding->command != NULL) {
|
|
|
|
ELOG("The binding for input_code = %d already has a command. This is a bug in i3.\n", binding->input_code);
|
|
|
|
return 0;
|
2015-06-13 14:58:41 +02:00
|
|
|
}
|
2015-05-23 22:48:29 +02:00
|
|
|
|
|
|
|
sasprintf(&(binding->command), "%.*s", len, val);
|
|
|
|
return 1;
|
2015-06-13 14:58:41 +02:00
|
|
|
}
|
|
|
|
|
2015-05-23 22:48:29 +02:00
|
|
|
ELOG("Unknown key \"%s\" while parsing bar bindings.\n", cur_key);
|
|
|
|
return 0;
|
2015-06-13 14:58:41 +02:00
|
|
|
}
|
|
|
|
|
2015-10-16 11:34:19 +02:00
|
|
|
if (parsing_tray_outputs) {
|
|
|
|
DLOG("Adding tray_output = %.*s to the list.\n", len, val);
|
|
|
|
tray_output_t *tray_output = scalloc(1, sizeof(tray_output_t));
|
|
|
|
sasprintf(&(tray_output->output), "%.*s", len, val);
|
|
|
|
TAILQ_INSERT_TAIL(&(config.tray_outputs), tray_output, tray_outputs);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2011-10-19 23:58:19 +02:00
|
|
|
if (!strcmp(cur_key, "mode")) {
|
|
|
|
DLOG("mode = %.*s, len = %d\n", len, val, len);
|
2014-06-15 19:07:02 +02:00
|
|
|
config.hide_on_modifier = (len == 4 && !strncmp((const char *)val, "dock", strlen("dock")) ? M_DOCK
|
|
|
|
: (len == 4 && !strncmp((const char *)val, "hide", strlen("hide")) ? M_HIDE
|
|
|
|
: M_INVISIBLE));
|
introduced i3 command for changing the hidden state and the mode of i3bar
The hidden_state and mode of each i3bar instance can now be controlled from within i3.
Therefore, two new i3 command were introduced:
_
bar hidden_state show|hide|toggle [<bar_id>]
show: always show the bar
hide: normal hide mode
toggle: toggle between show and hide (individually for each bar)
_
bar mode dock|hide|invisible|toggle [<bar_id>]
hide,dock: like before
invisible: always keep the bar hidden
toggle: toggle between dock and hide (individually for each bar)
This patch introduces a hidden_state ("hidden_state hide|show") in the
barconfig, which indicates the current hidden_state of each i3bar
instance. It only affects the bar when in hide mode. Additionally, a new
invisible mode was introduced. In order to change the hidden_state or
mode of the bar from i3, a barconfig-update event was introduced, for
which a bar can subscribe and the bar then gets notified about the
currently set hidden_state and mode in its barconfig.
For convenience, an id field ("id <bar_id>") was added to the barconfig, where one can
set the desired id for the corresponding bar. If the id is not specified, i3 will
deterministically choose an id; otherwise, with the previous random approach for finding
a new id, which is actually not shared with i3bar, as it would determine its id on
startup, the event-subscription would be destroyed on reload. Still, this issue remains
when manually changing the bar_id in the config and then reloading.
fixes #833, #651
2013-05-25 14:30:00 +02:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!strcmp(cur_key, "hidden_state")) {
|
|
|
|
DLOG("hidden_state = %.*s, len = %d\n", len, val, len);
|
2014-06-15 19:07:02 +02:00
|
|
|
config.hidden_state = (len == 4 && !strncmp((const char *)val, "hide", strlen("hide")) ? S_HIDE : S_SHOW);
|
2011-10-19 23:58:19 +02:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2011-12-12 06:58:57 +01:00
|
|
|
if (!strcmp(cur_key, "modifier")) {
|
|
|
|
DLOG("modifier = %.*s\n", len, val);
|
2016-02-11 19:57:32 +01:00
|
|
|
if (len == 4 && !strncmp((const char *)val, "none", strlen("none"))) {
|
|
|
|
config.modifier = XCB_NONE;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2014-06-15 19:07:02 +02:00
|
|
|
if (len == 5 && !strncmp((const char *)val, "shift", strlen("shift"))) {
|
2011-12-12 06:58:57 +01:00
|
|
|
config.modifier = ShiftMask;
|
|
|
|
return 1;
|
|
|
|
}
|
2014-06-15 19:07:02 +02:00
|
|
|
if (len == 4 && !strncmp((const char *)val, "ctrl", strlen("ctrl"))) {
|
2011-12-12 06:58:57 +01:00
|
|
|
config.modifier = ControlMask;
|
|
|
|
return 1;
|
|
|
|
}
|
2014-06-15 19:07:02 +02:00
|
|
|
if (len == 4 && !strncmp((const char *)val, "Mod", strlen("Mod"))) {
|
2011-12-12 06:58:57 +01:00
|
|
|
switch (val[3]) {
|
|
|
|
case '1':
|
|
|
|
config.modifier = Mod1Mask;
|
|
|
|
return 1;
|
|
|
|
case '2':
|
|
|
|
config.modifier = Mod2Mask;
|
|
|
|
return 1;
|
|
|
|
case '3':
|
|
|
|
config.modifier = Mod3Mask;
|
|
|
|
return 1;
|
|
|
|
case '5':
|
|
|
|
config.modifier = Mod5Mask;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
2016-02-11 19:57:32 +01:00
|
|
|
|
2011-12-12 06:58:57 +01:00
|
|
|
config.modifier = Mod4Mask;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2015-06-13 14:58:41 +02:00
|
|
|
/* This key was sent in <= 4.10.2. We keep it around to avoid breakage for
|
|
|
|
* users updating from that version and restarting i3bar before i3. */
|
2014-07-04 11:53:22 +02:00
|
|
|
if (!strcmp(cur_key, "wheel_up_cmd")) {
|
|
|
|
DLOG("wheel_up_cmd = %.*s\n", len, val);
|
2015-08-03 11:50:13 +02:00
|
|
|
binding_t *binding = scalloc(1, sizeof(binding_t));
|
2015-06-13 14:58:41 +02:00
|
|
|
binding->input_code = 4;
|
|
|
|
sasprintf(&(binding->command), "%.*s", len, val);
|
|
|
|
TAILQ_INSERT_TAIL(&(config.bindings), binding, bindings);
|
2014-07-04 11:53:22 +02:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2015-06-13 14:58:41 +02:00
|
|
|
/* This key was sent in <= 4.10.2. We keep it around to avoid breakage for
|
|
|
|
* users updating from that version and restarting i3bar before i3. */
|
2014-07-04 11:53:22 +02:00
|
|
|
if (!strcmp(cur_key, "wheel_down_cmd")) {
|
|
|
|
DLOG("wheel_down_cmd = %.*s\n", len, val);
|
2015-08-03 11:50:13 +02:00
|
|
|
binding_t *binding = scalloc(1, sizeof(binding_t));
|
2015-06-13 14:58:41 +02:00
|
|
|
binding->input_code = 5;
|
|
|
|
sasprintf(&(binding->command), "%.*s", len, val);
|
|
|
|
TAILQ_INSERT_TAIL(&(config.bindings), binding, bindings);
|
2014-07-04 11:53:22 +02:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2011-10-19 23:58:19 +02:00
|
|
|
if (!strcmp(cur_key, "position")) {
|
|
|
|
DLOG("position = %.*s\n", len, val);
|
2014-06-15 19:07:02 +02:00
|
|
|
config.position = (len == 3 && !strncmp((const char *)val, "top", strlen("top")) ? POS_TOP : POS_BOT);
|
2011-10-19 23:58:19 +02:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!strcmp(cur_key, "status_command")) {
|
|
|
|
DLOG("command = %.*s\n", len, val);
|
2011-10-23 14:16:56 +02:00
|
|
|
sasprintf(&config.command, "%.*s", len, val);
|
2011-10-19 23:58:19 +02:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!strcmp(cur_key, "font")) {
|
|
|
|
DLOG("font = %.*s\n", len, val);
|
2011-10-23 14:16:56 +02:00
|
|
|
sasprintf(&config.fontname, "%.*s", len, val);
|
2011-10-19 23:58:19 +02:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2015-03-24 23:07:25 +01:00
|
|
|
if (!strcmp(cur_key, "separator_symbol")) {
|
|
|
|
DLOG("separator = %.*s\n", len, val);
|
|
|
|
I3STRING_FREE(config.separator_symbol);
|
|
|
|
config.separator_symbol = i3string_from_utf8_with_length((const char *)val, len);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2011-10-19 23:58:19 +02:00
|
|
|
if (!strcmp(cur_key, "outputs")) {
|
2011-10-21 23:17:41 +02:00
|
|
|
DLOG("+output %.*s\n", len, val);
|
|
|
|
int new_num_outputs = config.num_outputs + 1;
|
2014-06-15 19:07:02 +02:00
|
|
|
config.outputs = srealloc(config.outputs, sizeof(char *) * new_num_outputs);
|
2011-10-23 14:16:56 +02:00
|
|
|
sasprintf(&config.outputs[config.num_outputs], "%.*s", len, val);
|
2011-10-21 23:17:41 +02:00
|
|
|
config.num_outputs = new_num_outputs;
|
2011-10-19 23:58:19 +02:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2015-10-16 11:34:19 +02:00
|
|
|
/* We keep the old single tray_output working for users who only restart i3bar
|
|
|
|
* after updating. */
|
2011-10-19 23:58:19 +02:00
|
|
|
if (!strcmp(cur_key, "tray_output")) {
|
2015-10-16 11:34:19 +02:00
|
|
|
DLOG("Found deprecated key tray_output %.*s.\n", len, val);
|
|
|
|
tray_output_t *tray_output = scalloc(1, sizeof(tray_output_t));
|
|
|
|
sasprintf(&(tray_output->output), "%.*s", len, val);
|
|
|
|
TAILQ_INSERT_TAIL(&(config.tray_outputs), tray_output, tray_outputs);
|
2011-10-19 23:58:19 +02:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2014-06-15 19:07:02 +02:00
|
|
|
#define COLOR(json_name, struct_name) \
|
|
|
|
do { \
|
|
|
|
if (!strcmp(cur_key, #json_name)) { \
|
2011-10-19 23:58:19 +02:00
|
|
|
DLOG(#json_name " = " #struct_name " = %.*s\n", len, val); \
|
2011-10-23 14:16:56 +02:00
|
|
|
sasprintf(&(config.colors.struct_name), "%.*s", len, val); \
|
2014-06-15 19:07:02 +02:00
|
|
|
return 1; \
|
|
|
|
} \
|
2011-10-19 23:58:19 +02:00
|
|
|
} while (0)
|
|
|
|
|
|
|
|
COLOR(statusline, bar_fg);
|
|
|
|
COLOR(background, bar_bg);
|
2013-01-27 21:27:21 +01:00
|
|
|
COLOR(separator, sep_fg);
|
2015-10-26 21:55:01 +01:00
|
|
|
COLOR(focused_statusline, focus_bar_fg);
|
|
|
|
COLOR(focused_background, focus_bar_bg);
|
|
|
|
COLOR(focused_separator, focus_sep_fg);
|
2012-01-20 22:36:50 +01:00
|
|
|
COLOR(focused_workspace_border, focus_ws_border);
|
2012-01-20 23:03:52 +01:00
|
|
|
COLOR(focused_workspace_bg, focus_ws_bg);
|
2011-10-19 23:58:19 +02:00
|
|
|
COLOR(focused_workspace_text, focus_ws_fg);
|
2012-01-20 22:36:50 +01:00
|
|
|
COLOR(active_workspace_border, active_ws_border);
|
2012-01-20 23:03:52 +01:00
|
|
|
COLOR(active_workspace_bg, active_ws_bg);
|
2011-10-19 23:58:19 +02:00
|
|
|
COLOR(active_workspace_text, active_ws_fg);
|
2012-01-20 22:36:50 +01:00
|
|
|
COLOR(inactive_workspace_border, inactive_ws_border);
|
2012-01-20 23:03:52 +01:00
|
|
|
COLOR(inactive_workspace_bg, inactive_ws_bg);
|
2011-10-19 23:58:19 +02:00
|
|
|
COLOR(inactive_workspace_text, inactive_ws_fg);
|
2012-01-20 22:36:50 +01:00
|
|
|
COLOR(urgent_workspace_border, urgent_ws_border);
|
2012-01-20 23:03:52 +01:00
|
|
|
COLOR(urgent_workspace_bg, urgent_ws_bg);
|
2011-10-19 23:58:19 +02:00
|
|
|
COLOR(urgent_workspace_text, urgent_ws_fg);
|
2015-05-31 16:07:23 +02:00
|
|
|
COLOR(binding_mode_border, binding_mode_border);
|
|
|
|
COLOR(binding_mode_bg, binding_mode_bg);
|
|
|
|
COLOR(binding_mode_text, binding_mode_fg);
|
2011-10-19 23:58:19 +02:00
|
|
|
|
|
|
|
printf("got unexpected string %.*s for cur_key = %s\n", len, val, cur_key);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Parse a boolean value
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
static int config_boolean_cb(void *params_, int val) {
|
2013-08-09 05:30:14 +02:00
|
|
|
if (!strcmp(cur_key, "binding_mode_indicator")) {
|
|
|
|
DLOG("binding_mode_indicator = %d\n", val);
|
|
|
|
config.disable_binding_mode_indicator = !val;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2011-10-19 23:58:19 +02:00
|
|
|
if (!strcmp(cur_key, "workspace_buttons")) {
|
|
|
|
DLOG("workspace_buttons = %d\n", val);
|
|
|
|
config.disable_ws = !val;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2014-05-05 19:56:47 +02:00
|
|
|
if (!strcmp(cur_key, "strip_workspace_numbers")) {
|
|
|
|
DLOG("strip_workspace_numbers = %d\n", val);
|
|
|
|
config.strip_ws_numbers = val;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2011-10-19 23:58:19 +02:00
|
|
|
if (!strcmp(cur_key, "verbose")) {
|
|
|
|
DLOG("verbose = %d\n", val);
|
|
|
|
config.verbose = val;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2015-05-23 22:48:29 +02:00
|
|
|
/*
|
|
|
|
* Parse an integer value
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
static int config_integer_cb(void *params_, long long val) {
|
|
|
|
if (parsing_bindings) {
|
|
|
|
if (strcmp(cur_key, "input_code") == 0) {
|
2015-08-03 11:50:13 +02:00
|
|
|
binding_t *binding = scalloc(1, sizeof(binding_t));
|
2015-05-23 22:48:29 +02:00
|
|
|
binding->input_code = val;
|
|
|
|
TAILQ_INSERT_TAIL(&(config.bindings), binding, bindings);
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
ELOG("Unknown key \"%s\" while parsing bar bindings.\n", cur_key);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2015-06-09 10:06:45 +02:00
|
|
|
if (!strcmp(cur_key, "tray_padding")) {
|
|
|
|
DLOG("tray_padding = %lld\n", val);
|
|
|
|
config.tray_padding = val;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2015-05-23 22:48:29 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2011-10-19 23:58:19 +02:00
|
|
|
/* A datastructure to pass all these callbacks to yajl */
|
|
|
|
static yajl_callbacks outputs_callbacks = {
|
2014-01-01 17:19:55 +01:00
|
|
|
.yajl_null = config_null_cb,
|
|
|
|
.yajl_boolean = config_boolean_cb,
|
2015-05-23 22:48:29 +02:00
|
|
|
.yajl_integer = config_integer_cb,
|
2014-01-01 17:19:55 +01:00
|
|
|
.yajl_string = config_string_cb,
|
2015-05-23 22:48:29 +02:00
|
|
|
.yajl_end_array = config_end_array_cb,
|
2014-01-01 17:19:55 +01:00
|
|
|
.yajl_map_key = config_map_key_cb,
|
2011-10-19 23:58:19 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
2015-03-23 20:56:49 +01:00
|
|
|
* Start parsing the received bar configuration JSON string
|
2011-10-19 23:58:19 +02:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
void parse_config_json(char *json) {
|
|
|
|
yajl_handle handle;
|
|
|
|
yajl_status state;
|
|
|
|
handle = yajl_alloc(&outputs_callbacks, NULL, NULL);
|
|
|
|
|
2015-05-23 22:48:29 +02:00
|
|
|
TAILQ_INIT(&(config.bindings));
|
2015-10-16 11:34:19 +02:00
|
|
|
TAILQ_INIT(&(config.tray_outputs));
|
2015-06-13 14:58:41 +02:00
|
|
|
|
2014-06-15 19:07:02 +02:00
|
|
|
state = yajl_parse(handle, (const unsigned char *)json, strlen(json));
|
2011-10-19 23:58:19 +02:00
|
|
|
|
2015-03-24 13:41:16 +01:00
|
|
|
/* FIXME: Proper error handling for JSON parsing */
|
2011-10-19 23:58:19 +02:00
|
|
|
switch (state) {
|
|
|
|
case yajl_status_ok:
|
|
|
|
break;
|
|
|
|
case yajl_status_client_canceled:
|
|
|
|
case yajl_status_error:
|
2015-03-23 20:56:49 +01:00
|
|
|
ELOG("Could not parse config reply!\n");
|
2011-10-19 23:58:19 +02:00
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
yajl_free(handle);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* free()s the color strings as soon as they are not needed anymore.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
void free_colors(struct xcb_color_strings_t *colors) {
|
2014-07-02 19:06:01 +02:00
|
|
|
#define FREE_COLOR(x) \
|
|
|
|
do { \
|
|
|
|
FREE(colors->x); \
|
2011-10-19 23:58:19 +02:00
|
|
|
} while (0)
|
|
|
|
FREE_COLOR(bar_fg);
|
|
|
|
FREE_COLOR(bar_bg);
|
2013-01-27 21:27:21 +01:00
|
|
|
FREE_COLOR(sep_fg);
|
2015-10-26 21:55:01 +01:00
|
|
|
FREE_COLOR(focus_bar_fg);
|
|
|
|
FREE_COLOR(focus_bar_bg);
|
|
|
|
FREE_COLOR(focus_sep_fg);
|
2011-10-19 23:58:19 +02:00
|
|
|
FREE_COLOR(active_ws_fg);
|
|
|
|
FREE_COLOR(active_ws_bg);
|
2012-01-20 22:36:50 +01:00
|
|
|
FREE_COLOR(active_ws_border);
|
2011-10-19 23:58:19 +02:00
|
|
|
FREE_COLOR(inactive_ws_fg);
|
|
|
|
FREE_COLOR(inactive_ws_bg);
|
2012-01-20 22:36:50 +01:00
|
|
|
FREE_COLOR(inactive_ws_border);
|
2011-10-19 23:58:19 +02:00
|
|
|
FREE_COLOR(urgent_ws_fg);
|
|
|
|
FREE_COLOR(urgent_ws_bg);
|
2012-01-20 22:36:50 +01:00
|
|
|
FREE_COLOR(urgent_ws_border);
|
2011-10-19 23:58:19 +02:00
|
|
|
FREE_COLOR(focus_ws_fg);
|
|
|
|
FREE_COLOR(focus_ws_bg);
|
2012-01-20 22:36:50 +01:00
|
|
|
FREE_COLOR(focus_ws_border);
|
2015-05-31 16:07:23 +02:00
|
|
|
FREE_COLOR(binding_mode_fg);
|
|
|
|
FREE_COLOR(binding_mode_bg);
|
|
|
|
FREE_COLOR(binding_mode_border);
|
2011-10-19 23:58:19 +02:00
|
|
|
#undef FREE_COLOR
|
|
|
|
}
|