In my course to get tab usable in awesome I added a tablist widget. I
found how to make it working in the default wibox, displaying only the
tab (if any) of the focused windows.
I will let that option possible but what I really want is to make it
working with the titlebar.
For that I need a way to get the client of the titlebar we are
refreshing from the tablist_update function.

I added args.widget param to the titlebar.add code to specify a custom
widget to be added to the titlebar. It works.

I wonder how to get the titlebar code to specify the client it is
linked with to the tablist_update function?
The titlebar.update function have the information I need.

thanks


here is an experimental not usable tablist.lua (just for example):
---------------------------------------------------------------------------
-- @author Cedric GESTES <cta...@gmail.com>
-- @copyright 2009 Cedric Gestes
-- @release @AWESOME_VERSION@
---------------------------------------------------------------------------


-- Grab environment we need
local capi = { screen = screen,
               image = image,
               client = client }
local ipairs = ipairs
local type = type
local setmetatable = setmetatable
local table = table
local common = require("awful.widget.common")
local beautiful = require("beautiful")
local client = require("awful.client")
local util = require("awful.util")
local tag = require("awful.tag")
local layout = require("awful.widget.layout")
local tasklist = require("awful.widget.tasklist")
local tab = require("tabulous")
local tostring = tostring

--local dbg = require("dbg")
--- Tasklist widget module for awful
module("tablist")

-- Public structures
label = {}

local function tablist_update(w, buttons, label, data, widgets)
    local tabidx =  nil
    if data.followfocus then
       tabidx = tab.client_tabindex(capi.client.focus)
    else
       tabidx = tab.client_tabindex(???)
    end

    local clients = {}
    if tabidx ~= nil then
        clients = tab.clients(tabidx)
    end
    common.list_update(w, buttons, label, data, widgets, clients)
end

--- Create a new tasklist widget.
-- @param label Label function to use.
-- @param buttons A table with buttons binding to set.
function new(label, buttons, followfocus)
    local w = {
        layout = layout.horizontal.rightleft
    }
    local widgets = { }
    widgets.imagebox = { }
    widgets.textbox  = { margin    = { left  = 2,
                                       right = 2 },
                         bg_resize = true,
                         bg_align  = "right"
                       }
    local data = setmetatable({}, { __mode = 'k' })
    data.followfocus = followfocus
    local u = function () tablist_update(w, buttons, label, data, widgets) end
    for s = 1, capi.screen.count() do
        tag.attached_add_signal(s, "property::selected", u)
        capi.screen[s]:add_signal("tag::attach", u)
        capi.screen[s]:add_signal("tag::detach", u)
    end
    capi.client.add_signal("new", function (c)
        c:add_signal("property::urgent", u)
        c:add_signal("property::floating", u)
        c:add_signal("property::maximized_horizontal", u)
        c:add_signal("property::maximized_vertical", u)
        c:add_signal("property::name", u)
        c:add_signal("property::icon_name", u)
        c:add_signal("property::skip_taskbar", u)
        c:add_signal("property::hidden", u)
        c:add_signal("tagged", u)
        c:add_signal("untagged", u)
    end)
    capi.client.add_signal("unmanage", u)
    capi.client.add_signal("list", u)
    capi.client.add_signal("focus", u)
    capi.client.add_signal("unfocus", u)
    u()
    return w
end


--- Return labels for a tasklist widget with clients from currently
selected tags.
-- It returns the client name and set a special
-- foreground and background color for focused client.
-- It also puts a special icon for floating windows.
-- @param c The client.
-- @param screen The screen we are drawing on.
-- @param args The arguments table.
function label.currenttab(c, screen, args)
    if tab.client_tabindex(c) then
        return tasklist.widget_tasklist_label_common(c, args)
    end
end

setmetatable(_M, { __call = function(_, ...) return new(...) end })

-- vim: 
filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80




here follow

-- 
To unsubscribe, send mail to awesome-devel-unsubscr...@naquadah.org.

Reply via email to