From e5399f3e8d8572f1db7c4391a7c571d4845500f1 Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Sat, 17 Oct 2026 10:10:42 +0200 Subject: desktop: centred About, and a resizable settings sidebar The About text sat in the top-left corner of an otherwise empty page; it is now centred both ways in the space beside the sidebar. The sidebar's edge, the rule between it and the page, drags to resize it between 160 and 420px, lit in the accent while hovered. The width lives in Prefs, written once on release rather than on every pixel of the drag, so it survives a restart without a file to edit by hand. Co-Authored-By: Claude Opus 5.5 --- desktop/Prefs.qml | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'desktop/Prefs.qml') diff --git a/desktop/Prefs.qml b/desktop/Prefs.qml index def720c..1cc83cd 100644 --- a/desktop/Prefs.qml +++ b/desktop/Prefs.qml @@ -35,6 +35,11 @@ Singleton { // (assistant/Presets.js, which also validates what is read here). property var presets: null + // The settings window's sidebar width, dragged by its edge. + readonly property int sidebarMin: 160 + readonly property int sidebarMax: 420 + property int settingsSidebar: 200 + // The whole parsed object, so a write keeps keys this version does not // know about. property var doc: ({}) @@ -59,6 +64,14 @@ Singleton { root.write(Object.assign({}, root.doc, { assistant: a })); } + function setSettingsSidebar(w) { + w = Math.round(Math.max(root.sidebarMin, Math.min(root.sidebarMax, w))); + if (w === root.settingsSidebar) return; + root.settingsSidebar = w; + const s = Object.assign({}, root.doc.settings, { sidebar: w }); + root.write(Object.assign({}, root.doc, { settings: s })); + } + function write(out) { root.doc = out; file.setText(JSON.stringify(out, null, 2) + "\n"); @@ -75,6 +88,9 @@ Singleton { if (pin !== root.pinnedIp) root.pinnedIp = pin; root.presets = parsed.assistant && parsed.assistant.presets !== undefined ? parsed.assistant.presets : null; + const w = parsed.settings ? parsed.settings.sidebar : undefined; + root.settingsSidebar = typeof w === "number" && w >= root.sidebarMin && w <= root.sidebarMax + ? Math.round(w) : 200; } FileView { @@ -89,6 +105,6 @@ Singleton { onFileChanged: reload() onLoaded: root.reparse() // Missing file: the defaults, and nothing written. - onLoadFailed: { root.doc = {}; root.pinnedIp = ""; root.presets = null; } + onLoadFailed: { root.doc = {}; root.pinnedIp = ""; root.presets = null; root.settingsSidebar = 200; } } } -- cgit v1.2.3