diff --git a/README.md b/README.md index 041beea..987f52d 100644 --- a/README.md +++ b/README.md @@ -137,7 +137,7 @@ mytextbox:set_tooltip("foo bar") The "underlay" is the opposite of an overlay. Think of it as a background label. Radical add this option to all Awesome widget by calling the `set_underlay` method. The first argument is the text (or table of string) and the second is -an array with the `style` and `alpha` keys. +an array with the `style`, `color` and `alpha` keys. ## Options diff --git a/base.lua b/base.lua index 739d309..c770ebe 100644 --- a/base.lua +++ b/base.lua @@ -276,6 +276,7 @@ local function new(args) fkeys_prefix = args.fkeys_prefix or false, underlay_alpha = args.underlay_alpha or beautiful.underlay_alpha or 0.7, underlay_style = args.underlay_style or nil, + filter_underlay = args.filter_underlay or nil, filter_prefix = args.filter_prefix or "Filter:", enable_keyboard = (args.enable_keyboard ~= false), max_items = args.max_items or nil, @@ -287,6 +288,9 @@ local function new(args) overlay = args.overlay or nil, opacity = args.opacity or beautiful.menu_opacity or 1, icon_transformation = args.icon_transformation or nil, + filter_underlay_style = args.filter_underlay_style or nil, + filter_underlay_color = args.filter_underlay_color, + filter_placeholder = args.filter_placeholder or "", }, force_private = { parent = true, diff --git a/init.lua b/init.lua index 6ff02ef..10c4703 100644 --- a/init.lua +++ b/init.lua @@ -37,7 +37,7 @@ end local function _underlay_draw(self,w, cr, width, height) cr:save() - local udl = underlay.draw(self._underlay,{height=height,style = self._underlay_style}) + local udl = underlay.draw(self._underlay,{height=height,style = self._underlay_style,bg=self._underlay_color}) cr:set_source_surface(udl,width-udl:get_width()-3) cr:paint_with_alpha(self._underlay_alpha or beautiful.underlay_alpha or 0.7) cr:restore() @@ -53,6 +53,7 @@ local function set_underlay(self,udl,args) self._underlay = udl self._underlay_style = args.style self._underlay_alpha = args.alpha + self._underlay_color = args.color self:emit_signal("widget::updated") end diff --git a/widgets/filter.lua b/widgets/filter.lua index 09a6b16..d87e46f 100644 --- a/widgets/filter.lua +++ b/widgets/filter.lua @@ -13,12 +13,14 @@ local function new(data) local bg = wibox.widget.background() bg:set_bg(data.bg_highlight) bg:set_widget(filter_tb) - filter_tb:set_markup(" ".. data.filter_prefix .." ") + filter_tb:set_markup(" ".. data.filter_prefix .." "..data.filter_placeholder) filter_tb.fit = function(tb,width,height) return width,data.item_height end + filter_tb:set_underlay(data.filter_underlay,{alpha=data.filter_underlay_alpha,color=data.filter_underlay_color}) data:connect_signal("filter_string::changed",function() - filter_tb:set_markup(" ".. data.filter_prefix .." "..data.filter_string) + local is_empty = data.filter_string == "" + filter_tb:set_markup(" ".. data.filter_prefix .." "..(is_empty and data.filter_placeholder or data.filter_string)) end) bg.widget = filter_tb return bg