Systray: Configure background color via beautiful

Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2010-10-17 09:24:59 +02:00
parent 4af5ca8c34
commit 107ba3fefc
5 changed files with 23 additions and 7 deletions

View File

@ -6,6 +6,7 @@
local wbase = require("wibox.widget.base") local wbase = require("wibox.widget.base")
local lbase = require("wibox.layout.base") local lbase = require("wibox.layout.base")
local beautiful = require("beautiful")
local capi = { awesome = awesome } local capi = { awesome = awesome }
local setmetatable = setmetatable local setmetatable = setmetatable
local error = error local error = error
@ -19,6 +20,7 @@ local base_size = nil
function draw(box, wibox, cr, width, height) function draw(box, wibox, cr, width, height)
local x, y, width, height = lbase.rect_to_device_geometry(cr, 0, 0, width, height) local x, y, width, height = lbase.rect_to_device_geometry(cr, 0, 0, width, height)
local num_entries = capi.awesome.systray() local num_entries = capi.awesome.systray()
local bg = beautiful.bg_systray or beautiful.bg_normal
local in_dir, ortho, base local in_dir, ortho, base
if horizontal then if horizontal then
@ -31,7 +33,7 @@ function draw(box, wibox, cr, width, height)
else else
base = in_dir / num_entries base = in_dir / num_entries
end end
capi.awesome.systray(wibox.drawin, x, y, base, horizontal) capi.awesome.systray(wibox.drawin, x, y, base, horizontal, bg)
end end
function fit(box, width, height) function fit(box, width, height)

View File

@ -321,11 +321,22 @@ luaA_systray(lua_State *L)
{ {
if(lua_gettop(L) != 0) if(lua_gettop(L) != 0)
{ {
size_t bg_len;
drawin_t *w = luaA_checkudata(L, 1, &drawin_class); drawin_t *w = luaA_checkudata(L, 1, &drawin_class);
int x = luaL_checknumber(L, 2); int x = luaL_checknumber(L, 2);
int y = luaL_checknumber(L, 3); int y = luaL_checknumber(L, 3);
int base_size = luaL_checknumber(L, 4); int base_size = luaL_checknumber(L, 4);
bool horiz = lua_toboolean(L, 5); 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) if(globalconf.systray.parent == NULL)
systray_register(); systray_register();

View File

@ -10,6 +10,7 @@ theme.bg_normal = "#222222"
theme.bg_focus = "#535d6c" theme.bg_focus = "#535d6c"
theme.bg_urgent = "#ff0000" theme.bg_urgent = "#ff0000"
theme.bg_minimize = "#444444" theme.bg_minimize = "#444444"
theme.bg_systray = theme.bg_normal
theme.fg_normal = "#aaaaaa" theme.fg_normal = "#aaaaaa"
theme.fg_focus = "#ffffff" theme.fg_focus = "#ffffff"

View File

@ -12,6 +12,7 @@ theme.bg_focus = "#e2eeea"
theme.bg_normal = "#729fcf" theme.bg_normal = "#729fcf"
theme.bg_urgent = "#fce94f" theme.bg_urgent = "#fce94f"
theme.bg_minimize = "#0067ce" theme.bg_minimize = "#0067ce"
theme.bg_systray = theme.bg_normal
theme.fg_normal = "#2e3436" theme.fg_normal = "#2e3436"
theme.fg_focus = "#2e3436" theme.fg_focus = "#2e3436"

View File

@ -15,12 +15,13 @@ theme.wallpaper_cmd = { "awsetbg @AWESOME_THEMES_PATH@/zenburn/zenburn-backgroun
theme.font = "sans 8" theme.font = "sans 8"
-- {{{ Colors -- {{{ Colors
theme.fg_normal = "#DCDCCC" theme.fg_normal = "#DCDCCC"
theme.fg_focus = "#F0DFAF" theme.fg_focus = "#F0DFAF"
theme.fg_urgent = "#CC9393" theme.fg_urgent = "#CC9393"
theme.bg_normal = "#3F3F3F" theme.bg_normal = "#3F3F3F"
theme.bg_focus = "#1E2320" theme.bg_focus = "#1E2320"
theme.bg_urgent = "#3F3F3F" theme.bg_urgent = "#3F3F3F"
theme.bg_systray = theme.bg_normal
-- }}} -- }}}
-- {{{ Borders -- {{{ Borders