From 107ba3fefcde6565f1e4282e7a5cab2bec483e20 Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Sun, 17 Oct 2010 09:24:59 +0200 Subject: [PATCH] Systray: Configure background color via beautiful Signed-off-by: Uli Schlachter --- lib/wibox/widget/systray.lua.in | 4 +++- systray.c | 11 +++++++++++ themes/default/theme.lua.in | 1 + themes/sky/theme.lua.in | 1 + themes/zenburn/theme.lua.in | 13 +++++++------ 5 files changed, 23 insertions(+), 7 deletions(-) diff --git a/lib/wibox/widget/systray.lua.in b/lib/wibox/widget/systray.lua.in index 7daff48c..a28ea5b3 100644 --- a/lib/wibox/widget/systray.lua.in +++ b/lib/wibox/widget/systray.lua.in @@ -6,6 +6,7 @@ local wbase = require("wibox.widget.base") local lbase = require("wibox.layout.base") +local beautiful = require("beautiful") local capi = { awesome = awesome } local setmetatable = setmetatable local error = error @@ -19,6 +20,7 @@ local base_size = nil function draw(box, wibox, cr, width, height) local x, y, width, height = lbase.rect_to_device_geometry(cr, 0, 0, width, height) local num_entries = capi.awesome.systray() + local bg = beautiful.bg_systray or beautiful.bg_normal local in_dir, ortho, base if horizontal then @@ -31,7 +33,7 @@ function draw(box, wibox, cr, width, height) else base = in_dir / num_entries end - capi.awesome.systray(wibox.drawin, x, y, base, horizontal) + capi.awesome.systray(wibox.drawin, x, y, base, horizontal, bg) end function fit(box, width, height) diff --git a/systray.c b/systray.c index bcfd7576..f3244a96 100644 --- a/systray.c +++ b/systray.c @@ -321,11 +321,22 @@ luaA_systray(lua_State *L) { if(lua_gettop(L) != 0) { + size_t bg_len; drawin_t *w = luaA_checkudata(L, 1, &drawin_class); int x = luaL_checknumber(L, 2); int y = luaL_checknumber(L, 3); int base_size = luaL_checknumber(L, 4); bool horiz = lua_toboolean(L, 5); + const char *bg = luaL_checklstring(L, 6, &bg_len); + color_t bg_color; + + if(color_init_reply(color_init_unchecked(&bg_color, bg, bg_len))) + { + uint32_t config_back[] = { bg_color.pixel }; + xcb_change_window_attributes(globalconf.connection, + globalconf.systray.window, + XCB_CW_BACK_PIXEL, config_back); + } if(globalconf.systray.parent == NULL) systray_register(); diff --git a/themes/default/theme.lua.in b/themes/default/theme.lua.in index 05ad43cd..68c80b0f 100644 --- a/themes/default/theme.lua.in +++ b/themes/default/theme.lua.in @@ -10,6 +10,7 @@ theme.bg_normal = "#222222" theme.bg_focus = "#535d6c" theme.bg_urgent = "#ff0000" theme.bg_minimize = "#444444" +theme.bg_systray = theme.bg_normal theme.fg_normal = "#aaaaaa" theme.fg_focus = "#ffffff" diff --git a/themes/sky/theme.lua.in b/themes/sky/theme.lua.in index 01713d61..568417bc 100644 --- a/themes/sky/theme.lua.in +++ b/themes/sky/theme.lua.in @@ -12,6 +12,7 @@ theme.bg_focus = "#e2eeea" theme.bg_normal = "#729fcf" theme.bg_urgent = "#fce94f" theme.bg_minimize = "#0067ce" +theme.bg_systray = theme.bg_normal theme.fg_normal = "#2e3436" theme.fg_focus = "#2e3436" diff --git a/themes/zenburn/theme.lua.in b/themes/zenburn/theme.lua.in index 0ee2ce20..02190d84 100644 --- a/themes/zenburn/theme.lua.in +++ b/themes/zenburn/theme.lua.in @@ -15,12 +15,13 @@ theme.wallpaper_cmd = { "awsetbg @AWESOME_THEMES_PATH@/zenburn/zenburn-backgroun theme.font = "sans 8" -- {{{ Colors -theme.fg_normal = "#DCDCCC" -theme.fg_focus = "#F0DFAF" -theme.fg_urgent = "#CC9393" -theme.bg_normal = "#3F3F3F" -theme.bg_focus = "#1E2320" -theme.bg_urgent = "#3F3F3F" +theme.fg_normal = "#DCDCCC" +theme.fg_focus = "#F0DFAF" +theme.fg_urgent = "#CC9393" +theme.bg_normal = "#3F3F3F" +theme.bg_focus = "#1E2320" +theme.bg_urgent = "#3F3F3F" +theme.bg_systray = theme.bg_normal -- }}} -- {{{ Borders