No description
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
nnra6864 ccbfe4016b chore: Dependencies come from the ktisigonos organization
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 01:23:02 +01:00
.gitignore chore: Zig's caches and fetched packages are ignored 2026-11-10 16:09:48 +01:00
adapter.zig refactor: Code, error messages and READMEs no longer cite design numbers 2026-11-09 20:17:19 +01:00
build.zig feat: INI files are set by path, generated and blocked through kosm_ini, with a dialect per program 2026-11-08 09:55:24 +01:00
build.zig.zon chore: Dependencies come from the ktisigonos organization 2026-11-11 01:23:02 +01:00
Dialect.zig refactor: Code, error messages and READMEs no longer cite design numbers 2026-11-09 20:17:19 +01:00
Parser.zig refactor: Code, error messages and READMEs no longer cite design numbers 2026-11-09 20:17:19 +01:00
README.md refactor: Code, error messages and READMEs no longer cite design numbers 2026-11-09 20:17:19 +01:00
root.zig refactor: Code, error messages and READMEs no longer cite design numbers 2026-11-09 20:17:19 +01:00

kosm_ini

INI for kosm. INI has no standard, so kosm_ini is a base: dialect builds an adapter for one program's flavour, with every choice a field of kosm_ini.Dialect that has a sensible default. The package exports one adapter, ini, with the defaults; it claims .ini, and files without that extension (kdeglobals, dunstrc, qt5ct's colors) pass .lang = "ini". Apps use it through output.edit, output.generate and output.block; it knows no app.

A package for a program whose INI differs exports its own dialect:

pub const adapter = @import("kosm_ini").dialect(.{ .name = "dunst", .strings = .quoted });

Dialect fields

Field Default Meaning
name required the adapter's name, passed as .lang
extensions none file extensions the adapter claims, with the dot
default_format #rrggbb, true/false how values are spelled unless the app or user chose
comments #, ; prefixes starting a comment line; the first writes block markers
inline_comments false a comment prefix after a space ends a value (size = 12 # pt)
nested_headers true [A][B] is section B inside A, as KDE writes it
top_level_keys true keys may come before the first section
strings .bare .bare: strings written as they are, and a "..." value keeps its quotes on edit. .quoted: strings, colors and joined values written in quotes, which an edit replaces too
separator " = " what generate writes between a key and its value

Colors, booleans and float precision are not dialect fields: they are the file's kosm.Format, which the app sets (foot's rrggbb, KDE's #RRGGBB, yes/no).

Behaviour

  • Paths: [section] names are one segment as written, so [Colors:Header] is Colors:Header and [Colors:Header][Inactive] is Colors:Header.Inactive; a name holding a dot is a quoted segment. Keys are everything before the first =, spaces around it dropped: Show Preview, Name[$e].
  • Spelled twice: a section spelled twice is one table. A key written twice is two matches, so set fails and setAll or setNth choose.
  • Values run to the end of the line, outer spaces dropped; Enable= is an empty value that can be set. With the default dialect Color=#041C26 is a value, not a comment.
  • Refused, writing nothing: lists (INI has none; build the program's spelling as a joined value), text with a line break, and text that would read back differently (outer spaces or quotes on a bare string, a quote in a quoted one).
  • KDE's [$i] flag (a locked group, [General][$i]) is an error naming the line, so kosm never edits a group KDE may lock. [$Version] is an ordinary section.
  • Whole files: generate writes top-level keys first, then one [section] per table; nested tables become [A][B] headers.
  • Blocks: # kosm:begin <id> comments. A block's top-level keys belong to the section above it, so a block appended after the user's sections should hold only sections.