aboutsummaryrefslogtreecommitdiffstats
path: root/desktop/companion
diff options
context:
space:
mode:
Diffstat (limited to 'desktop/companion')
-rw-r--r--desktop/companion/Companion.qml36
-rw-r--r--desktop/companion/README.md4
2 files changed, 21 insertions, 19 deletions
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 <desktop> 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.