aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-12-04 11:32:58 +0100
committerDanilo M. <danix@danix.xyz>2026-12-04 11:32:58 +0100
commitfeda206462824b52adad1fff83b04599c3076509 (patch)
tree6880209e972f6e5298b5ec993ddf2bbd9a6310d0
parent2830b2c1dd5ebe8ebcb5a48816479eff0b0950f6 (diff)
downloadquickshell-feda206462824b52adad1fff83b04599c3076509.tar.gz
quickshell-feda206462824b52adad1fff83b04599c3076509.zip
feat(assistant): title bar with face, chat title, enlarge and close
A row above the chat header: the assistant's face, the chat's title from the daemon ("Desktop Assistant" until it has one), and enlarge and close. Enlarged, the tall card fills the screen but a margin, for the session. Avatar moves out of Message.qml to be shared. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
-rw-r--r--desktop/assistant/Assistant.qml14
-rw-r--r--desktop/assistant/Avatar.qml39
-rw-r--r--desktop/assistant/Card.qml44
-rw-r--r--desktop/assistant/Message.qml25
-rw-r--r--desktop/assistant/README.md1
5 files changed, 95 insertions, 28 deletions
diff --git a/desktop/assistant/Assistant.qml b/desktop/assistant/Assistant.qml
index 7d299eb..aaf5328 100644
--- a/desktop/assistant/Assistant.qml
+++ b/desktop/assistant/Assistant.qml
@@ -81,6 +81,9 @@ Scope {
property int ctxUsed: 0
property int ctxMax: 0
property var convId: null
+ // The chat's title in the card's title bar: the daemon's (hello,
+ // conversation, then title once the model names it), "" for none.
+ property string title: ""
property string notice: "" // an error with no turn to hang it on
property string runningTool: ""
property var convs: []
@@ -112,7 +115,11 @@ Scope {
// The tall card (a chat, or a panel) is fullHeight and centred, so its
// top only moves on entering or leaving tall.
readonly property bool tall: root.mode === "chat" || root.historyOpen || root.pickerOpen || root.modelsOpen
- readonly property int fullHeight: Math.round(root.screenObj.height * 0.7)
+ // Enlarged (the header's expand button): the tall card fills the
+ // screen but a margin. ponytail: per session, not saved in Prefs.
+ property bool big: false
+ readonly property int fullHeight: root.big ? root.screenObj.height - 48
+ : Math.round(root.screenObj.height * 0.7)
function toggle() { if (root.open) root.close(); else root.show(); }
@@ -430,6 +437,7 @@ print(json.dumps({"bg": os.path.expanduser(a.get("background") or ""),
root.runningTool = e.state === "tool" ? e.tool : "";
root.model = e.model ?? "";
root.chatModel = e.chat_model ?? "";
+ root.title = e.title ?? "";
if (e.out_dir) root.outDir = e.out_dir;
root.ctxUsed = e.ctx_used;
root.ctxMax = e.ctx_max;
@@ -442,6 +450,7 @@ print(json.dumps({"bg": os.path.expanduser(a.get("background") or ""),
case "conversation":
root.load(e.id, e.turns, null);
root.chatModel = e.model ?? "";
+ root.title = e.title ?? "";
// Opened from History on purpose: it counts as active now.
if (e.turns.length) root.lastActive = Date.now();
// Emptied (New, or the current one deleted) with nothing staged:
@@ -501,6 +510,7 @@ print(json.dumps({"bg": os.path.expanduser(a.get("background") or ""),
break;
// ctx carries the model since the router can swap it after hello; an
// older daemon leaves it out, and the hello's name stands.
+ case "title": if (e.id === root.convId) root.title = e.title; break;
case "ctx": root.ctxUsed = e.used; root.ctxMax = e.max; if (e.model) root.model = e.model; break;
case "conversations": root.convs = e.items; break;
case "results": root.results = e.items; break;
@@ -573,7 +583,7 @@ print(json.dumps({"bg": os.path.expanduser(a.get("background") or ""),
Card {
anchors.centerIn: parent
- width: Math.min(760, parent.width - 48)
+ width: root.big && root.tall ? parent.width - 48 : Math.min(760, parent.width - 48)
fullHeight: root.fullHeight
canvas: root
turnModel: turns
diff --git a/desktop/assistant/Avatar.qml b/desktop/assistant/Avatar.qml
new file mode 100644
index 0000000..ae4bc7a
--- /dev/null
+++ b/desktop/assistant/Avatar.qml
@@ -0,0 +1,39 @@
+// Copyright (C) 2026 Danilo M. <danix@danix.xyz>
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License version 2 as
+// published by the Free Software Foundation.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+
+import Quickshell.Widgets
+import QtQuick
+import ".."
+
+// A round avatar: a picture filling it, or with crop ([centre x, centre
+// y, size] in the picture's pixels) that square of it. No picture: a plain
+// circle. Message's turns and Card's title bar.
+ClippingRectangle {
+ id: a
+ property string source: ""
+ property var crop: []
+ width: 32
+ height: width
+ radius: width / 2
+ color: Theme.surfaceAlt
+ Image {
+ readonly property real k: a.crop.length ? a.width / a.crop[2] : 0
+ source: a.source
+ visible: status === Image.Ready
+ mipmap: true
+ fillMode: a.crop.length ? Image.Stretch : Image.PreserveAspectCrop
+ width: a.crop.length ? implicitWidth * k : a.width
+ height: a.crop.length ? implicitHeight * k : a.height
+ x: a.crop.length ? -(a.crop[0] - a.crop[2] / 2) * k : 0
+ y: a.crop.length ? -(a.crop[1] - a.crop[2] / 2) * k : 0
+ }
+}
diff --git a/desktop/assistant/Card.qml b/desktop/assistant/Card.qml
index f4e1af1..15819c6 100644
--- a/desktop/assistant/Card.qml
+++ b/desktop/assistant/Card.qml
@@ -40,6 +40,7 @@ Rectangle {
+ (status.visible ? status.height + 10 : 0)
+ (actions.visible ? actions.height + 10 : 0)
Behavior on height { NumberAnimation { duration: 180; easing.type: Easing.OutCubic } }
+ Behavior on width { NumberAnimation { duration: 180; easing.type: Easing.OutCubic } }
clip: true
color: Qt.alpha(Theme.base, 0.82)
@@ -161,12 +162,53 @@ Rectangle {
function onChattingChanged() { input.forceActiveFocus(); }
}
+ // --- title bar (chat): the face, the chat's title, enlarge and close ---
+
+ Item {
+ id: titleBar
+ visible: card.mode === "chat"
+ anchors { top: parent.top; left: parent.left; right: parent.right; margins: 14 }
+ height: 28
+
+ Avatar {
+ anchors { left: parent.left; verticalCenter: parent.verticalCenter }
+ width: 28
+ source: card.canvas.face.length ? card.canvas.fileUrl(card.canvas.backdrop) : ""
+ crop: card.canvas.face
+ }
+ Text {
+ anchors.centerIn: parent
+ width: Math.min(implicitWidth, parent.width - 2 * (winBtns.width + 12))
+ elide: Text.ElideRight
+ text: card.canvas.title || "Desktop Assistant"
+ color: Theme.subtext
+ font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 2; bold: true }
+ }
+ // nf-fa-compress / nf-fa-expand and nf-fa-xmark, as Keystone's
+ // titlebar.
+ Row {
+ id: winBtns
+ anchors { right: parent.right; verticalCenter: parent.verticalCenter }
+ spacing: 6
+ WindowButton {
+ icon: card.canvas.big ? "\uf066" : "\uf065"
+ onClicked: card.canvas.big = !card.canvas.big
+ }
+ WindowButton {
+ icon: "\uf00d"
+ danger: true
+ onClicked: card.canvas.close()
+ }
+ }
+ }
+
// --- header (chat) ---
Item {
id: header
visible: card.mode === "chat"
- anchors { top: parent.top; left: parent.left; right: parent.right; margins: 14 }
+ anchors { top: titleBar.bottom; left: parent.left; right: parent.right
+ topMargin: 8; leftMargin: 14; rightMargin: 14 }
height: 32
// The chat's model, a click opens the model panel. nf-fa-cloud for a
diff --git a/desktop/assistant/Message.qml b/desktop/assistant/Message.qml
index c2e1b13..cc0537c 100644
--- a/desktop/assistant/Message.qml
+++ b/desktop/assistant/Message.qml
@@ -9,7 +9,6 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
-import Quickshell.Widgets
import QtQuick
import ".."
@@ -230,28 +229,4 @@ Column {
// Unformatted twins of the texts, for the bubbles' widths.
Text { id: qProbe; visible: false; text: msg.user; textFormat: Text.PlainText; font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 2 } }
Text { id: rProbe; visible: false; text: msg.reply; textFormat: Text.PlainText; font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 2 } }
-
- // A round avatar: a picture filling it, or with crop ([centre x, centre
- // y, size] in the picture's pixels) that square of it. No picture: a
- // plain circle.
- component Avatar: ClippingRectangle {
- id: a
- property string source: ""
- property var crop: []
- width: msg.av
- height: msg.av
- radius: msg.av / 2
- color: Theme.surfaceAlt
- Image {
- readonly property real k: a.crop.length ? a.width / a.crop[2] : 0
- source: a.source
- visible: status === Image.Ready
- mipmap: true
- fillMode: a.crop.length ? Image.Stretch : Image.PreserveAspectCrop
- width: a.crop.length ? implicitWidth * k : a.width
- height: a.crop.length ? implicitHeight * k : a.height
- x: a.crop.length ? -(a.crop[0] - a.crop[2] / 2) * k : 0
- y: a.crop.length ? -(a.crop[1] - a.crop[2] / 2) * k : 0
- }
- }
}
diff --git a/desktop/assistant/README.md b/desktop/assistant/README.md
index a76e9c7..84e7a5e 100644
--- a/desktop/assistant/README.md
+++ b/desktop/assistant/README.md
@@ -22,6 +22,7 @@ to answer in.
| `Assistant.qml` | the socket, the turn model, the window |
| `Card.qml` | header, transcript, input, the history panel's place |
| `Message.qml` | one turn: question, thinking line, tool chips, reply |
+| `Avatar.qml` | a round picture, or a crop of one: the faces in turns and the title bar |
| `Segments.qml` | markdown with a copy button per code block |
| `History.qml` | conversation list and full-text search |
| `Picker.qml` | the in-card file picker behind the paperclip |