topside-arch 0.0.0-stage → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +217 -2
- package/contrib/aur/.SRCINFO +20 -0
- package/contrib/aur/PKGBUILD +35 -0
- package/contrib/aur/topside-arch.install +28 -0
- package/contrib/icons/hicolor/scalable/apps/topside.svg +28 -0
- package/contrib/systemd/topside.service +10 -0
- package/contrib/themes/sakura.json +31 -0
- package/dist/adapters/claude/attach.js +92 -0
- package/dist/adapters/claude/hook-event.js +173 -0
- package/dist/adapters/claude/one-shot.js +30 -0
- package/dist/adapters/claude/settings.js +78 -0
- package/dist/adapters/claude/usage.js +76 -0
- package/dist/adapters/codex/codex.js +73 -0
- package/dist/adapters/codex/patch.js +39 -0
- package/dist/adapters/codex/usage.js +77 -0
- package/dist/adapters/pi/extension.js +271 -0
- package/dist/adapters/pi/risk-gate.js +256 -0
- package/dist/cli/commands.js +615 -0
- package/dist/cli/hook-log.js +32 -0
- package/dist/cli/main.js +100 -0
- package/dist/daemon/preview.js +70 -0
- package/dist/daemon/processes.js +105 -0
- package/dist/daemon/server.js +437 -0
- package/dist/daemon/session-state.js +179 -0
- package/dist/daemon/store.js +176 -0
- package/dist/dms/setup.js +137 -0
- package/dist/hosts/hosts.js +39 -0
- package/dist/jump/jump.js +199 -0
- package/dist/pill/config.js +92 -0
- package/dist/pill/launch.js +38 -0
- package/dist/sekaipop/setup.js +267 -0
- package/dist/service/unit.js +77 -0
- package/dist/shared/ancestry.js +27 -0
- package/dist/shared/client.js +29 -0
- package/dist/shared/package.js +25 -0
- package/dist/shared/paths.js +69 -0
- package/dist/shared/protocol.js +35 -0
- package/dist/shared/qml-lib.js +33 -0
- package/dist/shared/result.js +6 -0
- package/dist/shared/terminal.js +42 -0
- package/dist/themes/themes.js +84 -0
- package/package.json +49 -4
- package/shell/core/AgentIcon.qml +24 -0
- package/shell/core/AppLogo.qml +48 -0
- package/shell/core/ApprovalRow.qml +197 -0
- package/shell/core/BoardDetail.qml +336 -0
- package/shell/core/BoardList.qml +419 -0
- package/shell/core/BoardNotice.qml +189 -0
- package/shell/core/CardButton.qml +55 -0
- package/shell/core/CardHeader.qml +46 -0
- package/shell/core/ChalkBoard.qml +99 -0
- package/shell/core/CompletionCard.qml +106 -0
- package/shell/core/FlapText.qml +110 -0
- package/shell/core/KeyCap.qml +72 -0
- package/shell/core/Mascot.qml +13 -0
- package/shell/core/MascotBadge.qml +40 -0
- package/shell/core/MascotEffect.qml +40 -0
- package/shell/core/Paper.qml +54 -0
- package/shell/core/PixelGrid.qml +40 -0
- package/shell/core/QuestionRow.qml +161 -0
- package/shell/core/SessionRow.qml +257 -0
- package/shell/core/Stamp.qml +62 -0
- package/shell/core/StatusDots.qml +33 -0
- package/shell/core/Surface.qml +32 -0
- package/shell/core/Tag.qml +22 -0
- package/shell/core/TerminalIcon.qml +34 -0
- package/shell/core/Theme.qml +100 -0
- package/shell/core/TicketDetail.qml +657 -0
- package/shell/core/TicketList.qml +717 -0
- package/shell/core/TicketNotice.qml +198 -0
- package/shell/core/TopsideClient.qml +201 -0
- package/shell/core/UsageLine.qml +106 -0
- package/shell/core/agents.js +79 -0
- package/shell/core/board.js +132 -0
- package/shell/core/hiding.js +68 -0
- package/shell/core/pixels.js +542 -0
- package/shell/core/qmldir +30 -0
- package/shell/core/sounds.js +31 -0
- package/shell/core/themes.js +195 -0
- package/shell/core/ticket.js +170 -0
- package/shell/dms-plugin/TopsideSettings.qml +696 -0
- package/shell/dms-plugin/TopsideWidget.qml +554 -0
- package/shell/dms-plugin/plugin.json +14 -0
- package/shell/pill.qml +279 -0
- package/shell/sekaipop-plugin/Bar.qml +150 -0
- package/shell/sekaipop-plugin/Card.qml +296 -0
- package/shell/sekaipop-plugin/Floating.qml +74 -0
- package/shell/sekaipop-plugin/ListWindow.qml +156 -0
- package/shell/sekaipop-plugin/Popup.qml +70 -0
- package/shell/sekaipop-plugin/Service.qml +418 -0
- package/shell/sekaipop-plugin/ShellLook.qml +43 -0
- package/shell/sekaipop-plugin/StyledCard.qml +194 -0
- package/shell/sekaipop-plugin/place.js +28 -0
- package/shell/sekaipop-plugin/plugin.json +109 -0
|
@@ -0,0 +1,554 @@
|
|
|
1
|
+
import QtQuick
|
|
2
|
+
import QtQuick.Layouts
|
|
3
|
+
import Quickshell.Io
|
|
4
|
+
import Quickshell.Wayland
|
|
5
|
+
import qs.Common
|
|
6
|
+
import qs.Services
|
|
7
|
+
import qs.DCommon.Widgets
|
|
8
|
+
import qs.Modules.Plugins
|
|
9
|
+
import "core" as Topside
|
|
10
|
+
import "core/sounds.js" as Sounds
|
|
11
|
+
import "core/hiding.js" as Hiding
|
|
12
|
+
|
|
13
|
+
// Topside's bar widget for DankMaterialShell. `topside setup` copies this folder
|
|
14
|
+
// plus shell/core into ~/.config/dms/plugins/topside. The pill shows the newest
|
|
15
|
+
// session's mascot, then one dot per session; the popout lists sessions and
|
|
16
|
+
// pending approvals.
|
|
17
|
+
// TopsideSettings.qml holds the settings; DMS hands them over as pluginData.
|
|
18
|
+
PluginComponent {
|
|
19
|
+
id: root
|
|
20
|
+
|
|
21
|
+
layerNamespacePlugin: "topside"
|
|
22
|
+
|
|
23
|
+
readonly property bool autoOpen: pluginData.autoOpen ?? true
|
|
24
|
+
readonly property int maxDots: Math.max(1, Math.min(7, pluginData.maxDots ?? 5)) // TopsideSettings allows 1–7
|
|
25
|
+
readonly property int waitingCount: client.approvals.length + client.questions.length
|
|
26
|
+
// Notifications, as on the Mac: sounds off and reminders on by default.
|
|
27
|
+
readonly property bool sounds: pluginData.sounds ?? false
|
|
28
|
+
readonly property string attentionSound: Sounds.known(pluginData.attentionSound ?? "", "attention")
|
|
29
|
+
readonly property string completionSound: Sounds.known(pluginData.completionSound ?? "", "completion")
|
|
30
|
+
readonly property bool reminders: pluginData.reminders ?? true
|
|
31
|
+
readonly property int reminderMinutes: Math.max(1, Math.min(10, pluginData.reminderMinutes ?? 2))
|
|
32
|
+
readonly property string summary: !client.connected ? "daemon offline"
|
|
33
|
+
: waitingCount > 0 ? waitingCount + " waiting for you"
|
|
34
|
+
: client.sessions.length === 0 ? "no sessions"
|
|
35
|
+
: client.sessions.length + (client.sessions.length === 1 ? " session" : " sessions")
|
|
36
|
+
|
|
37
|
+
// A completion card: the session whose turn just ended, shown alone in the
|
|
38
|
+
// popout for 5 s (longer while the pointer rests on it). "" for none.
|
|
39
|
+
property string finishedId: ""
|
|
40
|
+
property bool cardHovered: false
|
|
41
|
+
readonly property var finishedSession: finishedId === "" ? null : sessionFor(finishedId)
|
|
42
|
+
readonly property bool showCompletion: finishedSession !== null && finishedSession.status === "done" && waitingCount === 0
|
|
43
|
+
|
|
44
|
+
// Each monitor's bar has its own copy of the widget. Only the one on the
|
|
45
|
+
// focused monitor opens by itself, so a card lands where the user is.
|
|
46
|
+
readonly property bool onFocusedScreen: {
|
|
47
|
+
const focused = CompositorService.getFocusedScreenName();
|
|
48
|
+
return !focused || !root.parentScreen || root.parentScreen.name === focused;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// triggerPopout toggles, so only call it while the popout is closed.
|
|
52
|
+
function openPopout() {
|
|
53
|
+
if (!root.interactionActive && root.onFocusedScreen) root.triggerPopout();
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
onInteractionActiveChanged: if (!interactionActive) {
|
|
57
|
+
finishedId = "";
|
|
58
|
+
showAll = false;
|
|
59
|
+
hideAsk = null;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// "Sessions shown": the list draws that many rows, plus every waiting
|
|
63
|
+
// session, then one "+ N more" line that opens the rest until it closes.
|
|
64
|
+
property bool showAll: false
|
|
65
|
+
readonly property var listed: showAll ? client.sessions
|
|
66
|
+
: client.sessions.filter((s, i) => i < maxDots || s.status === "waiting")
|
|
67
|
+
readonly property int hidden: client.sessions.length - listed.length
|
|
68
|
+
|
|
69
|
+
Timer {
|
|
70
|
+
id: cardTimer
|
|
71
|
+
interval: 5000
|
|
72
|
+
onTriggered: {
|
|
73
|
+
if (root.cardHovered) {
|
|
74
|
+
restart();
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
if (root.showCompletion) root.closePopout();
|
|
78
|
+
root.finishedId = "";
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// Sounds play through the freedesktop sound theme. Every monitor's bar has
|
|
83
|
+
// a copy of this widget; only the one on the focused monitor plays.
|
|
84
|
+
Process {
|
|
85
|
+
id: player
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
function play(name) {
|
|
89
|
+
if (!root.sounds || !root.onFocusedScreen) return;
|
|
90
|
+
player.command = ["canberra-gtk-play", "-i", name];
|
|
91
|
+
player.running = true;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// One reminder per request or question still pending after the wait:
|
|
95
|
+
// the bar's mascot turns red with a blinking "!" for 4 s, the attention
|
|
96
|
+
// sound plays, and the popout opens again if cards open by themselves.
|
|
97
|
+
// Skipped, for good, when the session's terminal has the focus or the
|
|
98
|
+
// popout is already open.
|
|
99
|
+
property var reminded: ({})
|
|
100
|
+
property string remindingSession: ""
|
|
101
|
+
|
|
102
|
+
Timer {
|
|
103
|
+
interval: 15000
|
|
104
|
+
repeat: true
|
|
105
|
+
running: root.reminders && root.waitingCount > 0
|
|
106
|
+
onTriggered: root.checkReminders()
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
Timer {
|
|
110
|
+
id: reminderEnd
|
|
111
|
+
interval: 4000
|
|
112
|
+
onTriggered: root.remindingSession = ""
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
Process {
|
|
116
|
+
id: frontCheck
|
|
117
|
+
property string sessionId: ""
|
|
118
|
+
stdout: StdioCollector {
|
|
119
|
+
onStreamFinished: {
|
|
120
|
+
if (text.trim() === "no") root.remind(frontCheck.sessionId);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
function checkReminders() {
|
|
126
|
+
const pending = client.approvals.concat(client.questions);
|
|
127
|
+
const kept = {};
|
|
128
|
+
for (const request of pending) if (root.reminded[request.id]) kept[request.id] = true;
|
|
129
|
+
const now = Date.now();
|
|
130
|
+
const due = pending.find(r => !kept[r.id] && now - r.createdAt >= root.reminderMinutes * 60000);
|
|
131
|
+
if (due) kept[due.id] = true;
|
|
132
|
+
root.reminded = kept;
|
|
133
|
+
if (!due || root.interactionActive || frontCheck.running) return;
|
|
134
|
+
frontCheck.sessionId = due.sessionId;
|
|
135
|
+
frontCheck.command = client.cli.concat(["front", due.sessionId]);
|
|
136
|
+
frontCheck.running = true;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
function remind(sessionId) {
|
|
140
|
+
root.remindingSession = sessionId;
|
|
141
|
+
reminderEnd.restart();
|
|
142
|
+
root.play(root.attentionSound);
|
|
143
|
+
if (root.autoOpen) root.openPopout();
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
// Hiding (VIA-PARITY §18): folders and prompts the user hid, newest
|
|
147
|
+
// first, kept in DMS's plugin settings. The client leaves their sessions
|
|
148
|
+
// out, with their requests, dots, cards, sounds and reminders.
|
|
149
|
+
readonly property var hiddenFolders: Array.isArray(pluginData.hiddenFolders) ? pluginData.hiddenFolders : []
|
|
150
|
+
readonly property var hiddenPrompts: Array.isArray(pluginData.hiddenPrompts) ? pluginData.hiddenPrompts : []
|
|
151
|
+
Binding { target: client; property: "hiddenFolders"; value: root.hiddenFolders }
|
|
152
|
+
Binding { target: client; property: "hiddenPrompts"; value: root.hiddenPrompts }
|
|
153
|
+
|
|
154
|
+
// Hiding asks first (VIA-PARITY §29): a hide asked from a row, not yet
|
|
155
|
+
// confirmed, { folder, text, sessionId }. It recounts on every snapshot
|
|
156
|
+
// and goes with its session, Keep, or the popout closing. There's no
|
|
157
|
+
// Undo: Settings lists every entry with a ✕.
|
|
158
|
+
property var hideAsk: null
|
|
159
|
+
readonly property var hideRule: hideAsk ? Hiding.question(hideAsk, hideAsk.sessionId, root.listed) : null
|
|
160
|
+
|
|
161
|
+
function hide(key, entry) {
|
|
162
|
+
if (entry === "") return;
|
|
163
|
+
const list = key === "hiddenFolders" ? root.hiddenFolders : root.hiddenPrompts;
|
|
164
|
+
PluginService.savePluginData("topside", key, Hiding.added(list, entry));
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
// The row under the pointer, for ⌃J.
|
|
168
|
+
property string hoveredSession: ""
|
|
169
|
+
// Whose plan the header shows: the row under the pointer, else the open
|
|
170
|
+
// card's session, else the newest session (VIA-PARITY §7).
|
|
171
|
+
readonly property string usageSession: root.hoveredSession || (root.showCompletion ? root.finishedId : "") || (client.sessions[0] ? client.sessions[0].id : "")
|
|
172
|
+
readonly property string usageAgent: {
|
|
173
|
+
const session = client.sessions.find(s => s.id === root.usageSession);
|
|
174
|
+
return session ? session.agent : "claude";
|
|
175
|
+
}
|
|
176
|
+
// The popout window, once its content exists; keyboard() points it.
|
|
177
|
+
property var popoutWindow: null
|
|
178
|
+
|
|
179
|
+
// The popout takes keys only while the pointer is on it, as on the Mac,
|
|
180
|
+
// so a card that opens by itself never eats what you type in the
|
|
181
|
+
// terminal. null is DMS's own choice (on demand, with Hyprland's grab).
|
|
182
|
+
function keyboard(take) {
|
|
183
|
+
if (root.popoutWindow) root.popoutWindow.customKeyboardFocus = take ? null : WlrKeyboardFocus.None;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
// A jump gives the keyboard back first, so the first keystrokes land in
|
|
187
|
+
// the terminal rather than the island.
|
|
188
|
+
function jumpTo(sessionId) {
|
|
189
|
+
root.keyboard(false);
|
|
190
|
+
client.jump(sessionId);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
// ⌃Y ⌃N ⌃A answer the first request card, ⌃1…⌃9 pick an option of the
|
|
194
|
+
// first question, ⌃J jumps: the open card's session, else the row under
|
|
195
|
+
// the pointer, else the newest. esc is DMS's: it closes the popout and
|
|
196
|
+
// never answers anything.
|
|
197
|
+
function handleKey(event, questionCard) {
|
|
198
|
+
if (!(event.modifiers & Qt.ControlModifier)) return false;
|
|
199
|
+
const approval = client.questions.length === 0 ? client.approvals[0] : null;
|
|
200
|
+
if (approval && event.key === Qt.Key_Y) client.decide(approval.id, "allow");
|
|
201
|
+
else if (approval && event.key === Qt.Key_N) client.decide(approval.id, "deny");
|
|
202
|
+
else if (approval && event.key === Qt.Key_A && approval.always) client.decide(approval.id, "always");
|
|
203
|
+
else if (questionCard && event.key >= Qt.Key_1 && event.key <= Qt.Key_9) {
|
|
204
|
+
const options = client.questions[0].questions[0].options;
|
|
205
|
+
const option = options[event.key - Qt.Key_1];
|
|
206
|
+
if (!option) return false;
|
|
207
|
+
questionCard.pick(0, option.label);
|
|
208
|
+
} else if (event.key === Qt.Key_J) {
|
|
209
|
+
const target = root.showCompletion ? root.finishedId
|
|
210
|
+
: client.questions.length > 0 ? client.questions[0].sessionId
|
|
211
|
+
: approval ? approval.sessionId
|
|
212
|
+
: root.hoveredSession || (client.sessions[0] ? client.sessions[0].id : "");
|
|
213
|
+
if (target === "") return false;
|
|
214
|
+
root.jumpTo(target);
|
|
215
|
+
} else return false;
|
|
216
|
+
return true;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
function sessionFor(sessionId) {
|
|
220
|
+
return client.sessions.find(s => s.id === sessionId) || null;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
Topside.TopsideClient {
|
|
224
|
+
id: client
|
|
225
|
+
// Only a new request opens the popout, so closing it sticks until the
|
|
226
|
+
// next one or the reminder.
|
|
227
|
+
onRequested: if (root.autoOpen) root.openPopout()
|
|
228
|
+
// A pending request wins over a completion card; an open list isn't taken over.
|
|
229
|
+
onFinished: session => {
|
|
230
|
+
if (!root.autoOpen || root.waitingCount > 0 || root.interactionActive || !root.onFocusedScreen) return;
|
|
231
|
+
root.finishedId = session.id;
|
|
232
|
+
root.openPopout();
|
|
233
|
+
cardTimer.restart();
|
|
234
|
+
}
|
|
235
|
+
onJumped: root.closePopout()
|
|
236
|
+
onCue: name => root.play(name === "attention" ? root.attentionSound : root.completionSound)
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
// Quit and start, as the Mac's power button: here Topside is the daemon,
|
|
240
|
+
// so quitting stops it. The bar then shows three red dots, and the popout
|
|
241
|
+
// offers to start it again. Claude Code carries on; its hooks just stay quiet.
|
|
242
|
+
Process {
|
|
243
|
+
id: daemonControl
|
|
244
|
+
property string action: "stop"
|
|
245
|
+
command: ["systemctl", "--user", action, "topside"]
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
function controlDaemon(action) {
|
|
249
|
+
daemonControl.action = action;
|
|
250
|
+
daemonControl.running = true;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
// Written by `topside setup`: how to run Topside, since DMS's PATH may not have it.
|
|
254
|
+
FileView {
|
|
255
|
+
path: Qt.resolvedUrl("cli.json").toString().replace(/^file:\/\//, "")
|
|
256
|
+
printErrors: false
|
|
257
|
+
onLoaded: client.cli = client.parseCli(text())
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
// The shared rows draw with Topside.Theme. The theme, the mode and the text
|
|
261
|
+
// size come from the settings page; "System" follows DMS's light or dark mode.
|
|
262
|
+
Binding { target: Topside.Theme; property: "name"; value: root.pluginData.theme ?? "topsideBlack" }
|
|
263
|
+
Binding { target: Topside.Theme; property: "mode"; value: root.pluginData.appearance ?? "dark" }
|
|
264
|
+
Binding { target: Topside.Theme; property: "content"; value: Math.max(10, Math.min(14, root.pluginData.fontSize ?? 11)) }
|
|
265
|
+
Binding { target: Topside.Theme; property: "systemDark"; value: !Theme.isLightMode }
|
|
266
|
+
|
|
267
|
+
horizontalBarPill: Component {
|
|
268
|
+
Row {
|
|
269
|
+
spacing: Theme.spacingXS
|
|
270
|
+
|
|
271
|
+
// The newest session's mascot. With no session, Topside's own sign:
|
|
272
|
+
// the three status dots side by side, red while the daemon is offline.
|
|
273
|
+
Topside.MascotBadge {
|
|
274
|
+
// A reminder shows its own session's mascot, red, with a blinking "!".
|
|
275
|
+
readonly property var shown: root.remindingSession !== "" ? root.sessionFor(root.remindingSession) : client.sessions[0]
|
|
276
|
+
visible: client.connected && client.sessions.length > 0
|
|
277
|
+
agent: visible && shown ? shown.agent : "claude"
|
|
278
|
+
status: !visible || !shown ? "idle" : root.remindingSession !== "" ? "reminder" : shown.status
|
|
279
|
+
cell: root.iconSize / 6
|
|
280
|
+
anchors.verticalCenter: parent.verticalCenter
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
Topside.StatusDots {
|
|
284
|
+
visible: !client.connected || client.sessions.length === 0
|
|
285
|
+
offline: !client.connected
|
|
286
|
+
size: Math.round(root.iconSize * 0.32)
|
|
287
|
+
anchors.verticalCenter: parent.verticalCenter
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
Repeater {
|
|
291
|
+
model: client.sessions.slice(0, root.maxDots)
|
|
292
|
+
delegate: Rectangle {
|
|
293
|
+
required property var modelData
|
|
294
|
+
width: Math.round(root.iconSize * 0.4)
|
|
295
|
+
height: width
|
|
296
|
+
radius: width / 2
|
|
297
|
+
color: Topside.Theme.statusColor(modelData.status)
|
|
298
|
+
anchors.verticalCenter: parent.verticalCenter
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
StyledText {
|
|
303
|
+
visible: root.waitingCount > 0
|
|
304
|
+
text: root.waitingCount
|
|
305
|
+
color: Topside.Theme.waiting
|
|
306
|
+
font.pixelSize: root.textSize
|
|
307
|
+
font.weight: Theme.fontWeightMedium
|
|
308
|
+
anchors.verticalCenter: parent.verticalCenter
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
verticalBarPill: horizontalBarPill
|
|
314
|
+
|
|
315
|
+
// DMS sizes the popout from the content's implicitHeight once it loads.
|
|
316
|
+
popoutWidth: 440
|
|
317
|
+
popoutContent: Component {
|
|
318
|
+
// Drawn in Topside's theme rather than DMS's: a panel that covers the
|
|
319
|
+
// popout's own surface, then the logotype header and the lists.
|
|
320
|
+
Item {
|
|
321
|
+
id: panel
|
|
322
|
+
property var closePopout: null
|
|
323
|
+
property var parentPopout: null
|
|
324
|
+
|
|
325
|
+
width: parent ? parent.width : root.popoutWidth
|
|
326
|
+
implicitHeight: body.implicitHeight
|
|
327
|
+
|
|
328
|
+
// Keys only while the pointer is on the popout (root.keyboard).
|
|
329
|
+
onParentPopoutChanged: {
|
|
330
|
+
root.popoutWindow = parentPopout;
|
|
331
|
+
root.keyboard(panelHover.hovered);
|
|
332
|
+
}
|
|
333
|
+
HoverHandler {
|
|
334
|
+
id: panelHover
|
|
335
|
+
onHoveredChanged: {
|
|
336
|
+
root.keyboard(hovered);
|
|
337
|
+
if (hovered) panel.forceActiveFocus();
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
Keys.onPressed: event => event.accepted = root.handleKey(event, questionCards.count > 0 ? questionCards.itemAt(0) : null)
|
|
341
|
+
|
|
342
|
+
Rectangle {
|
|
343
|
+
x: -PopoutMetrics.contentPadding
|
|
344
|
+
y: -PopoutMetrics.contentPadding
|
|
345
|
+
width: parent.width + 2 * PopoutMetrics.contentPadding
|
|
346
|
+
height: parent.height + 2 * PopoutMetrics.contentPadding
|
|
347
|
+
radius: Theme.windowRadius
|
|
348
|
+
color: Topside.Theme.bg
|
|
349
|
+
border.color: Topside.Theme.stroke
|
|
350
|
+
border.width: 1
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
ColumnLayout {
|
|
354
|
+
id: body
|
|
355
|
+
width: parent.width
|
|
356
|
+
spacing: 10
|
|
357
|
+
|
|
358
|
+
RowLayout {
|
|
359
|
+
spacing: 10
|
|
360
|
+
Layout.fillWidth: true
|
|
361
|
+
|
|
362
|
+
Topside.AppLogo {
|
|
363
|
+
cell: 2
|
|
364
|
+
color: Topside.Theme.fg
|
|
365
|
+
Layout.alignment: Qt.AlignVCenter
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
// Plan usage while nothing waits and the agent has reported it
|
|
369
|
+
// (Claude Code: `topside usage install`; Codex: its hooks); the summary otherwise.
|
|
370
|
+
Item { Layout.fillWidth: true; visible: usageLine.visible }
|
|
371
|
+
|
|
372
|
+
Topside.UsageLine {
|
|
373
|
+
id: usageLine
|
|
374
|
+
usage: client.usage[root.usageAgent] || null
|
|
375
|
+
// pi and omp: what the session has cost, in place of plan windows.
|
|
376
|
+
spend: client.spend[root.usageSession] || null
|
|
377
|
+
agent: root.usageAgent
|
|
378
|
+
visible: root.waitingCount === 0 && !empty
|
|
379
|
+
Layout.alignment: Qt.AlignVCenter
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
Text {
|
|
383
|
+
visible: !usageLine.visible
|
|
384
|
+
text: root.summary
|
|
385
|
+
color: root.waitingCount > 0 ? Topside.Theme.waiting : Topside.Theme.fgDim
|
|
386
|
+
font.pixelSize: Topside.Theme.content
|
|
387
|
+
elide: Text.ElideRight
|
|
388
|
+
horizontalAlignment: Text.AlignRight
|
|
389
|
+
Layout.fillWidth: true
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
// Flips Sounds, as the speaker on the Mac's header does.
|
|
393
|
+
DActionButton {
|
|
394
|
+
iconName: root.sounds ? "volume_up" : "volume_off"
|
|
395
|
+
iconColor: Topside.Theme.fgDim
|
|
396
|
+
tooltipText: root.sounds ? "Sounds on" : "Sounds off"
|
|
397
|
+
onClicked: PluginService.savePluginData("topside", "sounds", !root.sounds)
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
DActionButton {
|
|
401
|
+
iconName: "settings"
|
|
402
|
+
iconColor: Topside.Theme.fgDim
|
|
403
|
+
tooltipText: "Topside settings"
|
|
404
|
+
onClicked: {
|
|
405
|
+
root.closePopout();
|
|
406
|
+
PopoutService.openSettingsWithTab("plugin:topside");
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
DActionButton {
|
|
411
|
+
visible: client.connected
|
|
412
|
+
iconName: "power_settings_new"
|
|
413
|
+
iconColor: Topside.Theme.fgDim
|
|
414
|
+
tooltipText: "Quit Topside"
|
|
415
|
+
onClicked: {
|
|
416
|
+
root.closePopout();
|
|
417
|
+
root.controlDaemon("stop");
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
Loader {
|
|
423
|
+
active: root.showCompletion
|
|
424
|
+
visible: active
|
|
425
|
+
Layout.fillWidth: true
|
|
426
|
+
sourceComponent: Topside.CompletionCard {
|
|
427
|
+
session: root.finishedSession
|
|
428
|
+
onJump: root.jumpTo(root.finishedId)
|
|
429
|
+
HoverHandler {
|
|
430
|
+
onHoveredChanged: root.cardHovered = hovered
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
Repeater {
|
|
436
|
+
id: questionCards
|
|
437
|
+
model: client.questions
|
|
438
|
+
delegate: Topside.QuestionRow {
|
|
439
|
+
required property var modelData
|
|
440
|
+
required property int index
|
|
441
|
+
shortcuts: index === 0
|
|
442
|
+
question: modelData
|
|
443
|
+
session: root.sessionFor(modelData.sessionId)
|
|
444
|
+
Layout.fillWidth: true
|
|
445
|
+
onAnswered: answers => client.answer(modelData.id, answers)
|
|
446
|
+
onOpenTerminal: root.jumpTo(modelData.sessionId)
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
Repeater {
|
|
451
|
+
model: client.approvals
|
|
452
|
+
delegate: Topside.ApprovalRow {
|
|
453
|
+
required property var modelData
|
|
454
|
+
required property int index
|
|
455
|
+
shortcuts: index === 0 && client.questions.length === 0
|
|
456
|
+
approval: modelData
|
|
457
|
+
session: root.sessionFor(modelData.sessionId)
|
|
458
|
+
Layout.fillWidth: true
|
|
459
|
+
onDecided: decision => client.decide(modelData.id, decision)
|
|
460
|
+
onJump: root.jumpTo(modelData.sessionId)
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
ColumnLayout {
|
|
465
|
+
visible: !root.showCompletion
|
|
466
|
+
spacing: 2
|
|
467
|
+
Layout.fillWidth: true
|
|
468
|
+
Repeater {
|
|
469
|
+
model: root.listed
|
|
470
|
+
delegate: Topside.SessionRow {
|
|
471
|
+
required property var modelData
|
|
472
|
+
session: modelData
|
|
473
|
+
canHide: true
|
|
474
|
+
hideQuestion: root.hideRule && root.hideRule.sessionId === modelData.id ? Hiding.questionText(root.hideRule, "session") : ""
|
|
475
|
+
hideCount: root.hideRule ? root.hideRule.caught.length : 0
|
|
476
|
+
willHide: root.hideRule !== null && root.hideRule.caught.indexOf(modelData.id) >= 0
|
|
477
|
+
Layout.fillWidth: true
|
|
478
|
+
onActivated: root.jumpTo(modelData.id)
|
|
479
|
+
onHoveredChanged: if (hovered) root.hoveredSession = modelData.id; else if (root.hoveredSession === modelData.id) root.hoveredSession = ""
|
|
480
|
+
onHideFolder: root.hideAsk = { folder: true, text: modelData.cwd || "", sessionId: modelData.id }
|
|
481
|
+
onHidePrompt: root.hideAsk = { folder: false, text: modelData.title || "", sessionId: modelData.id }
|
|
482
|
+
onHideKept: root.hideAsk = null
|
|
483
|
+
onHideConfirmed: {
|
|
484
|
+
const q = root.hideRule;
|
|
485
|
+
root.hideAsk = null;
|
|
486
|
+
if (q) root.hide(q.folder ? "hiddenFolders" : "hiddenPrompts", q.text);
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
Text {
|
|
493
|
+
visible: !root.showCompletion && root.hidden > 0
|
|
494
|
+
text: "+ " + root.hidden + " more"
|
|
495
|
+
color: moreHover.hovered ? Topside.Theme.fg : Topside.Theme.fgDim
|
|
496
|
+
font.pixelSize: Topside.Theme.content
|
|
497
|
+
Layout.leftMargin: 54
|
|
498
|
+
HoverHandler {
|
|
499
|
+
id: moreHover
|
|
500
|
+
cursorShape: Qt.PointingHandCursor
|
|
501
|
+
}
|
|
502
|
+
TapHandler {
|
|
503
|
+
onTapped: root.showAll = true
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
Text {
|
|
508
|
+
visible: client.jumpError !== ""
|
|
509
|
+
text: client.jumpError
|
|
510
|
+
color: Topside.Theme.reminder
|
|
511
|
+
font.pixelSize: Topside.Theme.content
|
|
512
|
+
wrapMode: Text.Wrap
|
|
513
|
+
Layout.fillWidth: true
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
// Quit, or never started: one button brings it back.
|
|
517
|
+
Rectangle {
|
|
518
|
+
visible: !client.connected
|
|
519
|
+
Layout.alignment: Qt.AlignHCenter
|
|
520
|
+
implicitWidth: startLabel.implicitWidth + 28
|
|
521
|
+
implicitHeight: 30
|
|
522
|
+
radius: 15
|
|
523
|
+
color: startHover.hovered ? Topside.Theme.fg : Topside.Theme.bgRaised
|
|
524
|
+
Text {
|
|
525
|
+
id: startLabel
|
|
526
|
+
anchors.centerIn: parent
|
|
527
|
+
text: "Start Topside"
|
|
528
|
+
color: startHover.hovered ? Topside.Theme.bg : Topside.Theme.fg
|
|
529
|
+
font.pixelSize: Topside.Theme.s(12)
|
|
530
|
+
font.weight: Font.DemiBold
|
|
531
|
+
}
|
|
532
|
+
HoverHandler {
|
|
533
|
+
id: startHover
|
|
534
|
+
cursorShape: Qt.PointingHandCursor
|
|
535
|
+
}
|
|
536
|
+
TapHandler {
|
|
537
|
+
onTapped: root.controlDaemon("start")
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
Text {
|
|
542
|
+
visible: client.sessions.length === 0
|
|
543
|
+
text: client.connected ? "No sessions yet. Start claude, codex, pi or omp in a terminal." : "Topside is off."
|
|
544
|
+
color: Topside.Theme.fgDim
|
|
545
|
+
font.pixelSize: Topside.Theme.s(13)
|
|
546
|
+
horizontalAlignment: Text.AlignHCenter
|
|
547
|
+
Layout.fillWidth: true
|
|
548
|
+
Layout.minimumHeight: 56
|
|
549
|
+
verticalAlignment: Text.AlignVCenter
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "topside",
|
|
3
|
+
"name": "Topside",
|
|
4
|
+
"description": "Your Claude Code sessions on the bar: state at a glance, approve or deny tool calls from the popout",
|
|
5
|
+
"version": "0.1.0",
|
|
6
|
+
"author": "ducban",
|
|
7
|
+
"type": "widget",
|
|
8
|
+
"capabilities": ["dankbar-widget"],
|
|
9
|
+
"permissions": ["settings_write"],
|
|
10
|
+
"component": "./TopsideWidget.qml",
|
|
11
|
+
"settings": "./TopsideSettings.qml",
|
|
12
|
+
"icon": "smart_toy",
|
|
13
|
+
"requires_dms": ">=1.7.0"
|
|
14
|
+
}
|