<feed xmlns='http://www.w3.org/2005/Atom'>
<title>ttym.git/Makefile, branch main</title>
<subtitle>simple, modular CLI timer and stopwatch written in C</subtitle>
<id>https://git.labunix.xyz/ttym.git/atom?h=main</id>
<link rel='self' href='https://git.labunix.xyz/ttym.git/atom?h=main'/>
<link rel='alternate' type='text/html' href='https://git.labunix.xyz/ttym.git/'/>
<updated>2026-08-25T17:19:14Z</updated>
<entry>
<title>hooks: ship three commented examples, install them, document the contract</title>
<updated>2026-08-25T17:19:14Z</updated>
<author>
<name>Lukasz Kasprzak</name>
<email>lukas@labunix.xyz</email>
</author>
<published>2026-08-25T17:19:14Z</published>
<link rel='alternate' type='text/html' href='https://git.labunix.xyz/ttym.git/commit/?id=f8a687cbb855ed4e3aa54128624101a21ba5a8c3'/>
<id>urn:sha1:f8a687cbb855ed4e3aa54128624101a21ba5a8c3</id>
<content type='text'>
Add hooks/on_start, hooks/on_done and hooks/on_quit. They are named
after the hooks themselves so copying one into ~/.config/ttym/hooks/ is
the entire installation step, and each carries its argument contract in
a header comment.

  on_start  sets the terminal window title to what is running
  on_done   desktop notification plus a sound, both backgrounded, with
            the first available of paplay/aplay/mpv/ffplay
  on_quit   records abandoned sessions to a TSV under XDG_STATE_HOME and
            restores the terminal title

make install places them in PREFIX/share/doc/ttym/hooks; make uninstall
removes them and both directories; make dist ships hooks/ with the
executable bits intact.

The man page's HOOKS section now documents what the code actually does
rather than what could be assumed from the call sites:

  - $2 differs per hook: requested duration on on_start, full duration
    on on_done, and time actually elapsed -- excluding time spent paused
    -- on on_quit. An abandoned 25m countdown reports what really ran.
  - $3 is always passed, so it is never unset.
  - hooks block: timer forks and waitpid()s, so on_done delays the
    completion bell and the alert loop. Background anything slow.
  - stdin, stdout and stderr all go to /dev/null, which is why printing
    is pointless and cannot corrupt the redrawn progress line.
  - execvp(3) means a script needs a #! line.

README gains a Hooks section. All three examples pass sh -n and
shellcheck, and were tested end to end through the documented flow:
make install to a staging prefix, copy into a config dir, run.

Claude-Session: https://claude.ai/code/session_01APLBs8RB1FcUaC4viVkzbP
</content>
</entry>
<entry>
<title>ttym 3.0: fix terminal and config bugs, fold terminal-only patches into base</title>
<updated>2026-08-25T17:02:35Z</updated>
<author>
<name>Lukasz Kasprzak</name>
<email>lukas@labunix.xyz</email>
</author>
<published>2026-08-25T17:02:35Z</published>
<link rel='alternate' type='text/html' href='https://git.labunix.xyz/ttym.git/commit/?id=8f99f1650e4a7363af1d83190b4082fb72a9f73f'/>
<id>urn:sha1:8f99f1650e4a7363af1d83190b4082fb72a9f73f</id>
<content type='text'>
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 &lt;stdarg.h&gt;.
  - 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
</content>
</entry>
<entry>
<title>initial commit</title>
<updated>2026-05-20T12:23:09Z</updated>
<author>
<name>Lukasz Kasprzak</name>
<email>lukas@labunix.xyz</email>
</author>
<published>2026-05-20T12:23:09Z</published>
<link rel='alternate' type='text/html' href='https://git.labunix.xyz/ttym.git/commit/?id=9e3fcd953e7136b900d6aabafe1c64c083a927be'/>
<id>urn:sha1:9e3fcd953e7136b900d6aabafe1c64c083a927be</id>
<content type='text'>
</content>
</entry>
</feed>
