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