]> git.sur5r.net Git - i3/i3/commitdiff
Add Color for focused ws (thx phnom)
authorAxel Wagner <mail@merovius.de>
Sun, 20 Mar 2011 18:29:30 +0000 (19:29 +0100)
committerAxel Wagner <mail@merovius.de>
Sun, 20 Mar 2011 18:29:30 +0000 (19:29 +0100)
i3bar/doc/i3bar.man
i3bar/include/xcb.h
i3bar/src/main.c
i3bar/src/xcb.c

index 41a80bfaef1ac95129a017b5ab897e9448e070d5..44d5e8ac0e08c5e00bbcccd9e762110567c87b4e 100644 (file)
@@ -53,7 +53,7 @@ Also, you should disable the internal workspace bar of *i3*(1), when using *i3ba
 
 For now this happens with the following command-line-options:
 
-*--color-bar-fg, --color-bar-bg, --color-active-ws-fg, --color-active-ws-bg, --color-inactive-ws-fg,  --color-inactive-ws-bg, color-urgent-ws-bg, color-urgent-ws-fg*
+*--color-bar-fg, --color-bar-bg, --color-active-ws-fg, --color-active-ws-bg, --color-inactive-ws-fg,  --color-inactive-ws-bg, --color-urgent-ws-bg, --color-urgent-ws-fg, --color-focus-ws-fg, --color-focus-ws-bg*
 
 For each specified option you need to give a HEX-colorcode.
 
index 931e7643d8aadfb78c6bfaa91209941fc8b829cb..b17329056c09ed289c2083657f7a4f567d731f1c 100644 (file)
@@ -19,6 +19,8 @@ struct xcb_color_strings_t {
     char *active_ws_bg;
     char *inactive_ws_fg;
     char *inactive_ws_bg;
+    char *focus_ws_bg;
+    char *focus_ws_fg;
     char *urgent_ws_bg;
     char *urgent_ws_fg;
 };
index b09a220f683f01b90c31d001af0d4570360bce8b..ad8a999363a005daf56d63040e137f04dcf04af2 100644 (file)
@@ -75,6 +75,8 @@ static void free_colors(struct xcb_color_strings_t *colors) {
     FREE_COLOR(inactive_ws_bg);
     FREE_COLOR(urgent_ws_fg);
     FREE_COLOR(urgent_ws_bg);
+    FREE_COLOR(focus_ws_fg);
+    FREE_COLOR(focus_ws_bg);
 #undef FREE_COLOR
 }
 
@@ -141,10 +143,12 @@ int main(int argc, char **argv) {
         { "color-inactive-ws-bg", required_argument, 0, 'F' },
         { "color-urgent-ws-bg",   required_argument, 0, 'G' },
         { "color-urgent-ws-fg",   required_argument, 0, 'H' },
+        { "color-focus-ws-bg",    required_argument, 0, 'I' },
+        { "color-focus-ws-fg",    required_argument, 0, 'J' },
         { NULL,                   0,                 0, 0}
     };
 
-    while ((opt = getopt_long(argc, argv, "s:c:d::mf:hvVA:B:C:D:E:F:G:H:", long_opt, &option_index)) != -1) {
+    while ((opt = getopt_long(argc, argv, "s:c:d::mf:hvVA:B:C:D:E:F:G:H:I:J:", long_opt, &option_index)) != -1) {
         switch (opt) {
             case 's':
                 socket_path = expand_path(optarg);
@@ -204,6 +208,12 @@ int main(int argc, char **argv) {
             case 'H':
                 read_color(&colors.urgent_ws_fg);
                 break;
+            case 'I':
+                read_color(&colors.focus_ws_bg);
+                break;
+            case 'J':
+                read_color(&colors.focus_ws_fg);
+                break;
             default:
                 print_usage(argv[0]);
                 exit(EXIT_SUCCESS);
index 9cb77f3fdacfa1096e4e35e1b9fad67e25ca8665..96dbe12e17f48b91f81a19057ac9144a9a4ee0b7 100644 (file)
@@ -76,6 +76,8 @@ struct xcb_colors_t {
     uint32_t inactive_ws_bg;
     uint32_t urgent_ws_bg;
     uint32_t urgent_ws_fg;
+    uint32_t focus_ws_bg;
+    uint32_t focus_ws_fg;
 };
 struct xcb_colors_t colors;
 
@@ -276,6 +278,8 @@ void init_colors(const struct xcb_color_strings_t *new_colors) {
     PARSE_COLOR(inactive_ws_bg, "240000");
     PARSE_COLOR(urgent_ws_fg, "FFFFFF");
     PARSE_COLOR(urgent_ws_bg, "002400");
+    PARSE_COLOR(focus_ws_fg, "FFFFFF");
+    PARSE_COLOR(focus_ws_bg, "480000");
 #undef PARSE_COLOR
 }
 
@@ -939,8 +943,13 @@ void draw_bars() {
             uint32_t fg_color = colors.inactive_ws_fg;
             uint32_t bg_color = colors.inactive_ws_bg;
             if (ws_walk->visible) {
-                fg_color = colors.active_ws_fg;
-                bg_color = colors.active_ws_bg;
+                if (!ws_walk->focused) {
+                    fg_color = colors.active_ws_fg;
+                    bg_color = colors.active_ws_bg;
+                } else {
+                    fg_color = colors.focus_ws_fg;
+                    bg_color = colors.focus_ws_bg;
+                }
             }
             if (ws_walk->urgent) {
                 DLOG("WS %s is urgent!\n", ws_walk->name);