mirror of
https://github.com/vincentbernat/i3wm-configuration.git
synced 2025-07-03 14:54: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,10 +173,13 @@ 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 title, color, _, icon = awful.widget.tasklist.label.currenttags(c, s)
|
local fn = awful.widget.tasklist.label.currenttags
|
||||||
|
if screen.count() == 1 then
|
||||||
|
fn = awful.widget.tasklist.label.alltags
|
||||||
|
end
|
||||||
|
local title, color, _, icon = fn(c, s)
|
||||||
-- Try to search for an alternative icon if none is available
|
-- Try to search for an alternative icon if none is available
|
||||||
for _, name in pairs({c.class, c.instance}) do
|
for _, name in pairs({c.class, c.instance}) do
|
||||||
if not icon and title and name then
|
if not icon and title and name then
|
||||||
|
@ -195,11 +198,12 @@ for s = 1, screen.count() do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
-- Use our icon and don't set the status image.
|
-- 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