shell: stage the AirPods opening card
This commit is contained in:
parent
41c858a5fc
commit
52640cd650
7 changed files with 295 additions and 0 deletions
36
surfaces/quickshell/services/AccessoryPresentation.qml
Normal file
36
surfaces/quickshell/services/AccessoryPresentation.qml
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
// The shell's projection of an accessory event already admitted by sessiond.
|
||||
//
|
||||
// This is deliberately a view-state holder, not a Bluetooth service. LibrePods
|
||||
// cannot import it, and there is no Quickshell IPC target here: an accessory
|
||||
// reaches this state only when SessiondBridge receives sessiond's directive.
|
||||
pragma Singleton
|
||||
|
||||
import QtQuick
|
||||
|
||||
QtObject {
|
||||
id: root
|
||||
|
||||
// Incremented for every admitted presentation. A surface keys its local
|
||||
// animation and timeout to this edge, so reconnect updates do not grow a
|
||||
// pile of cards.
|
||||
property int generation: 0
|
||||
property string accessoryId: ""
|
||||
property string label: "AirPods"
|
||||
property int leftCharge: -1
|
||||
property int rightCharge: -1
|
||||
property int caseCharge: -1
|
||||
property bool charging: false
|
||||
|
||||
function present(event) {
|
||||
// The daemon has already checked producer admission and payload class.
|
||||
// Keep this copy bounded: QML needs display fields, never pairing keys,
|
||||
// advertisement bytes, or arbitrary producer metadata.
|
||||
root.accessoryId = String(event.accessory_id ?? "");
|
||||
root.label = String(event.label ?? "AirPods");
|
||||
root.leftCharge = Number(event.left_charge ?? -1);
|
||||
root.rightCharge = Number(event.right_charge ?? -1);
|
||||
root.caseCharge = Number(event.case_charge ?? -1);
|
||||
root.charging = event.charging === true;
|
||||
root.generation += 1;
|
||||
}
|
||||
}
|
||||
|
|
@ -442,6 +442,13 @@ Singleton {
|
|||
Session.lock();
|
||||
return;
|
||||
}
|
||||
if (msg.directive === "accessory_presentation") {
|
||||
// sessiond sends this only after producer admission and content
|
||||
// classification. The shell projects it; it does not reinterpret
|
||||
// a Bluetooth observation into an authority decision.
|
||||
AccessoryPresentation.present(msg.presentation ?? {});
|
||||
return;
|
||||
}
|
||||
console.error("[sessiond-bridge] UNKNOWN authority directive: "
|
||||
+ JSON.stringify(msg)
|
||||
+ " — this shell is older than the daemon driving it");
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
BooruResponseData 1.0 BooruResponseData.qml
|
||||
singleton AgentSessions 1.0 AgentSessions.qml
|
||||
singleton AccessoryPresentation 1.0 AccessoryPresentation.qml
|
||||
singleton Ai 1.0 Ai.qml
|
||||
singleton AppSearch 1.0 AppSearch.qml
|
||||
singleton Audio 1.0 Audio.qml
|
||||
|
|
|
|||
Loading…
Reference in a new issue