Add some filter options
This commit is contained in:
parent
231eef25bc
commit
5d21035698
|
@ -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
|
||||
|
||||
|
|
4
base.lua
4
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,
|
||||
|
|
3
init.lua
3
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
|
||||
|
||||
|
|
|
@ -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(" <b>".. data.filter_prefix .."</b> ")
|
||||
filter_tb:set_markup(" <b>".. data.filter_prefix .."</b> "..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(" <b>".. data.filter_prefix .."</b> "..data.filter_string)
|
||||
local is_empty = data.filter_string == ""
|
||||
filter_tb:set_markup(" <b>".. data.filter_prefix .."</b> "..(is_empty and data.filter_placeholder or data.filter_string))
|
||||
end)
|
||||
bg.widget = filter_tb
|
||||
return bg
|
||||
|
|
Loading…
Reference in New Issue