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/system.lua | |
| 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/system.lua')
| -rw-r--r-- | widgets/system.lua | 6 |
1 files changed, 3 insertions, 3 deletions
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 |
