]> git.sur5r.net Git - i3/i3/blobdiff - src/config_directives.c
Smart option added to hide_edge_borders config param (#2191) (#2191)
[i3/i3] / src / config_directives.c
index fcc480945efc33cf2ade27dab37007bfbd548b14..05c19c70628b1d0fff12e286a45e97c63b4f0352 100644 (file)
@@ -223,18 +223,20 @@ CFGFUN(new_window, const char *windowtype, const char *border, const long width)
 }
 
 CFGFUN(hide_edge_borders, const char *borders) {
-    if (strcmp(borders, "vertical") == 0)
-        config.hide_edge_borders = ADJ_LEFT_SCREEN_EDGE | ADJ_RIGHT_SCREEN_EDGE;
+    if (strcmp(borders, "smart") == 0)
+        config.hide_edge_borders = HEBM_SMART;
+    else if (strcmp(borders, "vertical") == 0)
+        config.hide_edge_borders = HEBM_VERTICAL;
     else if (strcmp(borders, "horizontal") == 0)
-        config.hide_edge_borders = ADJ_UPPER_SCREEN_EDGE | ADJ_LOWER_SCREEN_EDGE;
+        config.hide_edge_borders = HEBM_HORIZONTAL;
     else if (strcmp(borders, "both") == 0)
-        config.hide_edge_borders = ADJ_LEFT_SCREEN_EDGE | ADJ_RIGHT_SCREEN_EDGE | ADJ_UPPER_SCREEN_EDGE | ADJ_LOWER_SCREEN_EDGE;
+        config.hide_edge_borders = HEBM_BOTH;
     else if (strcmp(borders, "none") == 0)
-        config.hide_edge_borders = ADJ_NONE;
+        config.hide_edge_borders = HEBM_NONE;
     else if (eval_boolstr(borders))
-        config.hide_edge_borders = ADJ_LEFT_SCREEN_EDGE | ADJ_RIGHT_SCREEN_EDGE;
+        config.hide_edge_borders = HEBM_VERTICAL;
     else
-        config.hide_edge_borders = ADJ_NONE;
+        config.hide_edge_borders = HEBM_NONE;
 }
 
 CFGFUN(focus_follows_mouse, const char *value) {
@@ -261,6 +263,7 @@ CFGFUN(workspace_back_and_forth, const char *value) {
 }
 
 CFGFUN(fake_outputs, const char *outputs) {
+    free(config.fake_outputs);
     config.fake_outputs = sstrdup(outputs);
 }
 
@@ -313,10 +316,12 @@ CFGFUN(workspace, const char *workspace, const char *output) {
 }
 
 CFGFUN(ipc_socket, const char *path) {
+    free(config.ipc_socket_path);
     config.ipc_socket_path = sstrdup(path);
 }
 
 CFGFUN(restart_state, const char *path) {
+    free(config.restart_state_path);
     config.restart_state_path = sstrdup(path);
 }
 
@@ -335,20 +340,22 @@ CFGFUN(color_single, const char *colorclass, const char *color) {
     config.client.background = draw_util_hex_to_color(color);
 }
 
-CFGFUN(color, const char *colorclass, const char *border, const char *background, const char *text, const char *indicator, const char *decoration_border) {
-#define APPLY_COLORS(classname)                                                                        \
-    do {                                                                                               \
-        if (strcmp(colorclass, "client." #classname) == 0) {                                           \
-            config.client.classname.border = draw_util_hex_to_color(border);                           \
-            config.client.classname.background = draw_util_hex_to_color(background);                   \
-            config.client.classname.text = draw_util_hex_to_color(text);                               \
-            if (indicator != NULL) {                                                                   \
-                config.client.classname.indicator = draw_util_hex_to_color(indicator);                 \
-            }                                                                                          \
-            if (decoration_border != NULL) {                                                           \
-                config.client.classname.decoration_border = draw_util_hex_to_color(decoration_border); \
-            }                                                                                          \
-        }                                                                                              \
+CFGFUN(color, const char *colorclass, const char *border, const char *background, const char *text, const char *indicator, const char *child_border) {
+#define APPLY_COLORS(classname)                                                              \
+    do {                                                                                     \
+        if (strcmp(colorclass, "client." #classname) == 0) {                                 \
+            config.client.classname.border = draw_util_hex_to_color(border);                 \
+            config.client.classname.background = draw_util_hex_to_color(background);         \
+            config.client.classname.text = draw_util_hex_to_color(text);                     \
+            if (indicator != NULL) {                                                         \
+                config.client.classname.indicator = draw_util_hex_to_color(indicator);       \
+            }                                                                                \
+            if (child_border != NULL) {                                                      \
+                config.client.classname.child_border = draw_util_hex_to_color(child_border); \
+            } else {                                                                         \
+                config.client.classname.child_border = config.client.classname.background;   \
+            }                                                                                \
+        }                                                                                    \
     } while (0)
 
     APPLY_COLORS(focused_inactive);
@@ -441,6 +448,9 @@ CFGFUN(bar_modifier, const char *modifier) {
         current_bar->modifier = M_CONTROL;
     else if (strcmp(modifier, "Shift") == 0)
         current_bar->modifier = M_SHIFT;
+    else if (strcmp(modifier, "none") == 0 ||
+             strcmp(modifier, "off") == 0)
+        current_bar->modifier = M_NONE;
 }
 
 static void bar_configure_binding(const char *button, const char *command) {
@@ -570,6 +580,7 @@ CFGFUN(bar_start) {
     TAILQ_INIT(&(current_bar->bar_bindings));
     TAILQ_INIT(&(current_bar->tray_outputs));
     current_bar->tray_padding = 2;
+    current_bar->modifier = M_MOD4;
 }
 
 CFGFUN(bar_finish) {