From 35b70ca423790d071d503ce76d8074e9b30e2dc5 Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Sun, 15 Dec 2013 11:42:40 +0100 Subject: [PATCH] introduce client.placeholder color --- docs/userguide | 4 ++++ include/config.h | 1 + src/config.c | 3 +++ src/restore_layout.c | 9 ++++----- 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/docs/userguide b/docs/userguide index 666b9623..8758e7c5 100644 --- a/docs/userguide +++ b/docs/userguide @@ -727,6 +727,9 @@ client.unfocused:: A client which is not the focused one of its container. client.urgent:: A client which has its urgency hint activated. +client.placeholder:: + Background and text color are used to draw placeholder window contents + (when restoring layouts). Border and indicator are ignored. You can also specify the color to be used to paint the background of the client windows. This color will be used to paint the window on top of which the client @@ -749,6 +752,7 @@ client.focused #4c7899 #285577 #ffffff #2e9ef4 client.focused_inactive #333333 #5f676a #ffffff #484e50 client.unfocused #333333 #222222 #888888 #292d2e client.urgent #2f343a #900000 #ffffff #900000 +client.placeholder #000000 #0c0c0c #ffffff #000000 --------------------------------------------------------- Note that for the window decorations, the color around the child window is the diff --git a/include/config.h b/include/config.h index 4267dcfe..bff8e639 100644 --- a/include/config.h +++ b/include/config.h @@ -180,6 +180,7 @@ struct Config { struct Colortriple focused_inactive; struct Colortriple unfocused; struct Colortriple urgent; + struct Colortriple placeholder; } client; struct config_bar { struct Colortriple focused; diff --git a/src/config.c b/src/config.c index 337b83a8..c030eb9a 100644 --- a/src/config.c +++ b/src/config.c @@ -456,6 +456,9 @@ void load_configuration(xcb_connection_t *conn, const char *override_configpath, INIT_COLOR(config.client.unfocused, "#333333", "#222222", "#888888", "#292d2e"); INIT_COLOR(config.client.urgent, "#2f343a", "#900000", "#ffffff", "#900000"); + /* border and indicator color are ignored for placeholder contents */ + INIT_COLOR(config.client.placeholder, "#000000", "#0c0c0c", "#ffffff", "#000000"); + /* the last argument (indicator color) is ignored for bar colors */ INIT_COLOR(config.bar.focused, "#4c7899", "#285577", "#ffffff", "#000000"); INIT_COLOR(config.bar.unfocused, "#333333", "#222222", "#888888", "#000000"); diff --git a/src/restore_layout.c b/src/restore_layout.c index 1a7dfaf8..f868cf3e 100644 --- a/src/restore_layout.c +++ b/src/restore_layout.c @@ -100,8 +100,8 @@ void restore_connect(void) { } static void update_placeholder_contents(placeholder_state *state) { - // TODO: introduce color configuration for placeholder windows. - xcb_change_gc(restore_conn, state->gc, XCB_GC_FOREGROUND, (uint32_t[]) { config.client.background }); + xcb_change_gc(restore_conn, state->gc, XCB_GC_FOREGROUND, + (uint32_t[]) { config.client.placeholder.background }); xcb_poly_fill_rectangle(restore_conn, state->pixmap, state->gc, 1, (xcb_rectangle_t[]) { { 0, 0, state->rect.width, state->rect.height } }); @@ -109,7 +109,7 @@ static void update_placeholder_contents(placeholder_state *state) { xcb_flush(restore_conn); xcb_aux_sync(restore_conn); - set_font_colors(state->gc, config.client.focused.background, 0); + set_font_colors(state->gc, config.client.placeholder.text, config.client.placeholder.background); Match *swallows; int n = 0; @@ -168,8 +168,7 @@ static void open_placeholder_window(Con *con) { true, XCB_CW_BACK_PIXEL | XCB_CW_EVENT_MASK, (uint32_t[]){ - // TODO: use the background color as background pixel to avoid flickering - root_screen->white_pixel, + config.client.placeholder.background, XCB_EVENT_MASK_EXPOSURE | XCB_EVENT_MASK_STRUCTURE_NOTIFY, }); /* Set the same name as was stored in the layout file. While perhaps -- 2.39.5