feat(menubar): expose menubar styling to beautiful (#2375)
This commit is contained in:
parent
bed42a10ed
commit
3931ae370c
|
@ -39,6 +39,27 @@ local function get_screen(s)
|
|||
return s and capi.screen[s]
|
||||
end
|
||||
|
||||
|
||||
--- Menubar normal text color.
|
||||
-- @beautiful beautiful.menubar_fg_normal
|
||||
|
||||
--- Menubar normal background color.
|
||||
-- @beautiful beautiful.menubar_bg_normal
|
||||
|
||||
--- Menubar border width.
|
||||
-- @beautiful beautiful.menubar_border_width
|
||||
-- @tparam[opt=0] number menubar_border_width
|
||||
|
||||
--- Menubar border color.
|
||||
-- @beautiful beautiful.menubar_border_color
|
||||
|
||||
--- Menubar selected item text color.
|
||||
-- @beautiful beautiful.menubar_fg_normal
|
||||
|
||||
--- Menubar selected item background color.
|
||||
-- @beautiful beautiful.menubar_bg_normal
|
||||
|
||||
|
||||
-- menubar
|
||||
local menubar = { menu_entries = {} }
|
||||
menubar.menu_gen = require("menubar.menu_gen")
|
||||
|
@ -115,11 +136,11 @@ end
|
|||
-- @param o The menu item.
|
||||
-- @return item name, item background color, background image, item icon.
|
||||
local function label(o)
|
||||
local fg_color = theme.menu_fg_normal or theme.fg_normal
|
||||
local bg_color = theme.menu_bg_normal or theme.bg_normal
|
||||
local fg_color = theme.menubar_fg_normal or theme.menu_fg_normal or theme.fg_normal
|
||||
local bg_color = theme.menubar_bg_normal or theme.menu_bg_normal or theme.bg_normal
|
||||
if o.focused then
|
||||
fg_color = theme.menu_fg_focus or theme.fg_focus
|
||||
bg_color = theme.menu_bg_focus or theme.bg_focus
|
||||
fg_color = theme.menubar_fg_focus or theme.menu_fg_focus or theme.fg_focus
|
||||
bg_color = theme.menubar_bg_focus or theme.menu_bg_focus or theme.bg_focus
|
||||
end
|
||||
return colortext(o.name, fg_color),
|
||||
bg_color,
|
||||
|
@ -399,6 +420,11 @@ end
|
|||
-- @param[opt] scr Screen.
|
||||
function menubar.show(scr)
|
||||
scr = get_screen(scr or awful.screen.focused() or 1)
|
||||
local fg_color = theme.menubar_fg_normal or theme.menu_fg_normal or theme.fg_normal
|
||||
local bg_color = theme.menubar_bg_normal or theme.menu_bg_normal or theme.bg_normal
|
||||
local border_width = theme.menubar_border_width or theme.menu_border_width or 0
|
||||
local border_color = theme.menubar_border_color or theme.menu_border_color
|
||||
|
||||
if not instance then
|
||||
-- Add to each category the name of its key in all_categories
|
||||
for k, v in pairs(menubar.menu_gen.all_categories) do
|
||||
|
@ -409,13 +435,13 @@ function menubar.show(scr)
|
|||
menubar.refresh(scr)
|
||||
end
|
||||
|
||||
local fg_color = theme.menu_fg_normal or theme.fg_normal
|
||||
local bg_color = theme.menu_bg_normal or theme.bg_normal
|
||||
instance = {
|
||||
wibox = wibox{
|
||||
ontop = true,
|
||||
bg = bg_color,
|
||||
fg = fg_color,
|
||||
border_width = border_width,
|
||||
border_color = border_color,
|
||||
},
|
||||
widget = common_args.w,
|
||||
prompt = awful.widget.prompt(),
|
||||
|
@ -440,7 +466,7 @@ function menubar.show(scr)
|
|||
instance.geometry = {x = geometry.x or scrgeom.x,
|
||||
y = geometry.y or scrgeom.y,
|
||||
height = geometry.height or gmath.round(theme.get_font_height() * 1.5),
|
||||
width = geometry.width or scrgeom.width}
|
||||
width = (geometry.width or scrgeom.width) - border_width * 2}
|
||||
instance.wibox:geometry(instance.geometry)
|
||||
|
||||
current_item = 1
|
||||
|
|
Loading…
Reference in New Issue