i3 - improved tiling WM


Add client.focused_float color

Patch status: rejected

Patch by oblique

To apply this patch, use:
curl http://cr.i3wm.org/patch/56/raw.patch | git am

b/docs/userguide

19
@@ -718,6 +718,8 @@ Where colorclass can be one of:
20
 
21
 client.focused::
22
 	A client which currently has the focus.
23
+client.focused_float::
24
+	A client which currently has the focus, but is a floating window.
25
 client.focused_inactive::
26
 	A client which is the focused one of its container, but it does not have
27
 	the focus at the moment.

b/include/config.h

32
@@ -177,6 +177,7 @@ struct Config {
33
     struct config_client {
34
         uint32_t background;
35
         struct Colortriple focused;
36
+        struct Colortriple focused_float;
37
         struct Colortriple focused_inactive;
38
         struct Colortriple unfocused;
39
         struct Colortriple urgent;

b/parser-specs/config.spec

44
@@ -44,7 +44,7 @@ state INITIAL:
45
   exectype = 'exec_always', 'exec'         -> EXEC
46
   colorclass = 'client.background'
47
       -> COLOR_SINGLE
48
-  colorclass = 'client.focused_inactive', 'client.focused', 'client.unfocused', 'client.urgent'
49
+  colorclass = 'client.focused_inactive', 'client.focused_float', 'client.focused', 'client.unfocused', 'client.urgent'
50
       -> COLOR_BORDER
51
 
52
 # We ignore comments and 'set' lines (variables).

b/src/config.c

57
@@ -409,6 +409,7 @@ void load_configuration(xcb_connection_t *conn, const char *override_configpath,
58
 
59
     config.client.background = get_colorpixel("#000000");
60
     INIT_COLOR(config.client.focused, "#4c7899", "#285577", "#ffffff", "#2e9ef4");
61
+    INIT_COLOR(config.client.focused_float, "#4c7899", "#285577", "#ffffff", "#2e9ef4");
62
     INIT_COLOR(config.client.focused_inactive, "#333333", "#5f676a", "#ffffff", "#484e50");
63
     INIT_COLOR(config.client.unfocused, "#333333", "#222222", "#888888", "#292d2e");
64
     INIT_COLOR(config.client.urgent, "#2f343a", "#900000", "#ffffff", "#900000");

b/src/config_directives.c

69
@@ -415,6 +415,7 @@ CFGFUN(color, const char *colorclass, const char *border, const char *background
70
     } while (0)
71
 
72
     APPLY_COLORS(focused_inactive);
73
+    APPLY_COLORS(focused_float);
74
     APPLY_COLORS(focused);
75
     APPLY_COLORS(unfocused);
76
     APPLY_COLORS(urgent);

b/src/x.c

81
@@ -334,9 +334,12 @@ void x_draw_decoration(Con *con) {
82
     /* find out which colors to use */
83
     if (con->urgent)
84
         p->color = &config.client.urgent;
85
-    else if (con == focused || con_inside_focused(con))
86
-        p->color = &config.client.focused;
87
-    else if (con == TAILQ_FIRST(&(parent->focus_head)))
88
+    else if (con == focused || con_inside_focused(con)) {
89
+        if (con_is_floating(con))
90
+            p->color = &config.client.focused_float;
91
+        else
92
+            p->color = &config.client.focused;
93
+    } else if (con == TAILQ_FIRST(&(parent->focus_head)))
94
         p->color = &config.client.focused_inactive;
95
     else
96
         p->color = &config.client.unfocused;

b/testcases/t/201-config-parser.t

101
@@ -366,6 +366,7 @@ is(parser_calls($config),
102
 
103
 $config = <<'EOT';
104
 client.focused          #4c7899 #285577 #ffffff #2e9ef4
105
+client.focused_float    #4c7899 #285577 #ffffff #2e9ef4
106
 client.focused_inactive #333333 #5f676a #ffffff #484e50
107
 client.unfocused        #333333 #222222 #888888 #292d2e
108
 client.urgent           #2f343a #900000 #ffffff #900000
109
@@ -373,6 +374,7 @@ EOT
110
 
111
 $expected = <<'EOT';
112
 cfg_color(client.focused, #4c7899, #285577, #ffffff, #2e9ef4)
113
+cfg_color(client.focused_float, #4c7899, #285577, #ffffff, #2e9ef4)
114
 cfg_color(client.focused_inactive, #333333, #5f676a, #ffffff, #484e50)
115
 cfg_color(client.unfocused, #333333, #222222, #888888, #292d2e)
116
 cfg_color(client.urgent, #2f343a, #900000, #ffffff, #900000)
117
@@ -392,7 +394,7 @@ client.focused          #4c7899 #285577 #ffffff #2e9ef4
118
 EOT
119
 
120
 my $expected_all_tokens = <<'EOT';
121
-ERROR: CONFIG: Expected one of these tokens: <end>, '#', 'set', 'bindsym', 'bindcode', 'bind', 'bar', 'font', 'mode', 'floating_minimum_size', 'floating_maximum_size', 'floating_modifier', 'default_orientation', 'workspace_layout', 'new_window', 'new_float', 'hide_edge_borders', 'for_window', 'assign', 'focus_follows_mouse', 'force_focus_wrapping', 'force_xinerama', 'force-xinerama', 'workspace_auto_back_and_forth', 'fake_outputs', 'fake-outputs', 'force_display_urgency_hint', 'workspace', 'ipc_socket', 'ipc-socket', 'restart_state', 'popup_during_fullscreen', 'exec_always', 'exec', 'client.background', 'client.focused_inactive', 'client.focused', 'client.unfocused', 'client.urgent'
122
+ERROR: CONFIG: Expected one of these tokens: <end>, '#', 'set', 'bindsym', 'bindcode', 'bind', 'bar', 'font', 'mode', 'floating_minimum_size', 'floating_maximum_size', 'floating_modifier', 'default_orientation', 'workspace_layout', 'new_window', 'new_float', 'hide_edge_borders', 'for_window', 'assign', 'focus_follows_mouse', 'force_focus_wrapping', 'force_xinerama', 'force-xinerama', 'workspace_auto_back_and_forth', 'fake_outputs', 'fake-outputs', 'force_display_urgency_hint', 'workspace', 'ipc_socket', 'ipc-socket', 'restart_state', 'popup_during_fullscreen', 'exec_always', 'exec', 'client.background', 'client.focused_inactive', 'client.focused_float', 'client.focused', 'client.unfocused', 'client.urgent'
123
 EOT
124
 
125
 my $expected_end = <<'EOT';