aboutsummaryrefslogtreecommitdiffstats
path: root/desktop/companion/Companion.qml
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-10-23 15:54:19 +0200
committerDanilo M. <danix@danix.xyz>2026-10-23 15:54:19 +0200
commit8a3c60afbe673fa4061cc8af6accda7368607f77 (patch)
tree6160fb4bef3d4f3604aa43d018a5912f20240503 /desktop/companion/Companion.qml
parent246aa68e113f35f87ed985f64abb48cf3d76a23c (diff)
downloadquickshell-8a3c60afbe673fa4061cc8af6accda7368607f77.tar.gz
quickshell-8a3c60afbe673fa4061cc8af6accda7368607f77.zip
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 <noreply@anthropic.com>
Diffstat (limited to 'desktop/companion/Companion.qml')
-rw-r--r--desktop/companion/Companion.qml36
1 files changed, 17 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.