A quickie allowing users to set a custom titlebar_font in their themes.

k
From 2b357b7e51d8ea29fe3f47263d05aee8ce8bc96c Mon Sep 17 00:00:00 2001
From: koniu <gkusni...@gmail.com>
Date: Fri, 1 May 2009 03:16:17 +0100
Subject: [PATCH] awful.titlebar: allow titlebar_font in themes

Signed-off-by: koniu <gkusni...@gmail.com>
---
 lib/awful/titlebar.lua.in |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/lib/awful/titlebar.lua.in b/lib/awful/titlebar.lua.in
index a0c8b9c..ba6981e 100644
--- a/lib/awful/titlebar.lua.in
+++ b/lib/awful/titlebar.lua.in
@@ -66,12 +66,14 @@ function add(c, args)
     data[c].fg_focus = args.fg_focus or theme.titlebar_fg_focus or theme.fg_focus
     data[c].bg_focus = args.bg_focus or theme.titlebar_bg_focus or theme.bg_focus
     data[c].width = args.width
+    data[c].font = args.font or theme.titlebar_font or theme.font
 
     local tb = capi.wibox(args)
 
     local title = capi.widget({ type = "textbox", align = "flex" })
     if c.name then
-        title.text = " " .. util.escape(c.name) .. " "
+        title.text = "<span font_desc='" .. data[c].font .. "'> " ..
+                     util.escape(c.name) .. " </span>"
     end
 
     -- Redirect relevant events to the client the titlebar belongs to
@@ -119,7 +121,8 @@ function update(c, prop)
         local widgets = c.titlebar.widgets
         if prop == "name" then
             if widgets.title then
-                widgets.title.text = " " .. util.escape(c.name) .. " "
+                widgets.title.text = "<span font_desc='" .. data[c].font ..
+                                     "'> ".. util.escape(c.name) .. " </span>"
             end
         elseif prop == "icon" then
             if widgets.appicon then
-- 
1.6.2.1

Reply via email to