From 8f99f1650e4a7363af1d83190b4082fb72a9f73f Mon Sep 17 00:00:00 2001 From: Lukasz Kasprzak Date: Tue, 25 Aug 2026 19:02:35 +0200 Subject: ttym 3.0: fix terminal and config bugs, fold terminal-only patches into base Correctness fixes: - restore the terminal on SIGQUIT and SIGHUP. atexit never runs on an uncaught fatal signal, so Ctrl+\ left the cursor hidden and autowrap disabled. - drop the unconditional newline in restore_tty. Every run emitted a stray blank line, including piped output. - treat EINTR as an interruption rather than a poll() failure, which delayed Ctrl+C by up to one 100ms frame. config-file patch: - make comment stripping quote-aware so a value may contain '#', and strip one matched pair of quotes. bar_fill = "#" was silently dropped, despite '#' being the glyph of the hash style this build ships. - resolve bar_fill/bar_empty inside resolve_bar and clear them on --bar, so command-line flags beat the config file as documented. Previously config glyphs silently overrode --bar. - report unknown keys, unparseable booleans and malformed lines on stderr. flash = enabled silently meant off. - never write to disk. --dump-config prints a commented template on stdout instead of the binary creating ~/.config/ttym/config on first run. Patch set: - fold persist-alert, flash and bar-styles into the base. The base is now terminal-only: it opens /dev/tty, draws and exits, with no file writes and no subprocesses. Everything still in patches/ changes what the program touches. - seven patches become four; config-file's prerequisites drop from six patches to one (notify), so it is regenerable mechanically. - regenerate every patch. All apply with zero fuzz and compile. Source: - rewrite argv in place rather than into a malloc'd copy (C99 5.1.2.2.1), removing die(), four free() calls and . - fold the duplicated elapsed-time expression into elapsed(). - drop dead code: have_any, (void)cfg, and an unreachable branch in parse_duration. - replace hand-counted padding with \033[K. Docs and build: - timer.1: -c is the third hook argument, not the fourth. Add EXIT STATUS (a stopwatch always exits 130 -- it has no natural end) and ENVIRONMENT. Document config precedence and quoting. - wire VERSION into a dist target; it was defined and never used. - track .gitignore, which previously ignored itself, so a fresh clone had no ignore rules. Claude-Session: https://claude.ai/code/session_01APLBs8RB1FcUaC4viVkzbP --- README.md | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index a8ebce5..5c0e3ea 100644 --- a/README.md +++ b/README.md @@ -2,17 +2,21 @@ ttym - terminal countdown / stopwatch ===================================== A small countdown timer and stopwatch in C. Single binary, libc-only, -no daemon. Default build is intentionally minimal: +no daemon. The base build is terminal-only -- it writes no files and +spawns no processes: - T-24:13 +00:47 [>>>>>>>>>>------------------------------] 25% + T-24:13 +00:47 [████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░] 25% - countdown when given a duration; stopwatch when not - pause/resume with [space], quit with [q] or Ctrl+C - - ASCII progress bar - - one-shot terminal bell on completion + - progress bar with eight styles (`--bar`, auto-detected by locale) + - alert until keypress on completion (`--no-persist` to disable), + with an optional reverse-video flash (`--flash on|off`) -Anything beyond that is an optional patch under patches/. See -patches/README for the available set and apply order. +Every feature that touches the filesystem, runs a subprocess or needs +an external binary is an optional patch under patches/ -- desktop +notifications, session logging, hooks and a runtime config file. See +patches/README for the set and apply order. Requirements @@ -54,6 +58,9 @@ Usage FLAGS: -q no sound -s silent + --no-persist skip alert-until-keypress loop + --flash on|off terminal flash during alert loop + --bar STYLE bar style: unicode|ascii|hash|dots|line|block|arrow|minimal -- end of options -h help -- cgit v1.3