Hello,

Would you like to apply this (attached) patch? It makes possible to
prepend some arbitrary string to client's name in taskbar and titlebar,
for example to specify c.machine or c.class for writing rules.

Disclaimer: I work on Qubes OS project. http://www.qubes-os.org/. We
have system comprised of virtual machines and we'd like to mark each
window with its VM name. I seek to include awesome as third WM option
(after KDE and XFCE) and it went quite smooth in rc.lua besides this one
specific intrusion into awful.

-- 
Best regards
Wojciech Porczyk
From fdf642ad82e5de23e6ff50ae933945564f93e616 Mon Sep 17 00:00:00 2001
From: Wojciech Zygmunt Porczyk <wojci...@porczyk.eu>
Date: Mon, 3 Feb 2014 19:17:46 +0100
Subject: [PATCH] Add optional per-client prefix to tasklist and titlebars

Signed-off-by: Wojciech Porczyk <wojci...@porczyk.eu>
---
 awesomerc.lua.in                 | 3 +++
 lib/awful/client.lua.in          | 1 +
 lib/awful/titlebar.lua.in        | 3 ++-
 lib/awful/widget/tasklist.lua.in | 2 ++
 4 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/awesomerc.lua.in b/awesomerc.lua.in
index 0be6bf7..287e2e0 100644
--- a/awesomerc.lua.in
+++ b/awesomerc.lua.in
@@ -376,6 +376,9 @@ client.connect_signal("manage", function (c, startup)
         end
     end)
 
+    -- Enable prefixing with machine name
+    --awful.client.property.set(c, "prefix", "[" .. c.machine .. "] ")
+
     if not startup then
         -- Set the windows at the slave,
         -- i.e. put it at the end of others instead of setting it master.
diff --git a/lib/awful/client.lua.in b/lib/awful/client.lua.in
index 4a92ace..277a1c6 100644
--- a/lib/awful/client.lua.in
+++ b/lib/awful/client.lua.in
@@ -950,6 +950,7 @@ end
 capi.client.add_signal("property::floating_geometry")
 capi.client.add_signal("property::floating")
 capi.client.add_signal("property::dockable")
+capi.client.add_signal("property::prefix")
 
 capi.client.connect_signal("focus", client.focus.history.add)
 capi.client.connect_signal("unmanage", client.focus.history.delete)
diff --git a/lib/awful/titlebar.lua.in b/lib/awful/titlebar.lua.in
index aff3630..a05a151 100644
--- a/lib/awful/titlebar.lua.in
+++ b/lib/awful/titlebar.lua.in
@@ -142,9 +142,10 @@ end
 function titlebar.widget.titlewidget(c)
     local ret = textbox()
     local function update()
-        ret:set_text(c.name or "<unknown>")
+        ret:set_text((aclient.property.get(c, "prefix") or "") .. (c.name or "<unknown>"))
     end
     c:connect_signal("property::name", update)
+    c:connect_signal("property::prefix", update)
     update()
 
     return ret
diff --git a/lib/awful/widget/tasklist.lua.in b/lib/awful/widget/tasklist.lua.in
index 27afe1a..503f43d 100644
--- a/lib/awful/widget/tasklist.lua.in
+++ b/lib/awful/widget/tasklist.lua.in
@@ -66,6 +66,7 @@ local function tasklist_label(c, args)
     else
         name = name .. (util.escape(c.name) or util.escape("<untitled>"))
     end
+    name = (client.property.get(c, "prefix") or "") .. name
     if capi.client.focus == c then
         bg = bg_focus
         bg_image = bg_image_focus
@@ -150,6 +151,7 @@ function tasklist.new(screen, filter, buttons, style, update_function, base_widg
     capi.client.connect_signal("property::minimized", u)
     capi.client.connect_signal("property::name", u)
     capi.client.connect_signal("property::icon_name", u)
+    capi.client.connect_signal("property::prefix", u)
     capi.client.connect_signal("property::icon", u)
     capi.client.connect_signal("property::skip_taskbar", u)
     capi.client.connect_signal("property::screen", u)
-- 
1.8.5.1

Attachment: signature.asc
Description: Digital signature

Reply via email to