mirror of
https://github.com/vincentbernat/i3wm-configuration.git
synced 2025-07-04 07:14:21 +02:00
widget: display a minimal tasklist for one-screen setups
We do not have enough space for a complete tasklist on one-screen setups. Therefore, we just display a minimal ones with just icons. Since this does not take much space, we display icons for all tags.
This commit is contained in:
parent
1359929f15
commit
d00ba1f4cd
1 changed files with 29 additions and 25 deletions
|
@ -173,33 +173,37 @@ for s = 1, screen.count() do
|
||||||
promptbox[s] = awful.widget.prompt({ layout = awful.widget.layout.horizontal.leftright })
|
promptbox[s] = awful.widget.prompt({ layout = awful.widget.layout.horizontal.leftright })
|
||||||
layoutbox[s] = awful.widget.layoutbox(s)
|
layoutbox[s] = awful.widget.layoutbox(s)
|
||||||
awful.widget.layout.margins[layoutbox[s]] = { left = 5 }
|
awful.widget.layout.margins[layoutbox[s]] = { left = 5 }
|
||||||
if screen.count() > 1 then
|
tasklist[s] = awful.widget.tasklist(
|
||||||
tasklist[s] = awful.widget.tasklist(
|
function(c)
|
||||||
function(c)
|
local fn = awful.widget.tasklist.label.currenttags
|
||||||
local title, color, _, icon = awful.widget.tasklist.label.currenttags(c, s)
|
if screen.count() == 1 then
|
||||||
-- Try to search for an alternative icon if none is available
|
fn = awful.widget.tasklist.label.alltags
|
||||||
for _, name in pairs({c.class, c.instance}) do
|
end
|
||||||
if not icon and title and name then
|
local title, color, _, icon = fn(c, s)
|
||||||
for _, n in pairs({name, name:lower()}) do
|
-- Try to search for an alternative icon if none is available
|
||||||
icon = awful.util.geticonpath(name,
|
for _, name in pairs({c.class, c.instance}) do
|
||||||
nil,
|
if not icon and title and name then
|
||||||
{"/usr/share/fvwm-crystal/fvwm/icons/Default/16x16/apps/",
|
for _, n in pairs({name, name:lower()}) do
|
||||||
"/usr/share/fvwm-crystal/fvwm/icons/Default/22x22/apps/",
|
icon = awful.util.geticonpath(name,
|
||||||
"/usr/share/icons/hicolor/16x16/apps/"})
|
nil,
|
||||||
if icon then
|
{"/usr/share/fvwm-crystal/fvwm/icons/Default/16x16/apps/",
|
||||||
-- This is our new icon. And we set it for the client to not search again
|
"/usr/share/fvwm-crystal/fvwm/icons/Default/22x22/apps/",
|
||||||
icon = image(icon)
|
"/usr/share/icons/hicolor/16x16/apps/"})
|
||||||
c.icon = icon
|
if icon then
|
||||||
end
|
-- This is our new icon. And we set it for the client to not search again
|
||||||
|
icon = image(icon)
|
||||||
|
c.icon = icon
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
-- Use our icon and don't set the status image.
|
end
|
||||||
|
-- Use our icon and don't set the status image.
|
||||||
|
if screen.count() > 1 then
|
||||||
return title, color, nil, icon
|
return title, color, nil, icon
|
||||||
end, tasklist.buttons)
|
elseif icon then
|
||||||
else
|
return "", color, nil, icon
|
||||||
tasklist[s] = ""
|
end
|
||||||
end
|
end, tasklist.buttons)
|
||||||
|
|
||||||
-- Create the taglist
|
-- Create the taglist
|
||||||
taglist[s] = sharetags.taglist(s, sharetags.label.all, taglist.buttons)
|
taglist[s] = sharetags.taglist(s, sharetags.label.all, taglist.buttons)
|
||||||
|
@ -230,7 +234,7 @@ for s = 1, screen.count() do
|
||||||
on(1, netgraph.widget), on(1, netwidget), on(1, separator),
|
on(1, netgraph.widget), on(1, netwidget), on(1, separator),
|
||||||
on(1, memwidget), on(1, separator),
|
on(1, memwidget), on(1, separator),
|
||||||
on(1, cpuwidget), on(1, separator),
|
on(1, cpuwidget), on(1, separator),
|
||||||
tasklist[s], tasklist[s] ~= "" and separator or "",
|
tasklist[s], separator,
|
||||||
layout = awful.widget.layout.horizontal.rightleft }
|
layout = awful.widget.layout.horizontal.rightleft }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue