add setting decoration colors for specific windows
Patch status: rejected
Patch by Lukas
To apply this patch, use:
curl http://cr.i3wm.org/patch/674/raw.patch | git am
b/docs/userguide
19 |
@@ -743,6 +743,8 @@ workspace 5 output VGA1
|
20 |
workspace "2: vim" output VGA1
|
21 |
---------------------------
|
22 |
|
23 |
+[[changing_colors]]
|
24 |
+
|
25 |
=== Changing colors
|
26 |
|
27 |
You can change all colors which i3 uses to draw the window decorations.
|
28 |
@@ -1873,9 +1875,26 @@ bindsym $mod+y border 1pixel
|
29 |
bindsym $mod+u border none
|
30 |
----------------------------
|
31 |
|
32 |
-[[stack-limit]]
|
33 |
+
|
34 |
+=== Setting decoration colors for specific windows
|
35 |
+
|
36 |
+For setting the decoration colors of specific windows when they're not
|
37 |
+focused, you can use the +set_color+ command.
|
38 |
+
|
39 |
+*Syntax*:
|
40 |
+------------------------------
|
41 |
+set_color none|(<border> <background> <text>)
|
42 |
+------------------------------
|
43 |
+
|
44 |
++none+ uses the default colors from +client.unfocused+, for the meaning
|
45 |
+of +<border> <background> <text>+, see <<changing_colors>>.
|
46 |
+
|
47 |
+
|
48 |
+
|
49 |
|
50 |
///////////////////////////////////////////////////////////////////////////////
|
51 |
+[[stack-limit]]
|
52 |
+
|
53 |
TODO: not yet implemented
|
54 |
=== Changing the stack-limit of a container
|
55 |
|
b/include/commands.h
60 |
@@ -276,6 +276,13 @@ void cmd_rename_workspace(I3_CMD, char *old_name, char *new_name);
|
61 |
*/
|
62 |
void cmd_bar(I3_CMD, char *bar_type, char *bar_value, char *bar_id);
|
63 |
|
64 |
+/**
|
65 |
+ * Implementation of 'set_color none|(<border> <background> <text>)'
|
66 |
+ *
|
67 |
+ */
|
68 |
+void cmd_set_color(I3_CMD, char *enable, char *border, char *background, char *text);
|
69 |
+
|
70 |
+
|
71 |
/*
|
72 |
* Implementation of 'shmlog <size>|toggle|on|off'
|
73 |
*
|
b/include/data.h
78 |
@@ -491,6 +491,10 @@ typedef enum { CF_NONE = 0,
|
79 |
* A 'Con' represents everything from the X11 root window down to a single X11 window.
|
80 |
*
|
81 |
*/
|
82 |
+
|
83 |
+#include "config.h"
|
84 |
+/* fixme, Con needs Colortriple, but config.h needs structs from this file */
|
85 |
+
|
86 |
struct Con {
|
87 |
bool mapped;
|
88 |
|
89 |
@@ -498,6 +502,11 @@ struct Con {
|
90 |
* inside this container (if any) sets the urgency hint, for example. */
|
91 |
bool urgent;
|
92 |
|
93 |
+ /* if true, custom_color will override the color when this container
|
94 |
+ * is unfocused */
|
95 |
+ bool has_custom_color;
|
96 |
+ struct Colortriple custom_color;
|
97 |
+
|
98 |
/** This counter contains the number of UnmapNotify events for this
|
99 |
* container (or, more precisely, for its ->frame) which should be ignored.
|
100 |
* UnmapNotify events need to be ignored when they are caused by i3 itself,
|
b/parser-specs/commands.spec
105 |
@@ -39,6 +39,7 @@ state INITIAL:
|
106 |
'scratchpad' -> SCRATCHPAD
|
107 |
'mode' -> MODE
|
108 |
'bar' -> BAR
|
109 |
+ 'set_color' -> SET_COLOR_BORDER
|
110 |
|
111 |
state CRITERIA:
|
112 |
ctype = 'class' -> CRITERION
|
113 |
@@ -362,3 +363,17 @@ state BAR_W_ID:
|
114 |
->
|
115 |
end
|
116 |
-> call cmd_bar($bar_type, $bar_value, $bar_id)
|
117 |
+
|
118 |
+state SET_COLOR_BORDER:
|
119 |
+ 'none'
|
120 |
+ -> call cmd_set_color("0", NULL, NULL, NULL)
|
121 |
+ border = word
|
122 |
+ -> SET_COLOR_BACKGROUND
|
123 |
+
|
124 |
+state SET_COLOR_BACKGROUND:
|
125 |
+ background = word
|
126 |
+ -> SET_COLOR_TEXT
|
127 |
+
|
128 |
+state SET_COLOR_TEXT:
|
129 |
+ text = word
|
130 |
+ -> call cmd_set_color("1", $border, $background, $text)
|
b/src/commands.c
135 |
@@ -2176,3 +2176,36 @@ void cmd_debuglog(I3_CMD, char *argument) {
|
136 |
// XXX: default reply for now, make this a better reply
|
137 |
ysuccess(true);
|
138 |
}
|
139 |
+
|
140 |
+
|
141 |
+/*
|
142 |
+ * Implementation of 'set_color none|(<border> <background> <text>)'
|
143 |
+ *
|
144 |
+ */
|
145 |
+void cmd_set_color(I3_CMD, char *enable, char *border, char *background, char *text) {
|
146 |
+ owindow *current;
|
147 |
+
|
148 |
+ HANDLE_EMPTY_MATCH;
|
149 |
+
|
150 |
+ TAILQ_FOREACH(current, &owindows, owindows) {
|
151 |
+ DLOG("matching: %p / %s\n", current->con, current->con->name);
|
152 |
+ if(strcmp(enable, "1")==0) {
|
153 |
+ DLOG("enabling and setting custom colors\n");
|
154 |
+ current->con->has_custom_color=true;
|
155 |
+ current->con->custom_color.border=get_colorpixel(border);
|
156 |
+ current->con->custom_color.background=get_colorpixel(background);
|
157 |
+ current->con->custom_color.text=get_colorpixel(text);
|
158 |
+ }
|
159 |
+ else {
|
160 |
+ DLOG("disabling custom colors\n");
|
161 |
+ current->con->has_custom_color=false;
|
162 |
+ }
|
163 |
+
|
164 |
+ x_draw_decoration(current->con);
|
165 |
+ }
|
166 |
+
|
167 |
+ cmd_output->needs_tree_render = true;
|
168 |
+
|
169 |
+ // XXX: default reply for now, make this a better reply
|
170 |
+ ysuccess(true);
|
171 |
+}
|
b/src/con.c
176 |
@@ -43,6 +43,8 @@ Con *con_new_skeleton(Con *parent, i3Window *window) {
|
177 |
new->window = window;
|
178 |
new->border_style = config.default_border;
|
179 |
new->current_border_width = -1;
|
180 |
+ new->has_custom_color = false;
|
181 |
+ new->custom_color = config.client.unfocused;
|
182 |
if (window)
|
183 |
new->depth = window->depth;
|
184 |
else
|
b/src/x.c
189 |
@@ -345,6 +345,8 @@ void x_draw_decoration(Con *con) {
|
190 |
p->color = &config.client.focused;
|
191 |
else if (con == TAILQ_FIRST(&(parent->focus_head)))
|
192 |
p->color = &config.client.focused_inactive;
|
193 |
+ else if (con->has_custom_color)
|
194 |
+ p->color = &con->custom_color;
|
195 |
else
|
196 |
p->color = &config.client.unfocused;
|
197 |
|