Skip to main content

Module doctor

Module doctor 

Source
Expand description

--doctor: diagnose configuration problems.

The report is assessment-first: short status lines for what works, a per-block live test, a per-glyph icon table, and a final Problems list where every finding gets a one-line diagnosis and a matter-of-fact fix.

Sections:

  • Header: which config file, icon set file and bar font are in use (the bar font is auto-detected from a running i3/sway over IPC; --font overrides it).

  • Blocks: every configured block is instantiated and run for one cycle (unless --doctor-skip-live), showing its rendered output or a diagnosed failure — including render errors, which are explained with the placeholders the block actually provided. Note that this performs real work: network requests, command execution, D-Bus calls.

  • Icons: one row per glyph with its codepoint and the font that will actually draw it (via fontconfig). Rows drawn by fonts outside the bar’s font list are highlighted. “Used by” lists the blocks that can request the icon.

  • Problems: numbered findings with concrete fixes.

A block can only request icons its prepared contract declares — the block plan each block builds from its configuration, checked when the block publishes a widget — so doctor validates the whole declared contract and takes every declared icon as in use by that block. It does not try to prove which declarations a particular configuration or runtime state would reach: a declaration a format never renders is reported as undefined just the same, because the contract is what the block is allowed to ask for. Blocks that choose names at runtime (custom, custom_dbus) declare that openly and are reported as such.

Doctor continues after recoverable failures: a missing tool, an unreadable section, a block that fails its live test are reported (with install or fix instructions where known) and the rest of the report still runs. It stops early only when there is nothing left to inspect — a configuration file that is missing, unreadable, or not valid TOML.

Enums§

IconDisplay
Returns the number of problems found. The caller turns that into a conventional exit status: zero when clean, nonzero when doctor found something. How doctor shows icons in the terminal.

Functions§

run
run_worker
Entry point for --doctor-worker <index>: run one block’s live test in this process and print the result as JSON on stdout.