From 69add3767988d0dfc6ecac37405cfb10abe8dbb7 Mon Sep 17 00:00:00 2001 From: Lukasz Kasprzak Date: Fri, 21 Aug 2026 10:16:51 +0200 Subject: feat(colitur-x): fill the window instead of a fixed grid Cell size is now computed from the window -- width divided seven ways, height six -- and the number of lines a feast name gets is whatever fits the resulting cell. config.h holds minimums rather than sizes. Under a tiling window manager the calendar now uses its whole tile. It previously drew a fixed 196x116 grid and left the rest of the tile black, which is what every screenshot of it has shown. The size hint is now PREFERRED plus MINIMUM, never fixed. Pinning it fought the WM, which ignored it anyway, and stopped the grid using a larger tile. Added -g WxH, the same flag st takes, mainly because it makes the reflow testable: verified at 1365x687 (two name lines) and 1852x1024 (three). --- config.h | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) (limited to 'config.h') diff --git a/config.h b/config.h index 36fe3cd..c0e2cd3 100644 --- a/config.h +++ b/config.h @@ -39,18 +39,27 @@ static const char *col_sel_light = "#ffd24a"; enum { SEL_RING = 3 }; /* px per ring */ /* --------------------------------------------------------------- geometry */ -/* CELL_W/CELL_H must suit the font: a cell holds the day number plus - NAME_LINES lines of `font`. Line height itself is taken from the font at - runtime, so only these two need revisiting when you change size. - Rough guide: CELL_W >= 10 * (widest name chars you want), CELL_H >= - big-font height + NAME_LINES * font height + 12. */ +/* The grid FILLS the window: cell size is computed from whatever space the + window manager gives us, divided seven across and six down. Under a + tiling WM that means the calendar uses its whole tile instead of sitting + in a corner of it, and resizing reflows rather than clipping. + + These are therefore MINIMUMS, not sizes. If the window is too small to + honour them the grid stops shrinking and simply overflows -- better than + cells too small to read. How many lines a name gets is likewise derived + from the cell height at runtime; NAME_LINES_MAX only caps it. */ enum { - CELL_W = 196, - CELL_H = 116, - PAD = 10, /* margin around the grid */ - HEAD_H = 62, /* title + weekday headings */ - DETAIL_H = 116, /* the pane under the grid */ - NAME_LINES = 3, /* how many lines a feast name gets */ + CELL_W_MIN = 96, + CELL_H_MIN = 52, + PAD = 10, /* margin around the grid */ + HEAD_H = 62, /* title + weekday headings */ + DETAIL_H = 116, /* the pane under the grid */ + NAME_LINES_MAX = 5, + + /* Preferred size when the window manager lets us choose. A tiling WM + will not, and that is fine: the grid reflows to whatever it gets. */ + WIN_W = 1200, + WIN_H = 820, }; /* ------------------------------------------------------------------ labels */ -- cgit v1.3