aboutsummaryrefslogtreecommitdiffstats
path: root/desktop/companion/Companion.qml
diff options
context:
space:
mode:
Diffstat (limited to 'desktop/companion/Companion.qml')
-rw-r--r--desktop/companion/Companion.qml25
1 files changed, 23 insertions, 2 deletions
diff --git a/desktop/companion/Companion.qml b/desktop/companion/Companion.qml
index 0a1360f..1e96ff4 100644
--- a/desktop/companion/Companion.qml
+++ b/desktop/companion/Companion.qml
@@ -51,7 +51,9 @@ PanelWindow {
implicitHeight: 260
color: "transparent"
exclusionMode: ExclusionMode.Ignore
- WlrLayershell.layer: WlrLayer.Top
+ // Overlay, the assistant canvas's layer, so she can sit above its dim
+ // (see remap below).
+ WlrLayershell.layer: WlrLayer.Overlay
WlrLayershell.namespace: "keystone-companion"
WlrLayershell.keyboardFocus: WlrKeyboardFocus.None
// Her body only: clicks anywhere else, the bubble included, reach the
@@ -69,6 +71,7 @@ PanelWindow {
property double repliedAt: 0
property double mockAt: 0
property double typingAt: 0
+ property double pulseAt: 0
property double wakeAt: 0
property double lastLineAt: 0
property double lastMonologueAt: 0
@@ -112,7 +115,11 @@ PanelWindow {
const what = event.data.trim();
const t = Date.now();
if (what === "keystone-typing") {
- root.typingAt = t;
+ // Pulses come at most once a second, so a lone key (a
+ // shortcut, an arrow) is one pulse and typing is a run
+ // of them: she watches from the second within 2.5 s.
+ if (t - root.pulseAt < 2500) root.typingAt = t;
+ root.pulseAt = t;
} else if (what === "keystone-delete") {
root.typingAt = t;
if (Mood.mockAllowed(root.mockAt, t)) {
@@ -129,12 +136,26 @@ PanelWindow {
Connections {
target: root.asst
+ function onOpenChanged() {
+ if (!root.asst.open) return;
+ root.remapping = true;
+ remap.restart();
+ }
function onReplied() {
root.repliedAt = Date.now();
root.say("ready");
}
}
+ // Hyprland stacks a later surface above an earlier one on the same layer
+ // and 0.56.2 has no layer rule to order them, so the canvas's full-screen
+ // dim covered her and her think and wave were never seen. When it opens
+ // she unmaps and maps again, after it.
+ // ponytail: a remap per open; a surface mapped later still covers her.
+ property bool remapping: false
+ visible: !root.remapping
+ Timer { id: remap; interval: 100; onTriggered: root.remapping = false }
+
// Balloons stack bottom-right of their screen. When that is her corner,
// any balloon on screen shoves her left past the stack.
readonly property bool shoved: {