diff options
Diffstat (limited to 'desktop/companion/Companion.qml')
| -rw-r--r-- | desktop/companion/Companion.qml | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/desktop/companion/Companion.qml b/desktop/companion/Companion.qml index 6eb7370..f8d50e9 100644 --- a/desktop/companion/Companion.qml +++ b/desktop/companion/Companion.qml @@ -12,6 +12,7 @@ import Quickshell import Quickshell.Io import Quickshell.Wayland +import Quickshell.Bluetooth import Quickshell.Hyprland import QtQuick import ".." @@ -105,6 +106,7 @@ PanelWindow { property double pulseAt: 0 property double wakeAt: 0 property double admireAt: 0 + property double singAt: 0 property double lastLineAt: 0 property double lastMonologueAt: 0 property bool monologue: false @@ -210,6 +212,24 @@ PanelWindow { } } + // Sony headphones connecting, by the island's rule (island/StatusPill.qml): + // recognised by their model prefix, since BlueZ gives no class that says + // "headphones". A connection makes her sing for Mood.T.singHold. Bluetooth + // reads empty for about 2 s after launch, so a shell start with them + // already on is not a connection: btReady waits past that. + readonly property bool phonesConnected: (Bluetooth.devices?.values ?? []) + .some(d => d.connected && /^(WH|WF)-|^LinkBuds/.test(d.deviceName)) + property bool btReady: false + // shortcut: a genuine connection in the first 4 s after a shell start is + // missed along with the startup populate; tighten if that bites. + Timer { interval: 4000; running: true; onTriggered: root.btReady = true } + onPhonesConnectedChanged: { + if (!root.phonesConnected || !root.btReady) return; + root.singAt = Date.now(); + root.now = root.singAt; + root.say("headphones"); + } + // A listed wallpaper on an empty workspace: she turns to it and blushes. // Checked after the events above (switching to an empty workspace, // closing its last window) and whenever she stops being away: shown, @@ -265,7 +285,7 @@ PanelWindow { shovedAt: root.shovedAt, recording: root.asst.recording, busy: root.asst.busy, repliedAt: root.repliedAt, clicks: root.clicks, admireAt: root.admireAt, mockAt: root.mockAt, typingAt: root.typingAt, wakeAt: root.wakeAt, - monologue: root.monologue, idle: root.idle, + singAt: root.singAt, monologue: root.monologue, idle: root.idle, }) readonly property string outfit: Mood.outfit(root.destructAt, root.now, Prefs.companionSkirtless * 1000) // Anything above the monologue cuts it short. |
