我有一个想要变成标题栏背景的图片,但我不知道如何使它拉伸,所以它适合整个标题栏。有什么建议?
这是默认配置的补丁,它使标题栏具有文件的背景。该文件缩放到标题栏的确切大小。
diff --git a/awesomerc.lua b/awesomerc.lua
index fa584b8a8..3e3a54c0d 100644
--- a/awesomerc.lua
+++ b/awesomerc.lua
@@ -542,6 +542,14 @@ client.connect_signal("manage", function (c)
end
end)
+local tb_bg_image = gears.surface("/tmp/variant_outside.png")
+local bg_width, bg_height = gears.surface.get_size(tb_bg_image)
+local function bg_image_function(_, cr, width, height)
+ cr:scale(width / bg_width, height / bg_height)
+ cr:set_source_surface(tb_bg_image)
+ cr:paint()
+end
+
-- @DOC_TITLEBARS@
-- Add a titlebar if titlebars_enabled is set to true in the rules.
client.connect_signal("request::titlebars", function(c)
@@ -557,7 +565,8 @@ client.connect_signal("request::titlebars", function(c)
end)
)
- awful.titlebar(c) : setup {
+ local args = { bgimage_normal = bg_image_function, bgimage_focus = bg_image_function }
+ awful.titlebar(c, args) : setup {
{ -- Left
awful.titlebar.widget.iconwidget(c),
buttons = buttons,
类似于以下对默认配置的更改您所追求的是什么? (当然,使用另一个文件名)
diff --git a/awesomerc.lua b/awesomerc.lua
index fa584b8a8..7e6ccad55 100644
--- a/awesomerc.lua
+++ b/awesomerc.lua
@@ -557,7 +557,9 @@ client.connect_signal("request::titlebars", function(c)
end)
)
- awful.titlebar(c) : setup {
+ local bg = { type = "png", file = "/tmp/variant_outside.png" }
+ local args = { bg_normal = bg, bg_focus = bg }
+ awful.titlebar(c, args) : setup {
{ -- Left
awful.titlebar.widget.iconwidget(c),
buttons = buttons,