topside-arch 0.0.0-stage → 0.1.1

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.
Files changed (92) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +213 -2
  3. package/contrib/aur/PKGBUILD +35 -0
  4. package/contrib/aur/topside-arch.install +25 -0
  5. package/contrib/icons/hicolor/scalable/apps/topside.svg +28 -0
  6. package/contrib/systemd/topside.service +10 -0
  7. package/contrib/themes/sakura.json +31 -0
  8. package/dist/adapters/claude/attach.js +92 -0
  9. package/dist/adapters/claude/hook-event.js +173 -0
  10. package/dist/adapters/claude/one-shot.js +30 -0
  11. package/dist/adapters/claude/settings.js +78 -0
  12. package/dist/adapters/claude/usage.js +76 -0
  13. package/dist/adapters/codex/codex.js +73 -0
  14. package/dist/adapters/codex/patch.js +39 -0
  15. package/dist/adapters/codex/usage.js +77 -0
  16. package/dist/adapters/pi/extension.js +271 -0
  17. package/dist/adapters/pi/risk-gate.js +256 -0
  18. package/dist/cli/commands.js +563 -0
  19. package/dist/cli/hook-log.js +32 -0
  20. package/dist/cli/main.js +100 -0
  21. package/dist/daemon/preview.js +70 -0
  22. package/dist/daemon/processes.js +105 -0
  23. package/dist/daemon/server.js +437 -0
  24. package/dist/daemon/session-state.js +173 -0
  25. package/dist/daemon/store.js +176 -0
  26. package/dist/dms/setup.js +126 -0
  27. package/dist/hosts/hosts.js +39 -0
  28. package/dist/jump/jump.js +199 -0
  29. package/dist/pill/config.js +92 -0
  30. package/dist/pill/launch.js +38 -0
  31. package/dist/sekaipop/setup.js +210 -0
  32. package/dist/shared/ancestry.js +27 -0
  33. package/dist/shared/client.js +29 -0
  34. package/dist/shared/package.js +25 -0
  35. package/dist/shared/paths.js +69 -0
  36. package/dist/shared/protocol.js +35 -0
  37. package/dist/shared/qml-lib.js +32 -0
  38. package/dist/shared/result.js +6 -0
  39. package/dist/shared/terminal.js +42 -0
  40. package/dist/themes/themes.js +84 -0
  41. package/package.json +49 -4
  42. package/shell/core/AgentIcon.qml +24 -0
  43. package/shell/core/AppLogo.qml +48 -0
  44. package/shell/core/ApprovalRow.qml +197 -0
  45. package/shell/core/BoardDetail.qml +296 -0
  46. package/shell/core/BoardList.qml +433 -0
  47. package/shell/core/BoardNotice.qml +187 -0
  48. package/shell/core/CardButton.qml +55 -0
  49. package/shell/core/CardHeader.qml +46 -0
  50. package/shell/core/ChalkBoard.qml +99 -0
  51. package/shell/core/CompletionCard.qml +106 -0
  52. package/shell/core/FlapText.qml +95 -0
  53. package/shell/core/KeyCap.qml +72 -0
  54. package/shell/core/Mascot.qml +13 -0
  55. package/shell/core/MascotBadge.qml +40 -0
  56. package/shell/core/MascotEffect.qml +40 -0
  57. package/shell/core/Paper.qml +54 -0
  58. package/shell/core/PixelGrid.qml +40 -0
  59. package/shell/core/QuestionRow.qml +161 -0
  60. package/shell/core/SessionRow.qml +220 -0
  61. package/shell/core/Stamp.qml +62 -0
  62. package/shell/core/StatusDots.qml +33 -0
  63. package/shell/core/Surface.qml +32 -0
  64. package/shell/core/Tag.qml +22 -0
  65. package/shell/core/TerminalIcon.qml +34 -0
  66. package/shell/core/Theme.qml +100 -0
  67. package/shell/core/TicketDetail.qml +588 -0
  68. package/shell/core/TicketList.qml +639 -0
  69. package/shell/core/TicketNotice.qml +198 -0
  70. package/shell/core/TopsideClient.qml +198 -0
  71. package/shell/core/UsageLine.qml +106 -0
  72. package/shell/core/agents.js +79 -0
  73. package/shell/core/board.js +138 -0
  74. package/shell/core/hiding.js +29 -0
  75. package/shell/core/pixels.js +542 -0
  76. package/shell/core/qmldir +30 -0
  77. package/shell/core/sounds.js +31 -0
  78. package/shell/core/themes.js +195 -0
  79. package/shell/core/ticket.js +131 -0
  80. package/shell/dms-plugin/TopsideSettings.qml +696 -0
  81. package/shell/dms-plugin/TopsideWidget.qml +572 -0
  82. package/shell/dms-plugin/plugin.json +14 -0
  83. package/shell/pill.qml +279 -0
  84. package/shell/sekaipop-plugin/Bar.qml +151 -0
  85. package/shell/sekaipop-plugin/Card.qml +291 -0
  86. package/shell/sekaipop-plugin/Floating.qml +83 -0
  87. package/shell/sekaipop-plugin/ListWindow.qml +156 -0
  88. package/shell/sekaipop-plugin/Popup.qml +70 -0
  89. package/shell/sekaipop-plugin/Service.qml +414 -0
  90. package/shell/sekaipop-plugin/ShellLook.qml +43 -0
  91. package/shell/sekaipop-plugin/StyledCard.qml +179 -0
  92. package/shell/sekaipop-plugin/plugin.json +109 -0
@@ -0,0 +1,414 @@
1
+ import QtQuick
2
+ import Quickshell
3
+ import Quickshell.Io
4
+ import Quickshell.Hyprland
5
+ import Qt.labs.folderlistmodel
6
+ import "core" as Topside
7
+ import "core/sounds.js" as Sounds
8
+ import "core/hiding.js" as Hiding
9
+
10
+ // Topside's SekaiPop service: made once and shared by the bar entry on every
11
+ // monitor and the popup (host.service). It holds the one daemon connection
12
+ // and what the DMS widget keeps beside it: the completion card, sounds,
13
+ // reminders and hiding. `topside setup` copies this folder plus shell/core
14
+ // into ~/.config/sekaipop/plugins/topside.
15
+ Scope {
16
+ id: root
17
+ required property var host
18
+
19
+ readonly property var settings: host.settings
20
+ readonly property bool autoOpen: settings.autoOpen ?? true
21
+ readonly property int maxDots: Math.max(1, Math.min(7, settings.maxDots ?? 5))
22
+ readonly property bool sounds: settings.sounds ?? false
23
+ readonly property string attentionSound: Sounds.known(settings.attentionSound ?? "", "attention")
24
+ readonly property string completionSound: Sounds.known(settings.completionSound ?? "", "completion")
25
+ readonly property bool reminders: settings.reminders ?? true
26
+ readonly property int reminderMinutes: Math.max(1, Math.min(10, settings.reminderMinutes ?? 2))
27
+
28
+ readonly property var client: daemon
29
+ readonly property int waitingCount: daemon.approvals.length + daemon.questions.length
30
+ readonly property string summary: !daemon.connected ? "daemon offline"
31
+ : waitingCount > 0 ? waitingCount + " waiting for you"
32
+ : daemon.sessions.length === 0 ? "no sessions"
33
+ : daemon.sessions.length + (daemon.sessions.length === 1 ? " session" : " sessions")
34
+
35
+ // The shell owns the popup; it tells us whether one is open anywhere.
36
+ readonly property bool popupOpen: host.wanted.indexOf("popup") >= 0
37
+ // "Match SekaiPop" (ShellLook.qml, set up by Bar.qml): the cards take the
38
+ // shell's surfaces, outline, shape and font, and its light or dark mode.
39
+ readonly property bool matchShell: (settings.look ?? "shell") === "shell"
40
+ // Style: "board", the departure board (the default), "ticket", the order
41
+ // tickets (both StyledCard.qml), or "classic", Topside's cards (Card.qml).
42
+ readonly property string style: settings.style === "classic" || settings.style === "ticket" ? settings.style : "board"
43
+ readonly property bool styled: style !== "classic"
44
+ // Popup.qml closes itself on this (only it can put the popup away).
45
+ signal closeWanted()
46
+
47
+ // Cards that open by themselves go to Topside's own window
48
+ // (Floating.qml), never to SekaiPop's popup: SekaiPop's bar takes the
49
+ // keyboard while a plugin popup is open, which would steal your typing.
50
+ // The card lands on the focused monitor, by that monitor's bar entry.
51
+ property bool floatingOpen: false
52
+ property string floatingScreen: ""
53
+ function openPopup() {
54
+ if (root.popupOpen || root.listOpen) return;
55
+ const focused = Hyprland.focusedMonitor;
56
+ root.floatingScreen = focused ? focused.name : (Quickshell.screens[0] ? Quickshell.screens[0].name : "");
57
+ root.floatingOpen = true;
58
+ }
59
+ function closeFloating() {
60
+ if (!root.floatingOpen) return;
61
+ root.floatingOpen = false;
62
+ root.finishedId = "";
63
+ root.hoveredSession = "";
64
+ }
65
+ // Open by itself, it goes once nothing is left on it: the requests are
66
+ // answered and no completion card shows. The list is a click on the entry.
67
+ readonly property bool floatingEmpty: root.waitingCount === 0 && !root.showCompletion
68
+ onFloatingEmptyChanged: if (root.floatingEmpty) root.closeFloating()
69
+ Floating {
70
+ service: root
71
+ }
72
+
73
+ // Style: Board's departures and Ticket's rail open in Topside's own
74
+ // window (ListWindow.qml), wider than SekaiPop's popup allows and with no
75
+ // frame around them. A click on the entry still opens SekaiPop's popup
76
+ // first: Popup.qml closes it at once and calls openList().
77
+ // The board's width, the notice's and the list's alike, so both read as
78
+ // the same board: most of a 1080p screen's middle.
79
+ function boardWidth(screenWidth) {
80
+ return Math.min(1100, Math.round(screenWidth * 0.58));
81
+ }
82
+ property bool listOpen: false
83
+ property string listScreen: ""
84
+ function openList() {
85
+ const focused = Hyprland.focusedMonitor;
86
+ root.listScreen = focused ? focused.name : (Quickshell.screens[0] ? Quickshell.screens[0].name : "");
87
+ root.closeFloating();
88
+ root.listOpen = true;
89
+ }
90
+ function closeList() {
91
+ if (!root.listOpen) return;
92
+ root.listOpen = false;
93
+ root.showAll = false;
94
+ root.hoveredSession = "";
95
+ }
96
+ ListWindow {
97
+ service: root
98
+ }
99
+
100
+ // Each bar entry tells the service where it is, per monitor, so the
101
+ // floating card can sit by it: { item, edge }. The bar also hands over the
102
+ // shell's icon font, which a service doesn't get.
103
+ property var entries: ({})
104
+ property string iconFont: ""
105
+ function registerEntry(screenName, item, edge) {
106
+ const next = Object.assign({}, root.entries);
107
+ next[screenName] = { item: item, edge: edge };
108
+ root.entries = next;
109
+ }
110
+ function unregisterEntry(screenName, item) {
111
+ if (!root.entries[screenName] || root.entries[screenName].item !== item) return;
112
+ const next = Object.assign({}, root.entries);
113
+ delete next[screenName];
114
+ root.entries = next;
115
+ }
116
+ function entryOn(screenName) {
117
+ return root.entries[screenName] ?? null;
118
+ }
119
+
120
+ // Settings > Desktop > Plugins, on Topside.
121
+ Process {
122
+ id: settingsOpener
123
+ command: ["qs", "-c", "sekaipop", "ipc", "call", "plugins", "settings", "topside"]
124
+ }
125
+ function openSettings() {
126
+ root.closeWanted();
127
+ root.closeFloating();
128
+ root.closeList();
129
+ settingsOpener.running = true;
130
+ }
131
+
132
+ // A click on the entry opens SekaiPop's popup; the floating card gives way.
133
+ onPopupOpenChanged: if (popupOpen) root.closeFloating(); else {
134
+ root.finishedId = "";
135
+ root.showAll = false;
136
+ root.hoveredSession = "";
137
+ }
138
+
139
+ // A completion card: the session whose turn just ended, shown alone in the
140
+ // popup for 5 s (longer while the pointer rests on it). "" for none.
141
+ property string finishedId: ""
142
+ property bool cardHovered: false
143
+ readonly property var finishedSession: finishedId === "" ? null : sessionFor(finishedId)
144
+ readonly property bool showCompletion: finishedSession !== null && finishedSession.status === "done" && waitingCount === 0
145
+
146
+ Timer {
147
+ id: cardTimer
148
+ interval: 5000
149
+ onTriggered: {
150
+ if (root.cardHovered) {
151
+ restart();
152
+ return;
153
+ }
154
+ if (root.showCompletion) {
155
+ root.closeWanted();
156
+ root.closeFloating();
157
+ }
158
+ root.finishedId = "";
159
+ }
160
+ }
161
+
162
+ // "Sessions shown": the list draws that many rows, plus every waiting
163
+ // session, then one "+ N more" line that opens the rest until it closes.
164
+ property bool showAll: false
165
+ readonly property var listed: showAll ? daemon.sessions
166
+ : daemon.sessions.filter((s, i) => i < maxDots || s.status === "waiting")
167
+ readonly property int moreCount: daemon.sessions.length - listed.length
168
+
169
+ // The row under the pointer, for ⌃J and the header's plan.
170
+ property string hoveredSession: ""
171
+ // Whose plan the header shows: the row under the pointer, else the open
172
+ // card's session, else the newest session (VIA-PARITY §7).
173
+ readonly property string usageSession: root.hoveredSession || (root.showCompletion ? root.finishedId : "") || (daemon.sessions[0] ? daemon.sessions[0].id : "")
174
+ readonly property string usageAgent: {
175
+ const session = daemon.sessions.find(s => s.id === root.usageSession);
176
+ return session ? session.agent : "claude";
177
+ }
178
+
179
+ // Sounds play through the freedesktop sound theme. The service is one for
180
+ // every monitor, so each sound plays once.
181
+ Process {
182
+ id: player
183
+ }
184
+ function play(name) {
185
+ if (!root.sounds) return;
186
+ root.preview(name);
187
+ }
188
+
189
+ // Plays a sound whatever the switch says, so a pick can be heard.
190
+ function preview(name) {
191
+ player.command = ["canberra-gtk-play", "-i", name];
192
+ player.running = true;
193
+ }
194
+
195
+ // SekaiPop's settings form can't play a sound, so a new pick plays here,
196
+ // as the DMS page's picker did. Not while the settings first arrive.
197
+ property bool settled: false
198
+ Timer {
199
+ interval: 3000
200
+ running: true
201
+ onTriggered: root.settled = true
202
+ }
203
+ onAttentionSoundChanged: if (root.settled) root.preview(root.attentionSound)
204
+ onCompletionSoundChanged: if (root.settled) root.preview(root.completionSound)
205
+
206
+ // One reminder per request or question still pending after the wait: the
207
+ // bar's mascot turns red with a blinking "!" for 4 s, the attention sound
208
+ // plays, and the popup opens again if cards open by themselves. Skipped,
209
+ // for good, when the session's terminal has the focus or the popup is open.
210
+ property var reminded: ({})
211
+ property string remindingSession: ""
212
+
213
+ Timer {
214
+ interval: 15000
215
+ repeat: true
216
+ running: root.reminders && root.waitingCount > 0
217
+ onTriggered: root.checkReminders()
218
+ }
219
+ Timer {
220
+ id: reminderEnd
221
+ interval: 4000
222
+ onTriggered: root.remindingSession = ""
223
+ }
224
+ Process {
225
+ id: frontCheck
226
+ property string sessionId: ""
227
+ stdout: StdioCollector {
228
+ onStreamFinished: {
229
+ if (text.trim() === "no") root.remind(frontCheck.sessionId);
230
+ }
231
+ }
232
+ }
233
+
234
+ function checkReminders() {
235
+ const pending = daemon.approvals.concat(daemon.questions);
236
+ const kept = {};
237
+ for (const request of pending) if (root.reminded[request.id]) kept[request.id] = true;
238
+ const now = Date.now();
239
+ const due = pending.find(r => !kept[r.id] && now - r.createdAt >= root.reminderMinutes * 60000);
240
+ if (due) kept[due.id] = true;
241
+ root.reminded = kept;
242
+ if (!due || root.popupOpen || root.floatingOpen || frontCheck.running) return;
243
+ frontCheck.sessionId = due.sessionId;
244
+ frontCheck.command = daemon.cli.concat(["front", due.sessionId]);
245
+ frontCheck.running = true;
246
+ }
247
+
248
+ function remind(sessionId) {
249
+ root.remindingSession = sessionId;
250
+ reminderEnd.restart();
251
+ root.play(root.attentionSound);
252
+ if (root.autoOpen) root.openPopup();
253
+ }
254
+
255
+ // Hiding (VIA-PARITY §18): folders and prompts the user hid, one per line,
256
+ // newest first, in the plugin's settings (Settings > Desktop > Plugins
257
+ // edits them too). The client leaves their sessions out, with their
258
+ // requests, dots, cards, sounds and reminders.
259
+ function lines(text) {
260
+ return String(text ?? "").split("\n").map(l => l.trim()).filter(l => l !== "");
261
+ }
262
+ readonly property var hiddenFolders: lines(settings.hiddenFolders)
263
+ readonly property var hiddenPrompts: lines(settings.hiddenPrompts)
264
+ Binding { target: daemon; property: "hiddenFolders"; value: root.hiddenFolders }
265
+ Binding { target: daemon; property: "hiddenPrompts"; value: root.hiddenPrompts }
266
+
267
+ // The last hide, undoable for 6 s: { key, entry, label }.
268
+ property var undo: null
269
+ Timer {
270
+ id: undoTimer
271
+ interval: 6000
272
+ onTriggered: root.undo = null
273
+ }
274
+
275
+ function hide(key, entry, label) {
276
+ if (entry === "") return;
277
+ const list = key === "hiddenFolders" ? root.hiddenFolders : root.hiddenPrompts;
278
+ root.host.setSetting(key, Hiding.added(list, entry).join("\n"));
279
+ root.undo = { key: key, entry: entry, label: label };
280
+ undoTimer.restart();
281
+ }
282
+
283
+ function undoHide() {
284
+ if (!root.undo) return;
285
+ const list = root.undo.key === "hiddenFolders" ? root.hiddenFolders : root.hiddenPrompts;
286
+ root.host.setSetting(root.undo.key, Hiding.removed(list, root.undo.entry).join("\n"));
287
+ root.undo = null;
288
+ }
289
+
290
+ // ⌃Y ⌃N ⌃A answer the first request card, ⌃1…⌃9 pick an option of the
291
+ // first question, ⌃J jumps: the open card's session, else the row under
292
+ // the pointer, else the newest. Escape is the shell's: it closes the
293
+ // popup and never answers anything.
294
+ function handleKey(event, questionCard) {
295
+ if (!(event.modifiers & Qt.ControlModifier)) return false;
296
+ const approval = daemon.questions.length === 0 ? daemon.approvals[0] : null;
297
+ if (approval && event.key === Qt.Key_Y) daemon.decide(approval.id, "allow");
298
+ else if (approval && event.key === Qt.Key_N) daemon.decide(approval.id, "deny");
299
+ else if (approval && event.key === Qt.Key_A && approval.always) daemon.decide(approval.id, "always");
300
+ else if (questionCard && event.key >= Qt.Key_1 && event.key <= Qt.Key_9) {
301
+ const options = daemon.questions[0].questions[0].options;
302
+ const option = options[event.key - Qt.Key_1];
303
+ if (!option) return false;
304
+ questionCard.pick(0, option.label);
305
+ } else if (event.key === Qt.Key_J) {
306
+ const target = root.showCompletion ? root.finishedId
307
+ : daemon.questions.length > 0 ? daemon.questions[0].sessionId
308
+ : approval ? approval.sessionId
309
+ : root.hoveredSession || (daemon.sessions[0] ? daemon.sessions[0].id : "");
310
+ if (target === "") return false;
311
+ daemon.jump(target);
312
+ } else return false;
313
+ return true;
314
+ }
315
+
316
+ function sessionFor(sessionId) {
317
+ return daemon.sessions.find(s => s.id === sessionId) || null;
318
+ }
319
+
320
+ Timer {
321
+ id: jumpLater
322
+ property string sessionId: ""
323
+ interval: 150
324
+ onTriggered: daemon.jumpNow(sessionId)
325
+ }
326
+
327
+ Topside.TopsideClient {
328
+ id: daemon
329
+ // Only a new request opens the popup, so closing it sticks until the
330
+ // next one or the reminder.
331
+ onRequested: if (root.autoOpen) root.openPopup()
332
+ // A pending request wins over a completion card; an open list isn't taken over.
333
+ onFinished: session => {
334
+ if (!root.autoOpen || root.waitingCount > 0 || root.popupOpen || root.floatingOpen || root.listOpen) return;
335
+ root.finishedId = session.id;
336
+ root.openPopup();
337
+ cardTimer.restart();
338
+ }
339
+ // The list window and SekaiPop's popup hold the keyboard. Let it go
340
+ // first, then jump, or Hyprland hands the focus back to the window you
341
+ // came from once they close (a click on a session in Orca landed in the
342
+ // app you were in).
343
+ askBeforeJump: true
344
+ onJumpAsked: sessionId => {
345
+ const held = root.listOpen || root.popupOpen;
346
+ root.closeWanted();
347
+ root.closeFloating();
348
+ root.closeList();
349
+ jumpLater.sessionId = sessionId;
350
+ if (held) jumpLater.restart();
351
+ else daemon.jumpNow(sessionId);
352
+ }
353
+ onJumped: {
354
+ root.closeWanted();
355
+ root.closeFloating();
356
+ root.closeList();
357
+ }
358
+ onCue: name => root.play(name === "attention" ? root.attentionSound : root.completionSound)
359
+ }
360
+
361
+ // Quit and start, as the Mac's power button: here Topside is the daemon,
362
+ // so quitting stops it. The bar then shows three red dots, and the popup
363
+ // offers to start it again.
364
+ Process {
365
+ id: daemonControl
366
+ property string action: "stop"
367
+ command: ["systemctl", "--user", action, "topside"]
368
+ }
369
+ function controlDaemon(action) {
370
+ daemonControl.action = action;
371
+ daemonControl.running = true;
372
+ }
373
+
374
+ // SekaiPop's form only offers the themes plugin.json lists. When a file in
375
+ // the themes folder comes, goes or changes, `topside theme sync` writes
376
+ // the list again and reloads the plugins; it does nothing when the list is
377
+ // the same. Any change rebuilds the folder model, so a short wait gathers
378
+ // one save's events into one run. `topside setup` makes the folder.
379
+ FolderListModel {
380
+ id: themeFiles
381
+ folder: "file://" + Topside.Theme.themesDir
382
+ nameFilters: ["*.json"]
383
+ showDirs: false
384
+ }
385
+ Instantiator {
386
+ model: themeFiles
387
+ delegate: QtObject {}
388
+ onObjectAdded: themeSyncWait.restart()
389
+ onObjectRemoved: themeSyncWait.restart()
390
+ }
391
+ Timer {
392
+ id: themeSyncWait
393
+ interval: 1500
394
+ onTriggered: if (!themeSync.running) themeSync.running = true
395
+ }
396
+ Process {
397
+ id: themeSync
398
+ command: daemon.cli.concat(["theme", "sync"])
399
+ }
400
+
401
+ // Written by `topside setup`: how to run Topside, since the shell's PATH may not have it.
402
+ FileView {
403
+ path: root.host.path("cli.json")
404
+ printErrors: false
405
+ onLoaded: daemon.cli = daemon.parseCli(text())
406
+ }
407
+
408
+ // The shared rows draw with Topside.Theme. The theme, the mode and the text
409
+ // size come from the plugin's settings; Bar.qml feeds "System" the shell's
410
+ // light or dark mode, which Match SekaiPop always follows.
411
+ Binding { target: Topside.Theme; property: "name"; value: root.settings.theme ?? "topsideBlack" }
412
+ Binding { target: Topside.Theme; property: "mode"; value: root.matchShell ? "system" : root.settings.appearance ?? "dark" }
413
+ Binding { target: Topside.Theme; property: "content"; value: Math.max(10, Math.min(14, root.settings.fontSize ?? 11)) }
414
+ }
@@ -0,0 +1,43 @@
1
+ import QtQuick
2
+ import "core" as Topside
3
+ import "core/themes.js" as Themes
4
+
5
+ // "Match SekaiPop": the shared cards take SekaiPop's surfaces, ink, outline,
6
+ // corners, hard shadow and font from `host.theme`, the names its plugin api
7
+ // promises. Topside's theme still picks the status colors. Bar.qml makes one
8
+ // per bar entry, since only a surface's host has a theme; with `on` false it
9
+ // sets nothing and Theme keeps Topside's own look.
10
+ QtObject {
11
+ id: look
12
+ required property var theme
13
+ property bool on: false
14
+
15
+ function hex(c) {
16
+ function part(v) {
17
+ const s = Math.round(v * 255).toString(16);
18
+ return s.length === 1 ? "0" + s : s;
19
+ }
20
+ return "#" + part(c.r) + part(c.g) + part(c.b);
21
+ }
22
+
23
+ readonly property var neutrals: ({
24
+ background: hex(theme.surface),
25
+ raised: hex(theme.surfaceHover),
26
+ text: hex(theme.ink),
27
+ // inkSub is ink at two thirds over the surface; Themes mixes plain colors.
28
+ muted: Themes.mix(hex(theme.surface), hex(theme.ink), theme.inkSub.a),
29
+ })
30
+ readonly property int corner: Math.max(4, theme.radiusOuter - 3)
31
+
32
+ property list<QtObject> bindings: [
33
+ Binding { target: Topside.Theme; property: "neutrals"; value: look.neutrals; when: look.on },
34
+ Binding { target: Topside.Theme; property: "font"; value: look.theme.fontFamily; when: look.on },
35
+ Binding { target: Topside.Theme; property: "panelRadius"; value: look.theme.radiusOuter; when: look.on },
36
+ Binding { target: Topside.Theme; property: "cardRadius"; value: look.corner; when: look.on },
37
+ Binding { target: Topside.Theme; property: "buttonRadius"; value: look.corner; when: look.on },
38
+ Binding { target: Topside.Theme; property: "lineWidth"; value: look.theme.borderWidth; when: look.on },
39
+ Binding { target: Topside.Theme; property: "line"; value: look.theme.line; when: look.on },
40
+ Binding { target: Topside.Theme; property: "shadowOffset"; value: look.theme.shadowOffset; when: look.on },
41
+ Binding { target: Topside.Theme; property: "shadowColor"; value: look.theme.lineShadow; when: look.on }
42
+ ]
43
+ }
@@ -0,0 +1,179 @@
1
+ import QtQuick
2
+ import "core" as Topside
3
+ import "core/board.js" as Board
4
+
5
+ // Topside on SekaiPop in a style of its own (Settings > Style: Board or
6
+ // Ticket): what Card.qml is for the classic style. In Topside's own window
7
+ // (Floating.qml) it's the notification that comes with the first waiting
8
+ // request or a finished turn: the departure board lowering, big enough to
9
+ // read across the room, or the ticket printing. On SekaiPop's popup
10
+ // (Popup.qml) it's the list: the departures, or the kitchen rail. Both draw
11
+ // their own faces, whatever the Look.
12
+ Item {
13
+ id: root
14
+ required property var service
15
+ readonly property var client: service.client
16
+ property string iconFont: ""
17
+ property real maxHeight: 700
18
+ property bool floating: false
19
+ // The monitor's width, so the board can take a good part of it.
20
+ property real screenWidth: 1920
21
+ // The list's width: 480 on SekaiPop's popup (its most), more in
22
+ // Topside's own list window (ListWindow.qml).
23
+ property real listWidth: 480
24
+ signal closeRequested()
25
+
26
+ readonly property bool ticket: service.style === "ticket"
27
+ readonly property var pending: Board.pending(client.approvals, client.questions)
28
+
29
+ // The item that takes ⌃1…⌃9 like the classic question card.
30
+ function firstQuestion() {
31
+ return root.client.questions.length > 0 ? content.item : null;
32
+ }
33
+
34
+ // SekaiPop keeps its popup 280 to 480 wide. Topside's own windows are
35
+ // ours: wider, never bigger type, so a row or a line just holds more.
36
+ implicitWidth: !floating ? listWidth : ticket ? 760 : service.boardWidth(screenWidth)
37
+ implicitHeight: Math.min(root.maxHeight, (content.item ? content.item.implicitHeight : 0) + 2 * pad)
38
+ readonly property int pad: floating ? (ticket ? 0 : 4) : 12
39
+
40
+ // Each time the window opens, the board lowers into place.
41
+ Connections {
42
+ target: root.service
43
+ function onFloatingOpenChanged() {
44
+ if (root.floating && root.service.floatingOpen) {
45
+ if (root.ticket) {
46
+ if (content.item) content.item.reprint();
47
+ } else lower.restart();
48
+ }
49
+ }
50
+ }
51
+ NumberAnimation {
52
+ id: lower
53
+ target: drop
54
+ property: "y"
55
+ from: -root.implicitHeight
56
+ to: 0
57
+ duration: 520
58
+ easing.type: Easing.OutBack
59
+ easing.overshoot: 1.2
60
+ }
61
+
62
+ // Opened again (ListWindow.qml): no pick, first page, top of the list.
63
+ function reset() {
64
+ scroller.contentY = 0;
65
+ if (content.item && typeof content.item.reset === "function") content.item.reset();
66
+ }
67
+
68
+ Flickable {
69
+ id: scroller
70
+ anchors.fill: parent
71
+ anchors.margins: root.pad
72
+ clip: true
73
+ contentHeight: content.item ? content.item.implicitHeight : 0
74
+ boundsBehavior: Flickable.StopAtBounds
75
+
76
+ Loader {
77
+ id: content
78
+ width: parent.width
79
+ transform: Translate {
80
+ id: drop
81
+ }
82
+ sourceComponent: root.floating ? (root.ticket ? ticketNotice : boardNotice) : (root.ticket ? rail : departures)
83
+ }
84
+ }
85
+
86
+ Component {
87
+ id: boardNotice
88
+ Topside.BoardNotice {
89
+ client: root.client
90
+ request: root.pending.length > 0 ? root.pending[0] : null
91
+ finishedSession: root.service.showCompletion ? root.service.finishedSession : null
92
+ queue: root.pending.slice(1)
93
+ reminding: root.pending.length > 0 && root.service.remindingSession === root.pending[0].sessionId
94
+ closable: true
95
+ maxHeight: root.maxHeight - 2 * root.pad
96
+ onCloseRequested: root.closeRequested()
97
+ onDismissed: root.service.closeFloating()
98
+ HoverHandler {
99
+ onHoveredChanged: root.service.cardHovered = hovered
100
+ }
101
+ }
102
+ }
103
+
104
+ Component {
105
+ id: ticketNotice
106
+ Topside.TicketNotice {
107
+ client: root.client
108
+ request: root.pending.length > 0 ? root.pending[0] : null
109
+ finishedSession: root.service.showCompletion ? root.service.finishedSession : null
110
+ queue: root.pending.slice(1)
111
+ reminding: root.pending.length > 0 && root.service.remindingSession === root.pending[0].sessionId
112
+ closable: true
113
+ maxHeight: root.maxHeight - 2 * root.pad
114
+ onCloseRequested: root.closeRequested()
115
+ onDismissed: root.service.closeFloating()
116
+ HoverHandler {
117
+ onHoveredChanged: root.service.cardHovered = hovered
118
+ }
119
+ }
120
+ }
121
+
122
+ // The two lists take the same wiring.
123
+ function hideFolder(session) {
124
+ root.service.hide("hiddenFolders", session.cwd, "Hidden: " + Board.sessionName(session));
125
+ }
126
+ function hidePrompt(session) {
127
+ root.service.hide("hiddenPrompts", String(session.title || "").replace(/…$/, ""), "Hidden: sessions like “" + session.title + "”");
128
+ }
129
+ function quit() {
130
+ root.closeRequested();
131
+ root.service.controlDaemon("stop");
132
+ }
133
+
134
+ Component {
135
+ id: departures
136
+ Topside.BoardList {
137
+ client: root.client
138
+ maxHeight: root.maxHeight - 2 * root.pad
139
+ sessions: root.service.listed
140
+ moreCount: root.service.moreCount
141
+ showingAll: root.service.showAll
142
+ usageAgent: root.service.usageAgent
143
+ spend: root.client.spend[root.service.usageSession] || null
144
+ shortcuts: true
145
+ undoLabel: root.service.undo ? root.service.undo.label : ""
146
+ iconFont: root.iconFont
147
+ onMoreRequested: all => root.service.showAll = all
148
+ onHovered: id => root.service.hoveredSession = id
149
+ onHideFolder: session => root.hideFolder(session)
150
+ onHidePrompt: session => root.hidePrompt(session)
151
+ onUndoRequested: root.service.undoHide()
152
+ onSettingsRequested: root.service.openSettings()
153
+ onQuitRequested: root.quit()
154
+ onStartRequested: root.service.controlDaemon("start")
155
+ }
156
+ }
157
+
158
+ Component {
159
+ id: rail
160
+ Topside.TicketList {
161
+ client: root.client
162
+ maxHeight: root.maxHeight - 2 * root.pad
163
+ // Every session: the rail pages them five at a time itself.
164
+ sessions: root.client.sessions
165
+ usageAgent: root.service.usageAgent
166
+ spend: root.client.spend[root.service.usageSession] || null
167
+ shortcuts: true
168
+ undoLabel: root.service.undo ? root.service.undo.label : ""
169
+ iconFont: root.iconFont
170
+ onHovered: id => root.service.hoveredSession = id
171
+ onHideFolder: session => root.hideFolder(session)
172
+ onHidePrompt: session => root.hidePrompt(session)
173
+ onUndoRequested: root.service.undoHide()
174
+ onSettingsRequested: root.service.openSettings()
175
+ onQuitRequested: root.quit()
176
+ onStartRequested: root.service.controlDaemon("start")
177
+ }
178
+ }
179
+ }