# Fenesh Implementation Boundaries

_Peios / Developing for Peios / GXWI Architecture_

> Locate shell behavior and understand its authority boundaries.

Fenesh is a Rust application built on the `gxwi` crate. It renders shell
surfaces and companion windows, while the desktop service and compositor
provide session transport, authorization, and window management.

## Source layout

The implementation separates shell state from companion applications:

| Source | Responsibility |
|---|---|
| `src/main.rs` | Connect the shell, register surfaces, and wire shared state |
| `src/dock.rs` and `src/launcher.rs` | Application selection, window actions, and pins |
| `src/settings.rs`, `src/looks.rs`, and `src/pinned.rs` | Read settings, resolve defaults, and maintain shell state |
| `src/watch.rs` | Follow registry notifications and refresh settings |
| `src/wallpaper.rs` | Validate image paths and bound reads shared by the shell and Settings |
| `src/topbar.rs`, `src/person.rs`, and `src/power.rs` | Clock, display identity, and session or power controls |
| `src/welcome.rs` | First-session welcome attempt and marker |
| `src/bin/fenesh-welcome.rs` | Get started application |
| `src/bin/fenesh-settings/` | Settings controls, validation, and registry writes |

The [source repository](https://github.com/peios/fenesh) contains these files
and the manual pages under `docs/man`. `docs/fenesh.regman` owns the Fenesh
registry reference. Build and contributor instructions live in
`docs/building.md`, outside the published Learn tree.

## Authority and untrusted input

Fenesh runs with the desktop account's identity. Its shell role comes
from Fenestra's configuration, not from a user-interface claim. Launcher
and dock events resolve application IDs against the catalog before asking
the desktop to start a program. Display names provide presentation only;
they are not an authorization decision.

The shared wallpaper loader opens paths without waiting on named pipes and
accepts only regular files, including symlinks to regular files. It checks
the opened object before reading, then bounds the read to
16 MiB plus one byte for detecting overflow. It rejects oversized content,
including growth after the metadata check. File extensions select the
content type; this is not image decoding or sanitization.

Gallery image URLs encode each filename as one path segment before HTML
attribute escaping. Spaces, non-ASCII text, and characters such as `#`,
`?`, and `%` remain part of the filename instead of changing the URL.

Desktop Settings tests registry access through the registry API. It does
not infer write access from group names. Writes for a single key use a
transaction. Advanced changes across GXWI and Fenestra keys use separate
transactions, so a later failure can leave an earlier key changed.

The power menu asks the session service to end the session and asks peinit
to restart or power off the machine. Those services retain the authority
to accept or refuse the request. The shell shows a refusal rather than
presenting the action as completed.

## Updates and defaults

Personal settings take precedence over machine defaults where the setting
supports them. Registry watchers follow the nearest existing ancestor so
a missing settings key can be created later. A failed watch stops that
watcher and reports the failure; it does not silently poll as a fallback.
Desktop Settings separately polls every four seconds to refresh controls.

Wallpaper refresh compares the selected path, file size, and modification
time after a registry notification. It does not monitor the image file.
Clock and pin updates share state across shell surfaces. Focus and overlay
visibility belong to each connected display, so one display's focus does
not need to match another's.

The first-session marker records that the automatic welcome launch was
attempted. It does not prove that the user saw or completed the window.
