aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-09-17 13:15:31 +0200
committerDanilo M. <danix@danix.xyz>2026-09-17 13:15:31 +0200
commit8e1baa72813fd93fc103b6d2d69753f952a24e3f (patch)
tree73c1718e9ee692d38cf6c7428783a759d3623756
parent5b210415759bf0fbd605a5cee84a10450866530c (diff)
downloadconky-theme-udt-8e1baa72813fd93fc103b6d2d69753f952a24e3f.tar.gz
conky-theme-udt-8e1baa72813fd93fc103b6d2d69753f952a24e3f.zip
feat: put every card's big number in the same place
Mirror the weather header so the glyph sits large on the left and the temperature, city and condition run against the right edge, and move the system card's CPU percentage onto its header line, right-aligned. All big values now render at the card's right edge.
-rw-r--r--README.md6
-rw-r--r--widgets/system.lua15
-rw-r--r--widgets/weather.lua18
3 files changed, 21 insertions, 18 deletions
diff --git a/README.md b/README.md
index 8c56090..71efc9e 100644
--- a/README.md
+++ b/README.md
@@ -187,9 +187,9 @@ cell is left sparse; size it off the height alone and a short cell shrinks the
text to a whisper. The robust way is a measured fit: `card.fit_unit()` returns
the largest base size at which every row still fits the width, and the widget
takes the smaller of that and its height budget. Larger cell, larger type; a row
-that would collide pulls the size back down. The GPU and cache cards do this. A
-card that cannot afford the measuring pass can still key off width with a clamp,
-`math.max(lo, math.min(hi, inner.w * k))`; the clock, weather, system and disks
+that would collide pulls the size back down. The GPU, cache and system cards do
+this. A card that cannot afford the measuring pass can still key off width with
+a clamp, `math.max(lo, math.min(hi, inner.w * k))`; the clock, weather and disks
cards do.
**Decide where the slack goes, and let one element absorb it.** The clock pins
diff --git a/widgets/system.lua b/widgets/system.lua
index 231192c..1db3c45 100644
--- a/widgets/system.lua
+++ b/widgets/system.lua
@@ -53,7 +53,7 @@ function M.draw(cr, rect, colors)
end
-- Height the non-equaliser content needs, in units of S, plus a reserve for
-- the equaliser band. The smaller of that budget and the width fit is S.
- local fixed_units = 1.30 + 1.13 + temp_n * ROW_F * 1.8 + 0.10
+ local fixed_units = 1.00 + 1.13 + temp_n * ROW_F * 1.8 + 0.10
local S = clamp(math.min(inner.h * 0.96 / (fixed_units + 1.7),
card.fit_unit(cr, inner.w * 0.96, groups, 100)), 10, 72)
local label_size = S * LABEL_F
@@ -62,19 +62,20 @@ function M.draw(cr, rect, colors)
local y = inner.y
- -- Aggregate load, the headline number.
+ -- Aggregate load, the headline number. It takes the header line, right
+ -- aligned like the big value on every other card, with the label top-left.
+ card.font(cr, card.FONT_HEAVY, big_size, false)
+ card.rgba(cr, load and card.threshold(load, 25, 75, colors) or colors.label)
+ 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.font(cr, card.FONT_HEAVY, big_size, false)
- card.rgba(cr, load and card.threshold(load, 25, 75, colors) or colors.label)
- card.text(cr, inner.x, y + label_size + big_size, load_txt)
-
-- The equaliser: one bar per core, rising from a common baseline. It takes
-- the room left between the header and the RAM/temperature block, so it is
-- the card's slack absorber.
- local eq_top = y + label_size + big_size + S * 0.30
+ local eq_top = y + big_size + S * 0.30
local bar_h = S * 0.18
local step = row_size * 1.8
local eh = clamp((inner.y + inner.h) - eq_top - (S * 1.13 + temp_n * step),
diff --git a/widgets/weather.lua b/widgets/weather.lua
index cd3e074..f50c6f1 100644
--- a/widgets/weather.lua
+++ b/widgets/weather.lua
@@ -123,23 +123,25 @@ function M.draw(cr, rect, colors)
-- anyway, since the stat rows run edge to edge.
local function clamp(v, lo, hi) return math.max(lo, math.min(hi, v)) end
local temp_size = clamp(inner.w * 0.135, 40, 84)
- local glyph_size = clamp(temp_size * 0.74, 30, 60)
+ local glyph_size = clamp(temp_size * 0.95, 38, 78)
local label_size = clamp(inner.w * 0.030, 12, 19)
local desc_size = clamp(inner.w * 0.038, 15, 24)
local row_size = clamp(inner.w * 0.032, 13, 20)
local row_step = row_size * 2.0
- -- Header: temperature and city against the left edge, condition glyph
- -- against the right. text_right takes the RIGHT edge as its x, and measures
- -- ink rather than advance, which is what you want for aligning to an edge.
+ -- Header, mirrored to match the other cards: the condition glyph large on
+ -- the left, the big temperature and the rest of the text against the right
+ -- edge. text_right takes the RIGHT edge as its x, and measures ink rather
+ -- than advance, which is what you want for aligning to an edge.
local glyph = weather.icon(w.id, now, w.sunrise, w.sunset)
card.font(cr, card.FONT_MONO, glyph_size, false)
card.rgba(cr, colors.highlight)
- card.text_right(cr, inner.x + inner.w, y + glyph_size * 0.95, glyph)
+ card.text(cr, inner.x, y + glyph_size * 0.95, glyph)
card.font(cr, card.FONT_HEAVY, temp_size, false)
card.rgba(cr, colors.body)
- card.text(cr, inner.x, y + temp_size * 0.86, string.format('%d\u{00B0}', math.floor(w.temp + 0.5)))
+ card.text_right(cr, inner.x + inner.w, y + temp_size * 0.86,
+ string.format('%d\u{00B0}', math.floor(w.temp + 0.5)))
card.font(cr, card.FONT_MONO, label_size, false)
card.rgba(cr, colors.label)
@@ -147,7 +149,7 @@ function M.draw(cr, rect, colors)
if weather.is_stale(w.dt, now) then
city = city .. ' stale ' .. weather.age_str(w.dt, now)
end
- card.text(cr, inner.x, y + temp_size * 1.28, city)
+ card.text_right(cr, inner.x + inner.w, y + temp_size * 1.28, city)
-- Condition, in OWM's own words, first letter capitalised.
card.font(cr, card.FONT_UI, desc_size, false)
@@ -155,7 +157,7 @@ function M.draw(cr, rect, colors)
local desc = w.description or ''
desc = desc:sub(1, 1):upper() .. desc:sub(2)
local dy = y + temp_size * 1.95
- card.text(cr, inner.x, dy, desc)
+ card.text_right(cr, inner.x + inner.w, dy, desc)
-- Rule.
local ry = dy + desc_size * 1.4