aboutsummaryrefslogtreecommitdiffstats
path: root/desktop/Prefs.qml
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-10-23 17:54:25 +0200
committerDanilo M. <danix@danix.xyz>2026-10-23 17:54:25 +0200
commit588d78a19cac279b240588f47c26442d5abf3a12 (patch)
tree844da2fd64710edf34ba5896387184bcda602c2e /desktop/Prefs.qml
parentc3a6fd802117ec6c3c4355d8d2b6016f0cd21778 (diff)
downloadquickshell-588d78a19cac279b240588f47c26442d5abf3a12.tar.gz
quickshell-588d78a19cac279b240588f47c26442d5abf3a12.zip
companion: editable per-app lines in a settings page
Her per-app lines were hardcoded in Lines.js under app:<class>. They now live in Prefs.companionApps once edited and fall back to Lines.js until then, read live by Companion.qml so a save needs no restart. The new Companion phrases page does full CRUD on apps and their phrases, with a draft, SaveBar and Reset to the built-in set, mirroring Ask presets. Companion settings move out of Desktop into their own Companion group.
Diffstat (limited to 'desktop/Prefs.qml')
-rw-r--r--desktop/Prefs.qml19
1 files changed, 18 insertions, 1 deletions
diff --git a/desktop/Prefs.qml b/desktop/Prefs.qml
index 80515a4..f7e841b 100644
--- a/desktop/Prefs.qml
+++ b/desktop/Prefs.qml
@@ -75,6 +75,21 @@ Singleton {
root.write(Object.assign({}, root.doc, { companionBlushFile: p }));
}
+ // The companion's app lines as saved: a map of lowercased window class
+ // to phrases, or null for the defaults in companion/Lines.js. The
+ // Companion phrases page edits it.
+ property var companionApps: null
+ function setCompanionApps(map) {
+ root.companionApps = map;
+ root.write(Object.assign({}, root.doc, { companionApps: map }));
+ }
+ function resetCompanionApps() {
+ root.companionApps = null;
+ const d = Object.assign({}, root.doc);
+ delete d.companionApps;
+ root.write(d);
+ }
+
// The settings window's sidebar width, dragged by its edge.
readonly property int sidebarMin: 160
readonly property int sidebarMax: 420
@@ -137,6 +152,8 @@ Singleton {
const sk = parsed.companionSkirtless;
root.companionSkirtless = Number.isInteger(sk) && sk >= 0 ? sk : 60;
root.companionBlushFile = typeof parsed.companionBlushFile === "string" ? parsed.companionBlushFile : "";
+ const ca = parsed.companionApps;
+ root.companionApps = ca && typeof ca === "object" && !Array.isArray(ca) ? ca : null;
root.ready = true;
}
@@ -152,6 +169,6 @@ Singleton {
onFileChanged: reload()
onLoaded: root.reparse()
// Missing file: the defaults, and nothing written.
- onLoadFailed: { root.doc = {}; root.pinnedIp = ""; root.presets = null; root.settingsSidebar = 200; root.assistantModel = ""; root.companion = true; root.companionBlushFile = ""; root.companionSkirtless = 60; root.ready = true; }
+ onLoadFailed: { root.doc = {}; root.pinnedIp = ""; root.presets = null; root.settingsSidebar = 200; root.assistantModel = ""; root.companion = true; root.companionBlushFile = ""; root.companionSkirtless = 60; root.companionApps = null; root.ready = true; }
}
}