awful: titlebar support for changing the close button

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Matteo Landi 2008-08-20 16:40:23 +02:00 committed by Julien Danjou
parent af49f6f8f1
commit e9a65cbfd5
2 changed files with 38 additions and 16 deletions

View File

@ -1401,7 +1401,8 @@ function titlebar.add(c, args)
title:mouse_add(capi.mouse({ }, 1, function (t) t.client:mouse_move() end)) title:mouse_add(capi.mouse({ }, 1, function (t) t.client:mouse_move() end))
title:mouse_add(capi.mouse({ args.modkey }, 3, function (t) t.client:mouse_resize() end)) title:mouse_add(capi.mouse({ args.modkey }, 3, function (t) t.client:mouse_resize() end))
local close_button= capi.widget({ type = "textbox", name = "close", align = "right" }) if theme.titlebar_close_button == "true" then
local close_button = capi.widget({ type = "textbox", name = "close", align = "right" })
close_button:mouse_add(capi.mouse({ }, 1, function (t) t.client:kill() end)) close_button:mouse_add(capi.mouse({ }, 1, function (t) t.client:kill() end))
tb:widgets({ tb:widgets({
@ -1409,6 +1410,12 @@ function titlebar.add(c, args)
title, title,
close_button close_button
}) })
else
tb:widgets({
capi.widget({ type = "appicon", name = "appicon", align = "left" }),
title
})
end
titlebar.update(c) titlebar.update(c)
@ -1433,13 +1440,18 @@ function titlebar.update(c)
c.titlebar.fg = titlebar.data[c].fg_focus c.titlebar.fg = titlebar.data[c].fg_focus
c.titlebar.bg = titlebar.data[c].bg_focus c.titlebar.bg = titlebar.data[c].bg_focus
if close then if close then
close.text = "<bg image=\"@AWESOME_ICON_PATH@/titlebar/closer.png\" resize=\"true\"/>" close.text = theme.titlebar_close_button_focus or
"<bg image=\"" .. theme.titlebar_close_button_img_focus .. "\" resize=\"true\"/>" or
"<bg image=\"@AWESOME_ICON_PATH@/titlebar/closer.png\" resize=\"true\"/>"
end end
else else
c.titlebar.fg = titlebar.data[c].fg c.titlebar.fg = titlebar.data[c].fg
c.titlebar.bg = titlebar.data[c].bg c.titlebar.bg = titlebar.data[c].bg
if close then if close then
close.text = "<bg image=\"@AWESOME_ICON_PATH@/titlebar/close.png\" resize=\"true\"/>" close.text = theme.titlebar_close_button_normal or
"<bg image=\"" .. theme.titlebar_close_button_img_normal .. "\" resize=\"true\"/>" or
"<bg image=\"@AWESOME_ICON_PATH@/titlebar/close.png\" resize=\"true\"/>"
end end
end end
end end

View File

@ -17,13 +17,6 @@ border_normal = #000000
border_focus = #535d6c border_focus = #535d6c
border_marked = #91231c border_marked = #91231c
# Display the taglist squares
taglist_squares = true
# You can use your own command to
# set your wallpaper
wallpaper_cmd = xsetbg -fullscreen -border black @AWESOME_THEMES_PATH@/default-background.png || xsetroot -solid darkgrey
# There are another variables sets # There are another variables sets
# overriding the default one when # overriding the default one when
# defined, the sets are: # defined, the sets are:
@ -32,7 +25,24 @@ wallpaper_cmd = xsetbg -fullscreen -border black @AWESOME_THEMES_PATH@/default-b
# Example: # Example:
#taglist_bg_focus = #ff0000 #taglist_bg_focus = #ff0000
# Display the taglist squares
taglist_squares = true
# You can add as many variables as # You can add as many variables as
# you wish and access them by using # you wish and access them by using
# 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
@ (if titlebar_close_button_[normal|focus] these values are ignored)
#titlebar_close_button_img_normal = @AWESOME_ICONS_PATH@/titlebar/closea.png
#titlebar_close_button_img_focus = @AWESOME_ICONS_PATH@/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
wallpaper_cmd = xsetbg -fullscreen -border black @AWESOME_THEMES_PATH@/default-background.png || xsetroot -solid darkgrey