diff options
| author | Danilo M. <danix@danix.xyz> | 2026-09-18 19:09:23 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-09-18 19:09:23 +0200 |
| commit | d975c14645554cfbe9ba1d8c9279f51bd8407673 (patch) | |
| tree | e5b60d21939ea02b4e2cb50a4342d071763083b1 /widgets | |
| parent | 7fddddcd39bb250cd2653e130c8f7899d2d3f19c (diff) | |
| download | conky-theme-udt-d975c14645554cfbe9ba1d8c9279f51bd8407673.tar.gz conky-theme-udt-d975c14645554cfbe9ba1d8c9279f51bd8407673.zip | |
feat: add a title icon to every labelled card
Add card.ICON and a card.title helper that draws the glyph in the
highlight colour before the label, at the label's own size. The eight
labelled cards use it, in both the fit_unit width measurement and the
draw, so the icon cannot overrun a narrow cell. Clock (no label) and
weather (condition glyph already) are unchanged, and the no-data notice
titles stay text-only.
Codepoints were chosen against a rendered contact sheet, not fontconfig
alone, since a wrong codepoint draws a plausible neighbour.
Diffstat (limited to 'widgets')
| -rw-r--r-- | widgets/breaktimer.lua | 6 | ||||
| -rw-r--r-- | widgets/cache.lua | 6 | ||||
| -rw-r--r-- | widgets/calendar.lua | 3 | ||||
| -rw-r--r-- | widgets/disks.lua | 3 | ||||
| -rw-r--r-- | widgets/gpu.lua | 6 | ||||
| -rw-r--r-- | widgets/network.lua | 6 | ||||
| -rw-r--r-- | widgets/slackware.lua | 7 | ||||
| -rw-r--r-- | widgets/system.lua | 6 |
8 files changed, 21 insertions, 22 deletions
diff --git a/widgets/breaktimer.lua b/widgets/breaktimer.lua index e6487b8..6fed30e 100644 --- a/widgets/breaktimer.lua +++ b/widgets/breaktimer.lua @@ -43,7 +43,7 @@ function M.draw(cr, rect, colors) -- Fluid type: the height budget grows the content to fill the cell, the -- measured width fit pulls it back where the phase label would overrun. local groups = { - { { 'BREAKTIMER', card.FONT_MONO, LABEL_F }, + { { card.title_str(card.ICON.breaktimer, 'BREAKTIMER'), card.FONT_MONO, LABEL_F }, { bt.countdown, card.FONT_HEAVY, BIG_F } }, } for _, r in ipairs(rows) do @@ -60,8 +60,8 @@ function M.draw(cr, rect, colors) card.text_right(cr, inner.x + inner.w, inner.y + S * BIG_F, bt.countdown) card.font(cr, card.FONT_MONO, label_size, false) - card.rgba(cr, colors.label) - card.text(cr, inner.x, inner.y + label_size, 'BREAKTIMER') + card.title(cr, inner.x, inner.y + label_size, card.ICON.breaktimer, + 'BREAKTIMER', colors) local ey = inner.y + S * BIG_F + row_size * 1.6 local step = row_size * 2.0 diff --git a/widgets/cache.lua b/widgets/cache.lua index 3772458..c6391ca 100644 --- a/widgets/cache.lua +++ b/widgets/cache.lua @@ -37,7 +37,8 @@ function M.draw(cr, rect, colors) local row_n = #items local S_h = inner.h * 0.94 / (1.78 + row_n * 0.64) local groups = { - { { 'CACHE', card.FONT_MONO, LABEL_F }, { c.total.label, card.FONT_HEAVY, 1.0 } }, + { { card.title_str(card.ICON.cache, 'CACHE'), card.FONT_MONO, LABEL_F }, + { c.total.label, card.FONT_HEAVY, 1.0 } }, } for i = 1, row_n do groups[#groups + 1] = { { names[i], card.FONT_MONO, ROW_F }, @@ -48,8 +49,7 @@ function M.draw(cr, rect, colors) local row_size = S * ROW_F card.font(cr, card.FONT_MONO, label_size, false) - card.rgba(cr, colors.label) - card.text(cr, inner.x, inner.y + label_size, 'CACHE') + card.title(cr, inner.x, inner.y + label_size, card.ICON.cache, 'CACHE', colors) -- The total shares the header line with the label, set on the same baseline -- and right-aligned: the width carries the number instead of an otherwise diff --git a/widgets/calendar.lua b/widgets/calendar.lua index b31e3b2..da173c9 100644 --- a/widgets/calendar.lua +++ b/widgets/calendar.lua @@ -122,8 +122,7 @@ function M.draw(cr, rect, colors) card.text_right(cr, inner.x + inner.w, inner.y + big_size, title) card.font(cr, card.FONT_MONO, label_size, false) - card.rgba(cr, colors.label) - card.text(cr, inner.x, inner.y + label_size, 'CALENDAR') + card.title(cr, inner.x, inner.y + label_size, card.ICON.calendar, 'CALENDAR', colors) -- === Month grid ========================================================= -- 2.3, not 1.5: the weekday row sat close enough to the header that the diff --git a/widgets/disks.lua b/widgets/disks.lua index fa97b50..3922188 100644 --- a/widgets/disks.lua +++ b/widgets/disks.lua @@ -50,8 +50,7 @@ function M.draw(cr, rect, colors) end card.font(cr, card.FONT_MONO, label_size, false) - card.rgba(cr, colors.label) - card.text(cr, inner.x, inner.y + label_size, 'DISKS') + card.title(cr, inner.x, inner.y + label_size, card.ICON.disks, 'DISKS', colors) local top = inner.y + label_size * 2.2 local avail_h = (inner.y + inner.h) - top diff --git a/widgets/gpu.lua b/widgets/gpu.lua index cd6cc2f..7d5f2ed 100644 --- a/widgets/gpu.lua +++ b/widgets/gpu.lua @@ -35,7 +35,8 @@ function M.draw(cr, rect, colors) local row_n = #TEMPS + 1 -- VRAM + FAN local S_h = inner.h * 0.94 / (2.088 + row_n * 0.646) local groups = { - { { 'GPU', card.FONT_MONO, LABEL_F }, { big_txt, card.FONT_HEAVY, 1.0 } }, + { { card.title_str(card.ICON.gpu, 'GPU'), card.FONT_MONO, LABEL_F }, + { big_txt, card.FONT_HEAVY, 1.0 } }, { { 'ARC B580', card.FONT_MONO, LABEL_F } }, } for _, t in ipairs(TEMPS) do @@ -59,8 +60,7 @@ function M.draw(cr, rect, colors) card.text_right(cr, inner.x + inner.w, y + S, big_txt) card.font(cr, card.FONT_MONO, label_size, false) - card.rgba(cr, colors.label) - card.text(cr, inner.x, y + label_size, 'GPU') + card.title(cr, inner.x, y + label_size, card.ICON.gpu, 'GPU', colors) card.rgba(cr, colors.value) card.text(cr, inner.x, y + S + label_size * 1.7, 'ARC B580') diff --git a/widgets/network.lua b/widgets/network.lua index 5d1a8ca..3a11521 100644 --- a/widgets/network.lua +++ b/widgets/network.lua @@ -80,7 +80,8 @@ function M.draw(cr, rect, colors) -- taken as the smaller of a height budget and a measured width fit. local LABEL_F, BIG_F, ROW_F = 0.30, 1.0, 0.30 local groups = { - { { 'NET', card.FONT_MONO, LABEL_F }, { '888.8M/s', card.FONT_HEAVY, BIG_F } }, + { { card.title_str(card.ICON.network, 'NET'), card.FONT_MONO, LABEL_F }, + { '888.8M/s', card.FONT_HEAVY, BIG_F } }, { { '\u{F0318} 192.000.000.000', card.FONT_MONO, ROW_F } }, { { '\u{F01DA} 888.8M/s', card.FONT_MONO, ROW_F }, { '\u{F0552} 888.8M/s', card.FONT_MONO, ROW_F } }, @@ -98,8 +99,7 @@ function M.draw(cr, rect, colors) card.text_right(cr, inner.x + inner.w, inner.y + S * BIG_F, rate_str(down)) card.font(cr, card.FONT_MONO, label_size, false) - card.rgba(cr, colors.label) - card.text(cr, inner.x, inner.y + label_size, 'NET') + card.title(cr, inner.x, inner.y + label_size, card.ICON.network, 'NET', colors) local ey = inner.y + S * BIG_F + row_size * 1.4 local step = row_size * 2.2 diff --git a/widgets/slackware.lua b/widgets/slackware.lua index f9afb70..9686f8a 100644 --- a/widgets/slackware.lua +++ b/widgets/slackware.lua @@ -74,7 +74,8 @@ function M.draw(cr, rect, colors) -- Fluid type: the height budget grows the content to fill the cell, the -- measured width fit pulls it back where a row would overrun. local groups = { - { { 'SLACKWARE', card.FONT_MONO, LABEL_F }, { age_txt, card.FONT_HEAVY, BIG_F } }, + { { card.title_str(card.ICON.slackware, 'SLACKWARE'), card.FONT_MONO, LABEL_F }, + { age_txt, card.FONT_HEAVY, BIG_F } }, } for _, r in ipairs(rows) do groups[#groups + 1] = { { r[1], card.FONT_MONO, ROW_F }, @@ -90,8 +91,8 @@ function M.draw(cr, rect, colors) card.text_right(cr, inner.x + inner.w, inner.y + S * BIG_F, age_txt) card.font(cr, card.FONT_MONO, label_size, false) - card.rgba(cr, colors.label) - card.text(cr, inner.x, inner.y + label_size, 'SLACKWARE') + card.title(cr, inner.x, inner.y + label_size, card.ICON.slackware, + 'SLACKWARE', colors) local ey = inner.y + S * BIG_F + row_size * 1.6 local step = row_size * 2.0 diff --git a/widgets/system.lua b/widgets/system.lua index d4f6188..98e0ae1 100644 --- a/widgets/system.lua +++ b/widgets/system.lua @@ -65,7 +65,8 @@ function M.draw(cr, rect, colors) -- the width. card.fit_unit supplies the width side of that. local LABEL_F, BIG_F, ROW_F = 0.30, 1.0, 0.32 local groups = { - { { 'CPU', card.FONT_MONO, LABEL_F }, { load_txt, card.FONT_HEAVY, BIG_F } }, + { { card.title_str(card.ICON.system, 'CPU'), card.FONT_MONO, LABEL_F }, + { load_txt, card.FONT_HEAVY, BIG_F } }, { { cpu_txt or '', card.FONT_MONO, ROW_F } }, { { board_txt or '', card.FONT_MONO, ROW_F } }, { { 'RAM', card.FONT_MONO, ROW_F }, { '999.9G / 999.9G', card.FONT_MONO, ROW_F } }, @@ -96,8 +97,7 @@ function M.draw(cr, rect, colors) card.text_right(cr, inner.x + inner.w, y + big_size, load_txt) card.font(cr, card.FONT_MONO, label_size, false) - card.rgba(cr, colors.label) - card.text(cr, inner.x, y + label_size, 'CPU') + card.title(cr, inner.x, y + label_size, card.ICON.system, 'CPU', colors) -- The hardware this card is about, under the header. Truncated by character, -- never by byte: a model string can carry a multi-byte character and half of |
