A tiny desktop run by one network

Three windows and a dock. Every click goes through one neural network that decides what happens to every window, in CSS, with 0 bytes of JavaScript.

clicks left Out of clicks: press Reset.
All windows are away. Open one from the dock.
Notes←↑↓→
Photos←↑↓→
Dune
Lagoon
Aurora
Ember
Moss
Dusk
Glacier
Poppy
Night
← All
Monitor←↑↓→
clicks used
clicks left
photo shown
windows, top first (x, y)
Notesclosedin the dockfull screenopen
Photosclosedin the dockfull screenopen
Monitorclosedin the dockfull screenopen
the network
network4 layers, 362 neurons
weights994
run40 times, once per click
NotesPhotosMonitor
How it works (for the curious)

Where this comes from

A reduced, CSS edition of Cheng Lou's HandwiredOS, a desktop whose windows, dock and apps are run by one compiled program. CSS can't read where the pointer is, which key you pressed or what time it is, so this edition is driven by clicks only: every click is one event. You can't drag a window; the arrows move it one step on a coarse grid. Typing goes to a normal text box the network never sees.

One click, as ReLUs

PartHow
which control37 controls, the click comes in as one number ev; [ev = k] for each k, three ReLUs each
only on screena window's buttons work when it is open and not minimized: relu([ev = k] + open − minimized − 1)
switched offthe screen network also says which arrows can still move (or restore a full-screen window) and which window is in front; the page shrinks those buttons' labels to nothing, so a click there does nothing and costs nothing
to the topthe window gets rank 2; every window above it moves down one: rank − AND(top_w, [rank > rank_w])
to the bottomclose and minimize: rank 0, everyone below moves up one
movex + AND(right, [x < max]) − AND(left, [x ≥ 1]): clamped to the desktop
maximizea toggle, mx + AND(max, 1 − mx) − AND(max, mx); a move or a close also restores it
photosa thumbnail opens its photo while the grid shows; back returns to the grid; closing Photos too
layer 1
175
layer 2
107
layer 3
80
output
20
hand-writtencarry (passes a value down a layer)

A second, smaller network (3 layers, 168 neurons) turns the final 20 numbers into what you see: each window's rectangle (full screen when maximized), whether it is on screen, which one is focused, which photo shows, the arrows that can still move. CSS then only places boxes at those numbers, with a transition.

The state

Per windowValues
open, minimized, maximized0 or 1
x, ygrid cells: Notes 0…7 × 0…5, Photos 0…8 × 0…4, Monitor 0…8 × 0…5
rank0, 1, 2: the stacking order, a permutation; 2 is on top
and oncethe photo shown (0 is the grid) and the clicks used

Each of the 40 slots is its own group of 37 radio buttons, and every control on screen holds 40 labels, one per slot, of which only the next slot's is shown. A window's title bar and its inside are two labels for the same click. That's 1,600 labels in all.

Checked in numpy against a plain Python window manager: every event in every combination of window flags, stacking order and photo (285,000 cases), every event at every grid position, and 4,000 random sequences of 60 events, every value after every event. The browser test clicks 2 scripted and 6 random 40-click sequences in Chromium, Firefox and WebKit, on a wide screen and at phone width, compares the whole state after every click, and checks that switched-off buttons and the keyboard change nothing. Built by handwired/scripts/mini_os.py and build_os.py.