SchOS/docs/Website
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Nexoniarz 1c1b0c9570 tty: six virtual terminals, and the plumbing that makes them terminals
/dev/tty1..tty6, Alt+F1..F6 or `chvt N`. Each is an independent terminal --
its own screen, cursor, line discipline, foreground process group and
session. Two shells on two terminals are unrelated processes that share a
keyboard and a screen.

What made it possible is a backing store. The console drew straight into the
framebuffer and scrolled by moving pixels, which works exactly as long as
nothing else wants the screen: there was nowhere to put terminal 2 while
terminal 1 was visible, and nothing to repaint terminal 1 from. Each terminal
owns a grid of cells now and the framebuffer shows whichever grid is active,
so vt_switch() is set-index, repaint, return -- nothing is saved on the way
out because the outgoing grid has been current all along.

The rule the layer is built on: a terminal does not know whether it is
visible. Writes land in the grid, the cursor moves, the grid scrolls, all
unconditionally; drawing is one question asked at the bottom of vt.c. Every
alternative spreads "am I on screen" through the escape parser, and then a
terminal switched away from mid-sequence comes back wrong.

Everything that was a single global is per-terminal now: tty_fg_pgrp (deleted),
termios, the input ring, the escape parser, the UTF-8 decoder, and the cursor
-- which also stops being pixels in gfx.c and becomes cells in the terminal.
TIOCSCTTY was `return 0` and now records proc->ctty, which is what /dev/tty
resolves through; /dev/tty was an alias for /dev/console with the same minor,
and they are different questions.

kbd.c names Alt+F1..F6 as KEY_ALT_F1+n, above 0xFF on purpose -- every byte
value is already a character or a UTF-8 continuation, and a chord colliding
with one would be typed into the terminal instead of switching away from it.
What the chord means is decided in console.c, where the terminals are.

VT_ACTIVATE / VT_WAITACTIVE / VT_GETSTATE / VT_OPENQRY, Linux's numbers.
The argument to ACTIVATE is by value, not a pointer -- same shape as TCFLSH.

Two bugs found by screenshotting the result rather than reading the log:

  - zsh emits 0x0F to leave alt-charset mode, because that is what the `linux`
    terminfo says rmacs is, and the console drew CP437 glyph 0x0F: a sun, in
    the prompt, on every line. A terminal never draws a C0 control character.
  - SGR 7 was unimplemented, so zsh's partial-line marker rendered as a bare
    '#' instead of a reversed block. Reverse video swaps the colours at draw
    time, not at store time, so turning it off restores what was underneath.

Verified by screendump: tty1 and tty2 show different screens, and switching
back repaints tty1's earlier content from its grid. schfs-check passes.

docs/architecture/terminals.md, including what it does not do -- no
scrollback, no reflow, no VT_PROCESS mode for a display server to veto a
switch, which Schcom will need before it owns Alt+F7.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VQ7Qx8E1q1M1bbCq8QLHS2
2026-09-13 00:08:00 +02:00
..
Assets docs: a Markdown reader on the site, and the flag stays up 2026-09-12 21:53:06 +02:00
app.js docs: a website, in three files 2026-09-12 21:38:47 +02:00
docs.html docs: a footer note on building with AI 2026-09-12 21:58:20 +02:00
docs.js tty: six virtual terminals, and the plumbing that makes them terminals 2026-09-13 00:08:00 +02:00
index.html docs: a footer note on building with AI 2026-09-12 21:58:20 +02:00
README.md docs: a footer note on building with AI 2026-09-12 21:58:20 +02:00
style.css docs: a footer note on building with AI 2026-09-12 21:58:20 +02:00

The website

Three files and a folder of marks. No build step, no dependencies, no framework — open index.html and it works, including from a file:// URL.

index.html    the front page
docs.html     the documentation reader
style.css     the palette, transcribed from include/theme.h
app.js        the front page: the boot log types, sections fade in
docs.js       the Markdown renderer and the doc index
Assets/       shift.svg (logo), uberblock.svg (SchFS), guru.svg (PSOGM),
              pride.svg

The docs reader

docs.html renders the Markdown in docs/ in the site's own theme, with the index down the left and a table of contents down the right. Links between documents are rewritten to stay inside the reader, so ../history/schfs.md in an architecture page navigates rather than downloads.

The parser is about 150 lines in docs.js and handles what docs/ actually uses: headings, fenced code, tables, lists, quotes, rules and inline marks. A Markdown library would be larger than everything else here put together. Every document is escaped before a single tag is emitted — the only HTML that reaches the page is HTML docs.js wrote.

This one page needs a server. Browsers refuse fetch() on file:// for the same reason they refuse it cross-origin, so opening docs.html from a file gives a panel explaining that instead of the docs. Everything else works from a file. To read them locally:

cd /home/nexoniarz/Dokumenty/Projects/SchOS
python3 -m http.server 8000
# then http://localhost:8000/docs/Website/docs.html

Adding a document means adding one line to the DOCS array in docs.js. The reader will only load a path that appears there.

Both pages carry two statements below the licence line, and both are meant to be read rather than skimmed past.

The first is the flag, below. The second is about AI, and it says the thing worth saying: the tool is not the measure. A project is good when the people building it understand what was built. That claim is deliberately made next to a link to history/, because that directory is where it can be checked — the bugs are written up in full, including the wrong turns and the measurements that disproved them. An explanation you can follow is the evidence; the byline is not.

The flag

Assets/pride.svg is in the top bar and in the footer, on both pages, and it is not seasonal. Support with an end date is marketing; this is a project that belongs to whoever writes it. It is also deliberately small — the site is about an operating system, and the flag is a statement, not a subject.

The rules it follows

The palette is not a design decision. It is include/theme.h, copied. A site describing an operating system should look like the operating system, and copying the header means the two cannot drift apart by accident.

PSOGM purple appears exactly once. #4B1D9A is on the crash-screen section and nowhere else, because ../branding/README.md says it means the machine stopped and that a colour used everywhere means nothing. If it shows up in a second place, that is a bug in the page.

The typefaces are the ones the OS ships. Roboto for text and JetBrains Mono for the system voice — both already in ports/, both already in NOTICE. They are requested from the system rather than downloaded: a font file would be larger than the entire rest of the site.

The script is optional. If app.js fails to load the page is still complete and still readable. Everything it does is decoration, and it honours prefers-reduced-motion by doing none of it.

The boot log is real. The lines in app.js are from an actual boot, not invented. The timer calibration line is there deliberately; see section 13 of ../history/kernel.md for what it cost.

Editing it

The numbers in the Numbers section are measured, not estimated, and they go stale. To refresh them:

find kernel include -name '*.c' -o -name '*.h' | xargs wc -l | tail -1
grep -c '^SYSCALL' kernel/sys/table.inc

The feature cards carry a tag — runs, in progress, or designed — and the tag is a promise. Anything marked runs is in the tree and works today. When that stops being true, change the tag rather than the wording.