awful.titlebar: fix theme support

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2008-11-12 11:55:35 +01:00
parent 2cafc6a1c8
commit cdc9d40f4a
2 changed files with 25 additions and 27 deletions

View File

@ -68,16 +68,19 @@ function add(c, args)
appicon:buttons(bts) appicon:buttons(bts)
function appicon.mouse_enter(s) hooks.user.call('mouse_enter', c) end function appicon.mouse_enter(s) hooks.user.call('mouse_enter', c) end
if theme.titlebar_close_button == "true" then local closef
local closef = widget.button({ name = "closef", align = "right", if theme.titlebar_close_button_focus then
image = theme.titlebar_close_button_focus closef = widget.button({ name = "closef", align = "right",
or theme.titlebar_close_button_img_focus image = theme.titlebar_close_button_focus })
or "@AWESOME_ICON_PATH@/titlebar/closer.png" }) end
local close = widget.button({ name = "close", align = "right",
image = theme.titlebar_close_button_normal
or theme.titlebar_close_button_img_normal
or "@AWESOME_ICON_PATH@/titlebar/close.png" })
local close
if theme.titlebar_close_button_normal then
close = widget.button({ name = "close", align = "right",
image = theme.titlebar_close_button_normal })
end
if close or closef then
-- Bind kill button, also allow moving and resizing on this widget -- Bind kill button, also allow moving and resizing on this widget
local bts = local bts =
{ {
@ -85,16 +88,18 @@ function add(c, args)
capi.button({ args.modkey }, 1, function (t) t.client:mouse_move() end), capi.button({ args.modkey }, 1, function (t) t.client:mouse_move() end),
capi.button({ args.modkey }, 3, function (t) t.client:mouse_resize() end) capi.button({ args.modkey }, 3, function (t) t.client:mouse_resize() end)
} }
if close then
close:buttons(bts) close:buttons(bts)
function close.mouse_enter(s) hooks.user.call('mouse_enter', c) end
end
if closef then
closef:buttons(bts) closef:buttons(bts)
-- Needed for sloppy focus beheaviour -- Needed for sloppy focus beheaviour
function close.mouse_enter(s) hooks.user.call('mouse_enter', c) end
function closef.mouse_enter(s) hooks.user.call('mouse_enter', c) end function closef.mouse_enter(s) hooks.user.call('mouse_enter', c) end
end
end
tb.widgets = { appicon, title, closef, close } tb.widgets = { appicon, title, closef, close }
else
tbx.widgets = { appicon, title }
end
c.titlebar = tb c.titlebar = tb

View File

@ -43,16 +43,9 @@ menu_width = 100
# beautiful.variable in your rc.lua # beautiful.variable in your rc.lua
#bg_widget = #cc0000 #bg_widget = #cc0000
# Display close button inside titlebar
titlebar_close_button = true
# Define the image to load # Define the image to load
@ (if titlebar_close_button_[normal|focus] these values are ignored) titlebar_close_button_normal = @AWESOME_THEMES_PATH@/default/titlebar/close.png
#titlebar_close_button_img_normal = @AWESOME_THEMES_PATH@/default/titlebar/closea.png titlebar_close_button_focus = @AWESOME_THEMES_PATH@/default/titlebar/closer.png
#titlebar_close_button_img_focus = @AWESOME_THEMES_PATH@/default/titlebar/closera.png
# Or create your own close button
#titlebar_close_button_normal = <span>...</span>
#titlebar_close_button_focus = <span>...</span>
# You can use your own command to set your wallpaper # You can use your own command to set your wallpaper
wallpaper_cmd = awsetbg @AWESOME_THEMES_PATH@/default/background.png wallpaper_cmd = awsetbg @AWESOME_THEMES_PATH@/default/background.png