2009-02-27 17:22:03 +01:00
|
|
|
---------------------------------------------------------------------------
|
2014-05-20 13:02:39 +02:00
|
|
|
--- Tasklist widget module for awful
|
|
|
|
--
|
2009-02-27 17:22:03 +01:00
|
|
|
-- @author Julien Danjou <julien@danjou.info>
|
|
|
|
-- @copyright 2008-2009 Julien Danjou
|
|
|
|
-- @release @AWESOME_VERSION@
|
2014-05-20 13:02:39 +02:00
|
|
|
-- @classmod awful.widget.tasklist
|
2009-02-27 17:22:03 +01:00
|
|
|
---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
-- Grab environment we need
|
|
|
|
local capi = { screen = screen,
|
|
|
|
client = client }
|
|
|
|
local ipairs = ipairs
|
2009-04-11 14:15:45 +02:00
|
|
|
local setmetatable = setmetatable
|
2009-02-27 17:22:03 +01:00
|
|
|
local table = table
|
|
|
|
local common = require("awful.widget.common")
|
|
|
|
local beautiful = require("beautiful")
|
|
|
|
local util = require("awful.util")
|
2009-08-18 16:48:19 +02:00
|
|
|
local tag = require("awful.tag")
|
2010-10-06 14:23:36 +02:00
|
|
|
local flex = require("wibox.layout.flex")
|
2015-07-07 18:07:59 +02:00
|
|
|
local timer = require("gears.timer")
|
2009-02-27 17:22:03 +01:00
|
|
|
|
2016-02-26 19:19:58 +01:00
|
|
|
local function get_screen(s)
|
|
|
|
return s and screen[s]
|
|
|
|
end
|
|
|
|
|
2012-06-14 01:08:27 +02:00
|
|
|
local tasklist = { mt = {} }
|
2009-02-27 17:22:03 +01:00
|
|
|
|
2015-09-27 14:10:45 +02:00
|
|
|
local instances
|
|
|
|
|
2009-02-27 17:22:03 +01:00
|
|
|
-- Public structures
|
2012-06-14 01:08:27 +02:00
|
|
|
tasklist.filter = {}
|
2009-02-27 17:22:03 +01:00
|
|
|
|
2015-07-13 23:47:37 +02:00
|
|
|
local function tasklist_label(c, args, tb)
|
2009-02-27 17:22:03 +01:00
|
|
|
if not args then args = {} end
|
|
|
|
local theme = beautiful.get()
|
2016-09-02 18:14:43 +02:00
|
|
|
local align = args.align or theme.tasklist_align or "left"
|
2015-07-11 00:11:45 +02:00
|
|
|
local fg_normal = util.ensure_pango_color(args.fg_normal or theme.tasklist_fg_normal or theme.fg_normal, "white")
|
2013-11-18 15:19:54 +01:00
|
|
|
local bg_normal = args.bg_normal or theme.tasklist_bg_normal or theme.bg_normal or "#000000"
|
2015-07-11 00:11:45 +02:00
|
|
|
local fg_focus = util.ensure_pango_color(args.fg_focus or theme.tasklist_fg_focus or theme.fg_focus, fg_normal)
|
|
|
|
local bg_focus = args.bg_focus or theme.tasklist_bg_focus or theme.bg_focus or bg_normal
|
|
|
|
local fg_urgent = util.ensure_pango_color(args.fg_urgent or theme.tasklist_fg_urgent or theme.fg_urgent, fg_normal)
|
|
|
|
local bg_urgent = args.bg_urgent or theme.tasklist_bg_urgent or theme.bg_urgent or bg_normal
|
|
|
|
local fg_minimize = util.ensure_pango_color(args.fg_minimize or theme.tasklist_fg_minimize or theme.fg_minimize, fg_normal)
|
|
|
|
local bg_minimize = args.bg_minimize or theme.tasklist_bg_minimize or theme.bg_minimize or bg_normal
|
2013-01-04 03:00:33 +01:00
|
|
|
local bg_image_normal = args.bg_image_normal or theme.bg_image_normal
|
|
|
|
local bg_image_focus = args.bg_image_focus or theme.bg_image_focus
|
|
|
|
local bg_image_urgent = args.bg_image_urgent or theme.bg_image_urgent
|
|
|
|
local bg_image_minimize = args.bg_image_minimize or theme.bg_image_minimize
|
|
|
|
local tasklist_disable_icon = args.tasklist_disable_icon or theme.tasklist_disable_icon or false
|
2009-02-27 17:22:03 +01:00
|
|
|
local font = args.font or theme.tasklist_font or theme.font or ""
|
2015-07-13 23:47:37 +02:00
|
|
|
local font_focus = args.font_focus or theme.tasklist_font_focus or theme.font_focus or font or ""
|
|
|
|
local font_minimized = args.font_minimized or theme.tasklist_font_minimized or theme.font_minimized or font or ""
|
|
|
|
local font_urgent = args.font_urgent or theme.tasklist_font_urgent or theme.font_urgent or font or ""
|
|
|
|
local text = ""
|
2009-10-03 09:59:27 +02:00
|
|
|
local name = ""
|
2016-02-07 15:12:22 +01:00
|
|
|
local bg
|
|
|
|
local bg_image
|
2012-01-05 19:31:27 +01:00
|
|
|
|
|
|
|
-- symbol to use to indicate certain client properties
|
2012-01-05 20:24:33 +01:00
|
|
|
local sticky = args.sticky or theme.tasklist_sticky or "▪"
|
2012-01-05 19:31:27 +01:00
|
|
|
local ontop = args.ontop or theme.tasklist_ontop or '⌃'
|
2015-07-17 17:06:43 +02:00
|
|
|
local above = args.above or theme.tasklist_above or '▴'
|
|
|
|
local below = args.below or theme.tasklist_below or '▾'
|
2012-01-05 19:31:27 +01:00
|
|
|
local floating = args.floating or theme.tasklist_floating or '✈'
|
2014-09-02 22:07:53 +02:00
|
|
|
local maximized = args.maximized or theme.tasklist_maximized or '<b>+</b>'
|
2012-01-05 19:31:27 +01:00
|
|
|
local maximized_horizontal = args.maximized_horizontal or theme.tasklist_maximized_horizontal or '⬌'
|
|
|
|
local maximized_vertical = args.maximized_vertical or theme.tasklist_maximized_vertical or '⬍'
|
|
|
|
|
2016-09-02 18:14:43 +02:00
|
|
|
tb:set_align(align)
|
|
|
|
|
2013-01-05 16:51:13 +01:00
|
|
|
if not theme.tasklist_plain_task_name then
|
|
|
|
if c.sticky then name = name .. sticky end
|
2015-07-17 17:06:43 +02:00
|
|
|
|
|
|
|
if c.ontop then name = name .. ontop
|
|
|
|
elseif c.above then name = name .. above
|
|
|
|
elseif c.below then name = name .. below end
|
|
|
|
|
2014-09-02 22:07:53 +02:00
|
|
|
if c.maximized then
|
|
|
|
name = name .. maximized
|
|
|
|
else
|
|
|
|
if c.maximized_horizontal then name = name .. maximized_horizontal end
|
|
|
|
if c.maximized_vertical then name = name .. maximized_vertical end
|
2016-03-14 07:21:29 +01:00
|
|
|
if c.floating then name = name .. floating end
|
2014-09-02 22:07:53 +02:00
|
|
|
end
|
2013-01-05 16:51:13 +01:00
|
|
|
end
|
|
|
|
|
2009-02-27 17:22:03 +01:00
|
|
|
if c.minimized then
|
2010-05-30 12:37:56 +02:00
|
|
|
name = name .. (util.escape(c.icon_name) or util.escape(c.name) or util.escape("<untitled>"))
|
2009-02-27 17:22:03 +01:00
|
|
|
else
|
2010-05-30 12:37:56 +02:00
|
|
|
name = name .. (util.escape(c.name) or util.escape("<untitled>"))
|
2009-02-27 17:22:03 +01:00
|
|
|
end
|
2016-03-14 07:21:29 +01:00
|
|
|
|
2015-03-29 20:20:53 +02:00
|
|
|
local focused = capi.client.focus == c
|
|
|
|
-- Handle transient_for: the first parent that does not skip the taskbar
|
|
|
|
-- is considered to be focused, if the real client has skip_taskbar.
|
|
|
|
if not focused and capi.client.focus and capi.client.focus.skip_taskbar
|
2016-04-17 14:30:39 +02:00
|
|
|
and capi.client.focus:get_transient_for_matching(function(cl)
|
|
|
|
return not cl.skip_taskbar
|
|
|
|
end) == c then
|
2015-03-29 20:20:53 +02:00
|
|
|
focused = true
|
|
|
|
end
|
2016-03-14 07:21:29 +01:00
|
|
|
|
2015-03-29 20:20:53 +02:00
|
|
|
if focused then
|
2009-02-27 17:22:03 +01:00
|
|
|
bg = bg_focus
|
2015-07-11 00:11:45 +02:00
|
|
|
text = text .. "<span color='"..fg_focus.."'>"..name.."</span>"
|
2013-01-04 03:00:33 +01:00
|
|
|
bg_image = bg_image_focus
|
2015-07-13 23:47:37 +02:00
|
|
|
font = font_focus
|
2015-07-11 00:11:45 +02:00
|
|
|
elseif c.urgent then
|
2009-02-27 17:22:03 +01:00
|
|
|
bg = bg_urgent
|
2015-07-11 00:11:45 +02:00
|
|
|
text = text .. "<span color='"..fg_urgent.."'>"..name.."</span>"
|
2013-01-04 03:00:33 +01:00
|
|
|
bg_image = bg_image_urgent
|
2015-07-13 23:47:37 +02:00
|
|
|
font = font_urgent
|
2015-07-11 00:11:45 +02:00
|
|
|
elseif c.minimized then
|
2009-02-27 17:22:03 +01:00
|
|
|
bg = bg_minimize
|
2015-07-11 00:11:45 +02:00
|
|
|
text = text .. "<span color='"..fg_minimize.."'>"..name.."</span>"
|
2013-01-04 03:00:33 +01:00
|
|
|
bg_image = bg_image_minimize
|
2015-07-13 23:47:37 +02:00
|
|
|
font = font_minimized
|
2009-02-27 17:22:03 +01:00
|
|
|
else
|
2011-10-11 22:24:44 +02:00
|
|
|
bg = bg_normal
|
2015-07-11 00:11:45 +02:00
|
|
|
text = text .. "<span color='"..fg_normal.."'>"..name.."</span>"
|
2013-01-04 03:00:33 +01:00
|
|
|
bg_image = bg_image_normal
|
2009-02-27 17:22:03 +01:00
|
|
|
end
|
2015-07-13 23:47:37 +02:00
|
|
|
tb:set_font(font)
|
2013-01-04 03:00:33 +01:00
|
|
|
return text, bg, bg_image, not tasklist_disable_icon and c.icon or nil
|
2009-02-27 17:22:03 +01:00
|
|
|
end
|
|
|
|
|
2013-01-05 16:12:51 +01:00
|
|
|
local function tasklist_update(s, w, buttons, filter, data, style, update_function)
|
2009-10-24 14:53:01 +02:00
|
|
|
local clients = {}
|
2016-02-07 15:12:22 +01:00
|
|
|
for _, c in ipairs(capi.client.get()) do
|
2009-10-24 14:53:01 +02:00
|
|
|
if not (c.skip_taskbar or c.hidden
|
|
|
|
or c.type == "splash" or c.type == "dock" or c.type == "desktop")
|
|
|
|
and filter(c, s) then
|
|
|
|
table.insert(clients, c)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2015-07-13 23:47:37 +02:00
|
|
|
local function label(c, tb) return tasklist_label(c, style, tb) end
|
2009-10-24 14:53:01 +02:00
|
|
|
|
2013-01-05 16:12:51 +01:00
|
|
|
update_function(w, buttons, label, data, clients)
|
2009-10-24 14:53:01 +02:00
|
|
|
end
|
|
|
|
|
2013-01-05 16:12:51 +01:00
|
|
|
--- Create a new tasklist widget. The last two arguments (update_function
|
|
|
|
-- and base_widget) serve to customize the layout of the tasklist (eg. to
|
|
|
|
-- make it vertical). For that, you will need to copy the
|
|
|
|
-- awful.widget.common.list_update function, make your changes to it
|
|
|
|
-- and pass it as update_function here. Also change the base_widget if the
|
|
|
|
-- default is not what you want.
|
2009-10-24 14:53:01 +02:00
|
|
|
-- @param screen The screen to draw tasklist for.
|
|
|
|
-- @param filter Filter function to define what clients will be listed.
|
|
|
|
-- @param buttons A table with buttons binding to set.
|
|
|
|
-- @param style The style overrides default theme.
|
2015-02-26 22:06:34 +01:00
|
|
|
-- @param[opt] update_function Function to create a tag widget on each
|
2015-02-26 16:06:19 +01:00
|
|
|
-- update. See `awful.widget.common.list_update`.
|
2015-02-26 22:06:34 +01:00
|
|
|
-- @tparam[opt] table base_widget Container widget for tag widgets. Default
|
2015-02-26 16:06:19 +01:00
|
|
|
-- is `wibox.layout.flex.horizontal`.
|
2016-09-02 18:14:43 +02:00
|
|
|
-- @param base_widget.align The alignment ("left", "center" or "right").
|
2015-02-26 16:06:19 +01:00
|
|
|
-- @param base_widget.bg_normal The background color for unfocused client.
|
|
|
|
-- @param base_widget.bg_normal The background color for unfocused client.
|
|
|
|
-- @param base_widget.fg_normal The foreground color for unfocused client.
|
|
|
|
-- @param base_widget.bg_focus The background color for focused client.
|
|
|
|
-- @param base_widget.fg_focus The foreground color for focused client.
|
|
|
|
-- @param base_widget.bg_urgent The background color for urgent clients.
|
|
|
|
-- @param base_widget.fg_urgent The foreground color for urgent clients.
|
|
|
|
-- @param base_widget.bg_minimize The background color for minimized clients.
|
|
|
|
-- @param base_widget.fg_minimize The foreground color for minimized clients.
|
|
|
|
-- @param base_widget.floating Symbol to use for floating clients.
|
|
|
|
-- @param base_widget.ontop Symbol to use for ontop clients.
|
2015-07-17 17:06:43 +02:00
|
|
|
-- @param base_widget.above Symbol to use for clients kept above others.
|
|
|
|
-- @param base_widget.below Symbol to use for clients kept below others.
|
2015-02-26 16:06:19 +01:00
|
|
|
-- @param base_widget.maximized Symbol to use for clients that have been maximized (vertically and horizontally).
|
|
|
|
-- @param base_widget.maximized_horizontal Symbol to use for clients that have been horizontally maximized.
|
|
|
|
-- @param base_widget.maximized_vertical Symbol to use for clients that have been vertically maximized.
|
|
|
|
-- @param base_widget.font The font.
|
2013-01-05 16:12:51 +01:00
|
|
|
function tasklist.new(screen, filter, buttons, style, update_function, base_widget)
|
2016-02-26 19:19:58 +01:00
|
|
|
screen = get_screen(screen)
|
2013-01-05 16:12:51 +01:00
|
|
|
local uf = update_function or common.list_update
|
|
|
|
local w = base_widget or flex.horizontal()
|
2009-10-24 14:53:01 +02:00
|
|
|
|
2011-10-04 13:55:59 +02:00
|
|
|
local data = setmetatable({}, { __mode = 'k' })
|
2015-07-07 18:07:59 +02:00
|
|
|
|
|
|
|
local queued_update = false
|
2015-09-27 14:10:45 +02:00
|
|
|
function w._do_tasklist_update()
|
2015-07-07 18:07:59 +02:00
|
|
|
-- Add a delayed callback for the first update.
|
|
|
|
if not queued_update then
|
|
|
|
timer.delayed_call(function()
|
2015-07-13 23:36:00 +02:00
|
|
|
queued_update = false
|
2016-05-01 19:39:28 +02:00
|
|
|
if screen.valid then
|
|
|
|
tasklist_update(screen, w, buttons, filter, data, style, uf)
|
|
|
|
end
|
2015-07-07 18:07:59 +02:00
|
|
|
end)
|
|
|
|
queued_update = true
|
|
|
|
end
|
|
|
|
end
|
2016-01-24 16:28:07 +01:00
|
|
|
function w._unmanage(c)
|
|
|
|
data[c] = nil
|
|
|
|
end
|
2015-09-27 14:10:45 +02:00
|
|
|
if instances == nil then
|
2016-04-17 15:37:00 +02:00
|
|
|
instances = setmetatable({}, { __mode = "k" })
|
2015-09-27 14:10:45 +02:00
|
|
|
local function us(s)
|
2016-02-26 19:19:58 +01:00
|
|
|
local i = instances[get_screen(s)]
|
2015-09-27 14:10:45 +02:00
|
|
|
if i then
|
|
|
|
for _, tlist in pairs(i) do
|
|
|
|
tlist._do_tasklist_update()
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
local function u()
|
2015-11-19 20:13:37 +01:00
|
|
|
for s in pairs(instances) do
|
2016-05-01 19:39:28 +02:00
|
|
|
if s.valid then
|
|
|
|
us(s)
|
|
|
|
end
|
2015-09-27 14:10:45 +02:00
|
|
|
end
|
2015-03-17 17:11:40 +01:00
|
|
|
end
|
2015-09-27 14:10:45 +02:00
|
|
|
|
|
|
|
tag.attached_connect_signal(nil, "property::selected", u)
|
|
|
|
tag.attached_connect_signal(nil, "property::activated", u)
|
|
|
|
capi.client.connect_signal("property::urgent", u)
|
|
|
|
capi.client.connect_signal("property::sticky", u)
|
|
|
|
capi.client.connect_signal("property::ontop", u)
|
|
|
|
capi.client.connect_signal("property::above", u)
|
|
|
|
capi.client.connect_signal("property::below", u)
|
|
|
|
capi.client.connect_signal("property::floating", u)
|
|
|
|
capi.client.connect_signal("property::maximized_horizontal", u)
|
|
|
|
capi.client.connect_signal("property::maximized_vertical", u)
|
|
|
|
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::icon", u)
|
|
|
|
capi.client.connect_signal("property::skip_taskbar", u)
|
|
|
|
capi.client.connect_signal("property::screen", function(c, old_screen)
|
|
|
|
us(c.screen)
|
|
|
|
us(old_screen)
|
|
|
|
end)
|
|
|
|
capi.client.connect_signal("property::hidden", u)
|
|
|
|
capi.client.connect_signal("tagged", u)
|
|
|
|
capi.client.connect_signal("untagged", u)
|
2016-01-24 16:28:07 +01:00
|
|
|
capi.client.connect_signal("unmanage", function(c)
|
|
|
|
u(c)
|
2016-02-12 09:08:21 +01:00
|
|
|
for _, i in pairs(instances) do
|
2016-01-24 16:28:07 +01:00
|
|
|
for _, tlist in pairs(i) do
|
|
|
|
tlist._unmanage(c)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end)
|
2015-09-27 14:10:45 +02:00
|
|
|
capi.client.connect_signal("list", u)
|
|
|
|
capi.client.connect_signal("focus", u)
|
|
|
|
capi.client.connect_signal("unfocus", u)
|
2016-05-01 19:39:28 +02:00
|
|
|
capi.screen.connect_signal("removed", function(s)
|
|
|
|
instances[get_screen(s)] = nil
|
|
|
|
end)
|
2015-09-27 14:10:45 +02:00
|
|
|
end
|
|
|
|
w._do_tasklist_update()
|
2015-11-19 20:11:42 +01:00
|
|
|
local list = instances[screen]
|
2015-09-27 14:10:45 +02:00
|
|
|
if not list then
|
|
|
|
list = setmetatable({}, { __mode = "v" })
|
|
|
|
instances[screen] = list
|
|
|
|
end
|
|
|
|
table.insert(list, w)
|
2009-10-24 14:53:01 +02:00
|
|
|
return w
|
2009-02-27 17:22:03 +01:00
|
|
|
end
|
|
|
|
|
2009-10-24 14:53:01 +02:00
|
|
|
--- Filtering function to include all clients.
|
|
|
|
-- @return true
|
2016-02-07 15:12:22 +01:00
|
|
|
function tasklist.filter.allscreen()
|
2009-10-24 14:53:01 +02:00
|
|
|
return true
|
|
|
|
end
|
|
|
|
|
|
|
|
--- Filtering function to include the clients from all tags on the screen.
|
|
|
|
-- @param c The client.
|
|
|
|
-- @param screen The screen we are drawing on.
|
|
|
|
-- @return true if c is on screen, false otherwise
|
2012-06-14 01:08:27 +02:00
|
|
|
function tasklist.filter.alltags(c, screen)
|
2009-02-27 17:22:03 +01:00
|
|
|
-- Only print client on the same screen as this widget
|
2016-02-26 19:19:58 +01:00
|
|
|
return get_screen(c.screen) == get_screen(screen)
|
2009-02-27 17:22:03 +01:00
|
|
|
end
|
|
|
|
|
2009-10-24 14:53:01 +02:00
|
|
|
--- Filtering function to include only the clients from currently selected tags.
|
2009-02-27 17:22:03 +01:00
|
|
|
-- @param c The client.
|
|
|
|
-- @param screen The screen we are drawing on.
|
2009-10-24 14:53:01 +02:00
|
|
|
-- @return true if c is in a selected tag on screen, false otherwise
|
2012-06-14 01:08:27 +02:00
|
|
|
function tasklist.filter.currenttags(c, screen)
|
2016-02-26 19:19:58 +01:00
|
|
|
screen = get_screen(screen)
|
2009-02-27 17:22:03 +01:00
|
|
|
-- Only print client on the same screen as this widget
|
2016-02-26 19:19:58 +01:00
|
|
|
if get_screen(c.screen) ~= screen then return false end
|
2009-03-25 14:51:14 +01:00
|
|
|
-- Include sticky client too
|
2009-10-24 14:53:01 +02:00
|
|
|
if c.sticky then return true end
|
2016-04-05 09:02:00 +02:00
|
|
|
local tags = screen.tags
|
2016-02-07 15:12:22 +01:00
|
|
|
for _, t in ipairs(tags) do
|
2009-03-14 13:47:50 +01:00
|
|
|
if t.selected then
|
|
|
|
local ctags = c:tags()
|
|
|
|
for _, v in ipairs(ctags) do
|
|
|
|
if v == t then
|
2009-10-24 14:53:01 +02:00
|
|
|
return true
|
2009-03-14 13:47:50 +01:00
|
|
|
end
|
|
|
|
end
|
2009-02-27 17:22:03 +01:00
|
|
|
end
|
|
|
|
end
|
2009-10-24 14:53:01 +02:00
|
|
|
return false
|
2009-02-27 17:22:03 +01:00
|
|
|
end
|
|
|
|
|
2010-10-17 15:35:50 +02:00
|
|
|
--- Filtering function to include only the minimized clients from currently selected tags.
|
|
|
|
-- @param c The client.
|
|
|
|
-- @param screen The screen we are drawing on.
|
|
|
|
-- @return true if c is in a selected tag on screen and is minimized, false otherwise
|
2012-06-14 01:08:27 +02:00
|
|
|
function tasklist.filter.minimizedcurrenttags(c, screen)
|
2016-02-26 19:19:58 +01:00
|
|
|
screen = get_screen(screen)
|
2010-10-17 15:35:50 +02:00
|
|
|
-- Only print client on the same screen as this widget
|
2016-02-26 19:19:58 +01:00
|
|
|
if get_screen(c.screen) ~= screen then return false end
|
2010-10-17 15:35:50 +02:00
|
|
|
-- Check client is minimized
|
|
|
|
if not c.minimized then return false end
|
2012-12-13 03:30:37 +01:00
|
|
|
-- Include sticky client
|
|
|
|
if c.sticky then return true end
|
2016-04-05 09:02:00 +02:00
|
|
|
local tags = screen.tags
|
2016-02-07 15:12:22 +01:00
|
|
|
for _, t in ipairs(tags) do
|
2010-10-17 15:35:50 +02:00
|
|
|
-- Select only minimized clients
|
|
|
|
if t.selected then
|
|
|
|
local ctags = c:tags()
|
|
|
|
for _, v in ipairs(ctags) do
|
|
|
|
if v == t then
|
|
|
|
return true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
return false
|
|
|
|
end
|
|
|
|
|
2009-10-24 14:53:01 +02:00
|
|
|
--- Filtering function to include only the currently focused client.
|
2009-08-27 11:21:32 +02:00
|
|
|
-- @param c The client.
|
|
|
|
-- @param screen The screen we are drawing on.
|
2009-10-24 14:53:01 +02:00
|
|
|
-- @return true if c is focused on screen, false otherwise
|
2012-06-14 01:08:27 +02:00
|
|
|
function tasklist.filter.focused(c, screen)
|
2009-08-27 11:21:32 +02:00
|
|
|
-- Only print client on the same screen as this widget
|
2016-02-26 19:19:58 +01:00
|
|
|
return get_screen(c.screen) == get_screen(screen) and capi.client.focus == c
|
2009-08-27 11:21:32 +02:00
|
|
|
end
|
|
|
|
|
2012-06-14 01:08:27 +02:00
|
|
|
function tasklist.mt:__call(...)
|
|
|
|
return tasklist.new(...)
|
|
|
|
end
|
|
|
|
|
|
|
|
return setmetatable(tasklist, tasklist.mt)
|
2009-05-08 11:59:38 +02:00
|
|
|
|
2011-09-11 16:50:01 +02:00
|
|
|
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80
|