From 8a3c60afbe673fa4061cc8af6accda7368607f77 Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Fri, 23 Oct 2026 15:54:19 +0200 Subject: companion: shown or hidden survives a restart, with a settings switch SUPER+\ only flipped a property, so every restart of the desktop shell brought her back. Whether she is shown is now `companion` in Prefs.qml, set by the IPC and by a switch on a new Settings > Desktop > Companion page. Prefs gains `ready`, so she waits for the file rather than showing at the default and then vanishing; the greeting now plays on every appearance, the one at login included. Co-Authored-By: Claude Opus 5.5 --- desktop/companion/Companion.qml | 36 +++++++++++++++++------------------- desktop/companion/README.md | 4 ++++ 2 files changed, 21 insertions(+), 19 deletions(-) (limited to 'desktop/companion') diff --git a/desktop/companion/Companion.qml b/desktop/companion/Companion.qml index e6d21e2..12dd009 100644 --- a/desktop/companion/Companion.qml +++ b/desktop/companion/Companion.qml @@ -30,8 +30,18 @@ PanelWindow { readonly property string art: Quickshell.env("HOME") + "/.local/share/keystone/companion/2b/frames" - // SUPER+\, through the IPC below. - property bool present: true + // SUPER+\ (the IPC below) and the Companion settings page, through Prefs, + // so it survives a restart. + readonly property bool present: Prefs.ready && Prefs.companion + onPresentChanged: { + if (root.present) { + root.destructAt = 0; // the skirt is back + root.now = Date.now(); + greet.restart(); + } else { + root.stopMonologue(); + } + } // The monitor she is on trails the focused one: a change plays her exit // here first, and only then moves the window (settled, below). @@ -298,20 +308,8 @@ PanelWindow { // --- showing and hiding ---------------------------------------------- - function appear() { - if (root.present) return; - root.present = true; - root.destructAt = 0; // the skirt is back - root.now = Date.now(); - greet.restart(); - } - function dismiss() { - if (!root.present) return; - root.stopMonologue(); - bubble.hide(); - root.present = false; - } - // After the drop-in has landed. + // After the drop-in has landed, on every appearance, the one at login + // included. Timer { id: greet interval: 450 @@ -324,9 +322,9 @@ PanelWindow { // qs -p ipc call companion toggle -> SUPER+\ IpcHandler { target: "companion" - function toggle() { if (root.present) root.dismiss(); else root.appear(); } - function show() { root.appear(); } - function hide() { root.dismiss(); } + function toggle() { Prefs.setCompanion(!Prefs.companion); } + function show() { Prefs.setCompanion(true); } + function hide() { Prefs.setCompanion(false); } } // The exit has played on the old monitor: move, and the entrance plays. diff --git a/desktop/companion/README.md b/desktop/companion/README.md index cfa3ffc..4582b64 100644 --- a/desktop/companion/README.md +++ b/desktop/companion/README.md @@ -18,6 +18,10 @@ The design, with what was measured on the way, is `Figure.qml` is not `Sprite.qml` because QtQuick has a `Sprite` type, and it wins over the directory's own file (see AGENTS.md). +Whether she is shown is `companion` in `Prefs.qml`, so it survives a +restart: SUPER+\ and the switch on Settings > Desktop > Companion +(`desktop/modules/companion/`) both set it. + ## Art Not in the repo: the character is Square Enix's and this repo is GPLv2. -- cgit v1.2.3