awful.widget: add support for __call on ta{g,sk}list widgets

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2009-05-08 11:59:38 +02:00
parent 43902aed69
commit fe35104bc2
3 changed files with 10 additions and 4 deletions

View File

@ -162,10 +162,10 @@ for s = 1, screen.count() do
awful.button({ }, 4, function () awful.layout.inc(layouts, 1) end), awful.button({ }, 4, function () awful.layout.inc(layouts, 1) end),
awful.button({ }, 5, function () awful.layout.inc(layouts, -1) end))) awful.button({ }, 5, function () awful.layout.inc(layouts, -1) end)))
-- Create a taglist widget -- Create a taglist widget
mytaglist[s] = awful.widget.taglist.new(s, awful.widget.taglist.label.all, mytaglist.buttons) mytaglist[s] = awful.widget.taglist(s, awful.widget.taglist.label.all, mytaglist.buttons)
-- Create a tasklist widget -- Create a tasklist widget
mytasklist[s] = awful.widget.tasklist.new(function(c) mytasklist[s] = awful.widget.tasklist(function(c)
return awful.widget.tasklist.label.currenttags(c, s) return awful.widget.tasklist.label.currenttags(c, s)
end, mytasklist.buttons) end, mytasklist.buttons)

View File

@ -11,6 +11,7 @@ local capi = { widget = widget,
client = client } client = client }
local type = type local type = type
local setmetatable = setmetatable local setmetatable = setmetatable
local unpack = unpack
local pairs = pairs local pairs = pairs
local ipairs = ipairs local ipairs = ipairs
local hooks = require("awful.hooks") local hooks = require("awful.hooks")
@ -169,4 +170,6 @@ function label.noempty(t, args)
end end
end end
setmetatable(_M, { __call = function(_, ...) return new(unpack(arg)) end })
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80 -- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80

View File

@ -10,6 +10,7 @@ local capi = { screen = screen,
client = client } client = client }
local ipairs = ipairs local ipairs = ipairs
local setmetatable = setmetatable local setmetatable = setmetatable
local unpack = unpack
local table = table local table = table
local hooks = require("awful.hooks") local hooks = require("awful.hooks")
local common = require("awful.widget.common") local common = require("awful.widget.common")
@ -178,4 +179,6 @@ function label.currenttags(c, screen, args)
end end
end end
setmetatable(_M, { __call = function(_, ...) return new(unpack(arg)) end })
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80 -- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80