This is a projection, not a development branch. The tree above was constructed from the internal source named below under a manifest that decides which paths may leave, then scanned as a whole tree rather than as a series of patches, and only then published. Public history starts here because the history before it was not admissible, and neither was the tree. What used to stand in this repository included a rescue copy of another machine, a directory of phone handoffs, deployment wired to one house, and a submodule pointing at a forge no stranger can reach. None of that was ever the product. It stays in the private forge, which is allowed to hold the whole working organism, and this is what was deliberately sent out instead. Three mechanisms produced this tree, in decreasing order of trust. A top-level path the manifest does not name never arrives at all, which is the one that catches directories nobody has thought of yet. Named internal files inside admitted roots are dropped. A short, reviewed table replaces deployment defaults that a public build must not carry -- an endpoint aimed at one LAN, a VPN profile belonging to one phone, packaging built from one checkout path. Everything after this commit is an ordinary publication with the same three trailers, so a force push stops being routine and starts meaning that something deliberate happened. The trailers bind the projection to its source without pretending the public SHA is the private one: same lineage, different tree, and the record says so. Source-Sha: 8f27b1e76a8fef560a336aba18e6990713ff1047 Policy-Sha: 6b261d2f3e6e1fb19874846ba4bb1dfe15565d25b8618c1c1afba0419c101d27 Tree-Digest: 18ec3563c5e5ef9a414993a9f6734b251ff9ed3cd56eebdd6cac01e45c6e3067
112 lines
3.6 KiB
QML
112 lines
3.6 KiB
QML
// One typed view over sessiond's USB posture and mode verbs.
|
|
//
|
|
// usb-signaller owns configfs, souveraine-upower supplies adjacent charging
|
|
// evidence, and federation/probe leases will supply who is attached and who is
|
|
// already working there. The shell owns none of it; it asks sessiond and shows
|
|
// the answer.
|
|
pragma Singleton
|
|
|
|
import QtQuick
|
|
import Quickshell
|
|
import Quickshell.Io
|
|
|
|
Singleton {
|
|
id: root
|
|
|
|
property bool available: false
|
|
property bool busy: false
|
|
property string lastError: ""
|
|
property string mode: "unknown"
|
|
property string rawMode: "unknown_mode"
|
|
property var availableModes: []
|
|
property string dataRole: "unknown"
|
|
property bool chargerKnown: false
|
|
property bool chargerOnline: false
|
|
property var attachedIdentity: null
|
|
property var probeOwner: null
|
|
|
|
signal refreshed()
|
|
signal changeFailed(string reason)
|
|
|
|
function refresh() {
|
|
root._send({ op: "usb" });
|
|
}
|
|
|
|
function setMode(mode) {
|
|
if (!["developer", "hid", "kvm", "charging_only"].includes(mode)) {
|
|
root.changeFailed("unsupported USB mode: " + mode);
|
|
return;
|
|
}
|
|
root.busy = true;
|
|
root._send({ op: "set_usb_mode", mode: mode });
|
|
}
|
|
|
|
function hasMode(rawMode) {
|
|
return root.availableModes.includes(rawMode);
|
|
}
|
|
|
|
property var _queued: null
|
|
|
|
function _send(message) {
|
|
if (sock.connected) {
|
|
sock.write(JSON.stringify(message) + "\n");
|
|
return;
|
|
}
|
|
root._queued = message;
|
|
sock.connected = true;
|
|
}
|
|
|
|
Socket {
|
|
id: sock
|
|
path: Quickshell.env("XDG_RUNTIME_DIR") + "/souveraine/sessiond.sock"
|
|
|
|
onConnectionStateChanged: {
|
|
if (connected && root._queued) {
|
|
const message = root._queued;
|
|
root._queued = null;
|
|
sock.write(JSON.stringify(message) + "\n");
|
|
} else if (!connected && root._queued) {
|
|
root._queued = null;
|
|
root.available = false;
|
|
root.busy = false;
|
|
root.lastError = "sessiond socket unavailable";
|
|
root.changeFailed(root.lastError);
|
|
}
|
|
}
|
|
|
|
parser: SplitParser {
|
|
splitMarker: "\n"
|
|
onRead: message => {
|
|
let reply;
|
|
try {
|
|
reply = JSON.parse(message);
|
|
} catch (error) {
|
|
root.lastError = "unparseable USB reply";
|
|
root.busy = false;
|
|
root.changeFailed(root.lastError);
|
|
return;
|
|
}
|
|
if (reply.ok !== true) {
|
|
root.lastError = reply.reason || "USB request refused";
|
|
root.busy = false;
|
|
root.changeFailed(root.lastError);
|
|
return;
|
|
}
|
|
|
|
root.mode = reply.mode ?? "unknown";
|
|
root.rawMode = reply.raw_mode ?? "unknown_mode";
|
|
root.availableModes = reply.available_modes ?? [];
|
|
root.dataRole = reply.data_role ?? "unknown";
|
|
root.chargerKnown = reply.charger_online !== null
|
|
&& reply.charger_online !== undefined;
|
|
root.chargerOnline = reply.charger_online === true;
|
|
root.attachedIdentity = reply.attached_identity ?? null;
|
|
root.probeOwner = reply.probe_owner ?? null;
|
|
root.available = true;
|
|
root.busy = false;
|
|
root.lastError = "";
|
|
root.refreshed();
|
|
}
|
|
}
|
|
}
|
|
}
|