c8-settings #
"PC settings" app, built on c8ui, and c8-accounts (online accounts' tokens).
Depends on: c8ui, c8-protocols, libsecret, gdk-pixbuf (c8-sync), curl (run time).
src/main.c (window, nav, model from the snapshot, setting_* helpers and
bound controls; bound_combo for a combo whose index comes from a fn), pages.c (Personalise (under Start background, and in a Lock screen section, a note whether a picture from Photos is shown, with Remove: g_unlink of c8-base's c8_background_path, which the shell, c8-sync and the sign-in copy follow; tested headless: notes, Remove for Start), XR (rewritten 2026-12-02 for the Monado path: Drawn by is [glasses] runtime; what c8 applies at once is apart from Head tracking, which Monado's driver reads only when XR starts; eye distance now reaches the driver's 3D mode too; tested headless wide and at 480), Mouse & touchpad,
Keyboard, Power, General; General's last section is Stealth mode,
[stealth] on, and main.c's stealth_flipped rebuilds the page shown
when it flips: PC info's name, Network's addresses and connection
names (shown_addresses), Bluetooth's device names, Online accounts'
names and emails all use c8-base's stealth.h; Startup apps and
Keyboard shortcuts show a scrubbed command disabled with the real one
kept to save (command_entry, entry_value in lists.c), Night light's
place becomes a caption. Tested headless: the toggle, PC info, Network), night.c (Night light, a section at the
foot of Displays: the switch, the colour, When, and under it what the
schedule chosen needs, rebuilt from the page's refresh: two time
pickers, or the place with "Use my place in Weather" when weather.ini
has a default one), info.c (PC info, page info: PC name, model from
DMI, processor, memory, graphics by PCI id from hwdata's pci.ids
(else the driver's name), the home drive's size, system, kernel,
cont8nuum's version; Copy puts it on the clipboard as lines), lists.c (Startup apps, Keyboard shortcuts), defaults.c
(Default apps: one accent-coloured tile per kind, Windows 8.1's Defaults
page: Web browser, Mail, Terminal, Music, Video, Photos, Calendar, Maps,
Text editor; the tile shows the current default's icon and name, a click
or Enter opens a flyout of the apps that handle it (More apps: all), the
choice is g_app_info_set_as_default_for_type for the kind's first
type and each other one the app's MimeType= lists (all of them for an
app that lists none), so a viewer without, say, JPEG XL leaves it to
the one that has it (mimeapps.list, so xdg-open follows; Photos' kind is
every type glycin reads, as c8-photos' entry; tested headless:
Vivaldi took 4 of the 26, Photos all 26); Terminal sets [general] terminal
to the chosen emulator's executable, listed from TerminalEmulator
entries. The kinds are c8-base's default-apps.h, which c8-shell's
defaults.c uses too),
display.c
(Displays via wlr-output-management, with a 15 s keep/revert dialog;
kept settings persist as [output NAME]), powermode.c (Power page's
Power mode, the same daemon as the shell's Power tile, kept in step),
sound.c (libpulse on its GLib loop, through pipewire-pulse: default
output/input, volume, mute, per-app volume; devices of one card lose the
card's shared name prefix; read again 100 ms after a subscription event,
controls updated in place), network.c (NetworkManager read on a worker
thread: each device as an expander with addresses, Airplane mode, Wi-Fi
and mobile broadband radios, known Wi-Fi networks with Forget; connecting
stays the shell flyout's), bluetooth.c (BlueZ object manager, kept for
the app's life: power, paired devices (connect, disconnect, remove,
battery), discovery and discoverable only while the page is open, found
devices by signal; the pairing agent /org/cont8nuum/settings/agent,
KeyboardDisplay, default agent while PC settings runs, asks in dialogs;
after Pair it sets Trusted and connects). rfkill.c is c8-base's,
as c8-shell's: Airplane mode soft-blocks every radio (Bluetooth too) via
/dev/rfkill (uaccess ACL); the shell's status and Networks flyout use it
as well, NetworkManager's WirelessEnabled only without rfkill.
Online accounts (accounts.c, page accounts): shows and changes the
accounts of c8-accounts (src/accounts/, in libexec, D-Bus activated
as org.cont8nuum.Accounts, quits after 5 idle minutes (callers like
c8-sync can keep it up for hours, so it reads the providers again when
their folders change, and drops libsecret's service when
org.freedesktop.secrets changes owner: a restarted oo7-daemon doesn't
know the old session); interface and
provider file format documented in c8-protocols' Accounts1.xml).
Providers are keyfiles, share/cont8nuum/accounts/NAME.provider (ships
snail.zone: services rssnail and weathersnail, both signing in
with cont8nuum, a public OAuth client of auth.snail.zone's Authentik set
up for us by snail.zone's owner with the loopback, each with its own
scope (whether weathersnail's API takes this client's tokens is
untested), and its snail logo as
Icon=snail.zone.svg, drawn as the badge instead of the letter tile);
and cont8nuum.provider.in, the cont8nuum account (c8-online): service
sync, client cont8nuum, its mark on the account's purple as
cont8nuum-account.svg, the site's address from the account_url
meson option (default the live site, https://c8.lowtide.sbs, since
2026-12-05, the user's ask; empty leaves the provider out; build.sh
gives what C8_ACCOUNT_URL says, else the nested .prefix build the
local test site http://127.0.0.1:8088, so a test session never syncs
into the real account, and any other build the live site; plain
http is taken to this machine itself, 127.0.0.1/localhost, without
C8_ACCOUNTS_ALLOW_HTTP, by c8-accounts and c8-sync alike); it is always first in ListProviders,
so first in PC settings, whichever folder its file is in).
Signing in: SignIn returns
the authorize URL, the page opens it (our activation token), the
daemon listens on http://127.0.0.1:PORT/callback (the client must
accept any port: Authentik regex ^http://127\.0\.0\.1:\d+/callback$),
PKCE S256; the services of one sign-in are chained in the same tab (the
loopback answers the first callback with a 302 to the next authorize
URL) and each is saved as soon as it's authorized; name and email from
userinfo; given up after 10 min, on CancelSignIn, or when the caller
leaves the bus. Accounts in ~/.config/cont8nuum/accounts.ini, tokens
(refresh, access, expiry) in the wallet via libsecret, every call async and given up after
WALLET_S (20 s, inside D-Bus's 25 s call timeout), so a stuck or
locked wallet never stalls the daemon. Apps call
GetAccessToken(service, rejected); only the daemon refreshes (rotating
refresh tokens), a 400 from the token endpoint marks the service
needs-sign-in (the page shows Sign in). Remove revokes.
A service's Redirect= is for issuers that won't take the loopback
(none shipped uses it now; rssnail did, via its swagger docs'
oauth2-redirect, before it had a client of ours): authorize goes to
that page of theirs, the user pastes
the address it ends on into the band's box, FinishSignIn takes the
code (state checked; a bare code too). Mixed chains work: SignInNext
tells the page about each next service (after a paste the page opens
it). Ready=false lists a service as "Not available yet" and leaves it
out of sign-ins (none shipped uses it now). curl with the
request on stdin (--config -) so no token is in argv.
C8_ACCOUNTS_ALLOW_HTTP lets issuers and APIs be http, for tests
against a local mock (also read by c8-news). Tested against a mock
Authentik + rssnail + Secret Service on a private bus: the whole sign-in
chain, refresh, rejected tokens, restart from the wallet, remove; the
page wide and at 480. The paste flow, both orders, against the mock.
Checked live: the cont8nuum client's issuer and that its authorize takes
the loopback on any port. Untested: a real sign-in, refresh and the API
with its tokens,
the sign-in band (with its paste box) and Remove dialog by hand.
--page NAME opens a page.
Settings sync (src/sync/c8-sync.c, binary c8-sync, started by c8):
a settings-protocol client like PC settings, so what it takes from the
account applies live and config.ini keeps its comments. Each synced
section is one item on c8-online, config.SECTION (synced[]:
appearance, general without autostart/terminal/xwayland, notifications,
keyboard, touchpad, mouse, bindings without the ones that run a command;
not power, not outputs; refused holds for what the server says as
much as for what goes up, since its text is untrusted), its keys
as sorted key=value lines. Per item the state
(~/.local/share/cont8nuum/sync/ACCOUNT.ini) keeps the base (the text
both sides last agreed on) and the server's rev: local changed only →
PUT with If-Match; the server's changed (or no base: a PC new to the
account) → GET, merge key by key against the base (a key changed on
both takes the server's), apply here what differs (apply, on the main
thread), PUT if the merge isn't what the server has. Rounds run on a
worker thread (blocking curl and GetAccessToken("sync")): 2 s after a
settings snapshot or Accounts' Changed, and every 5 min
(C8_SYNC_POLL seconds, for tests). The service's toggle in Online
accounts is the off switch (NoAccount: it waits). It names the device
(hostname) once. A setting the compositor refuses stays as it is here
and goes back up as this PC's value. The Start and lock screen
pictures (c8-base background.h, set by Photos) go whole as
picture.start/picture.lock (sync_picture, pictures[]): the
state keeps the SHA-256 of the file agreed on and the rev. Changed here
only → PUT; changed there (or a PC new to it) → the server's wins;
removed here → DELETE; removed there and unchanged here → removed here,
but a new one here beats one removed there. Up: the file if it fits the
listing's limits.picture_max_bytes (else item_max_bytes, else
256 KiB), else a copy shrunk by gdk-pixbuf (2560 down to 640 a side,
q85) in the sync folder. Down (curl output, 16 MiB at most): only a
JPEG by its first bytes and gdk-pixbuf's file info, 16384 a side at
most, decoded by the jpeg loader named (no sniffing) and encoded again
(q92) before it's written by rename, so Start, the lock screen and
SDDM never read the server's bytes. A watch on the folder kicks a
round. Tested with c8-online's tests/run.sh (desktop part): a 3000 px
picture shrunk to fit, the other PC's taken and encoded again and not
sent back, a fake JPEG and a PNG refused, removal both ways. Not synced yet: Start
(start.ini, the shell doesn't reread it), apps' own files (files.ini,
news.ini), no status in PC settings, nothing encrypted.
The window is c8ui_pages (page_list[], build_page sets app.page
and tracks app.content, NULL on the list, which refreshes skip).
Narrow (under 800 px: c8ui_pages folds by itself, its 340 pane + 460;
main.c no longer watches the size), keeping the page: the page list fills the
window as a menu nav, a page opens over it with a back button (Escape,
Alt+Left), and going back destroys it (Bluetooth's discovery stops).
What sits side by side on a page (PC info's names and values, shortcut
rows, Night light's times, the account rows and paste box) is a box
with c8ui_box_set_narrow_orientation, so it turns by itself when the
window is narrow (under 600); window_narrow() is gone.