feat(awful: titlebar): expose fallback title (#2459)

feat(awful: titlebar): expose fallback title
This commit is contained in:
Yauhen Kirylau 2018-12-17 18:47:14 +01:00 committed by Emmanuel Lepage Vallée
parent de04cecf46
commit 820094c3c4
1 changed files with 14 additions and 4 deletions

View File

@ -27,10 +27,22 @@ local base = require("wibox.widget.base")
local capi = { local capi = {
client = client client = client
} }
local titlebar = { local titlebar = {
widget = {} widget = {},
enable_tooltip = true,
fallback_name = '<unknown>'
} }
--- Show tooltips when hover on titlebar buttons.
-- @tfield[opt=true] boolean awful.titlebar.enable_tooltip
--- Title to display if client name is not set.
-- @field[opt='\<unknown\>'] awful.titlebar.fallback_name
--- The titlebar foreground (text) color. --- The titlebar foreground (text) color.
-- @beautiful beautiful.titlebar_fg_normal -- @beautiful beautiful.titlebar_fg_normal
-- @param color -- @param color
@ -422,8 +434,6 @@ local titlebar = {
-- @name setup -- @name setup
-- @class function -- @class function
--- Show tooltips when hover on titlebar buttons (defaults to 'true')
titlebar.enable_tooltip = true
local all_titlebars = setmetatable({}, { __mode = 'k' }) local all_titlebars = setmetatable({}, { __mode = 'k' })
@ -595,7 +605,7 @@ end
function titlebar.widget.titlewidget(c) function titlebar.widget.titlewidget(c)
local ret = textbox() local ret = textbox()
local function update() local function update()
ret:set_text(c.name or "<unknown>") ret:set_text(c.name or titlebar.fallback_name)
end end
c:connect_signal("property::name", update) c:connect_signal("property::name", update)
update() update()