Add 'disable_markup' option

This commit is contained in:
Emmanuel Lepage Vallee 2013-09-30 22:19:38 -04:00
parent 6899f18aac
commit fc48ca261f
4 changed files with 12 additions and 3 deletions

View File

@ -139,6 +139,7 @@ Multiple items can have multiple sets of options.
| filter_prefix | Text to be shown at begenning of the filter string | string |
| max_items | Maximum number of items before showing scrollbar | number |
| enable_keyboard | Enable or disable keyboard navigation / hooks | boolean |
| disable_markup | Disable pango markup in items text | boolean |
| x | X position (absolute) | number |
| y | Y position (absolute) | number |

View File

@ -264,6 +264,7 @@ local function new(args)
filter_prefix = args.filter_prefix or "Filter:",
enable_keyboard = (args.enable_keyboard ~= false),
max_items = args.max_items or nil,
disable_markup = args.disable_markup or false,
x = args.x or 0,
y = args.y or 0,
},

View File

@ -116,7 +116,6 @@ function module:setup_item(data,item,args)
cr:paint()
wibox.widget.textbox.draw(self,w, cr, width, height)
end
pref:set_markup("<span fgcolor='".. beautiful.bg_normal .."'><tt><b>F11</b></tt></span>")
l:add(pref)
m:set_left ( 0 )
end
@ -172,7 +171,11 @@ function module:setup_item(data,item,args)
data.height = fit_h
data.style(data)
item._internal.set_map.text = function (value)
text_w:set_markup(value)
if data.disable_markup then
text_w:set_text(value)
else
text_w:set_markup(value)
end
if data.auto_resize then
local fit_w,fit_h = text_w:fit(999,9999)
local is_largest = item == data._internal.largest_item_h

View File

@ -206,7 +206,11 @@ function module:setup_item(data,item,args)
data.height = fit_h
data.style(data)
item._internal.set_map.text = function (value)
text_w:set_markup(value)
if data.disable_markup then
text_w:set_text(value)
else
text_w:set_markup(value)
end
if data.auto_resize then
local fit_w,fit_h = wibox.widget.textbox.fit(text_w,9999,9999)
local is_largest = item == data._internal.largest_item_w