@tryinget/pi-activity-strip 0.5.0 → 0.6.0
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/README.md +41 -6
- package/bin/pi-activity-strip-claude-hook.mjs +71 -0
- package/bin/pi-activity-strip.mjs +22 -1
- package/native/bin/linux-x64-gnu/artifact.json +2 -2
- package/native/bin/linux-x64-gnu/pi-activity-strip-panel +0 -0
- package/native/panel/src/app.rs +20 -20
- package/native/panel/src/card_view.rs +308 -9
- package/native/panel/src/protocol.rs +63 -0
- package/native/panel/src/runtime.rs +50 -9
- package/native/panel/src/style.css +134 -60
- package/package.json +4 -4
- package/src/common/agent-identity.mjs +163 -0
- package/src/common/ak-tasks.mjs +354 -0
- package/src/common/claude-events.mjs +190 -0
- package/src/common/claude-hook-config.mjs +56 -0
- package/src/common/claude-transcript.mjs +163 -0
- package/src/common/codex-transcript.mjs +153 -0
- package/src/common/compatibility.mjs +13 -0
- package/src/common/contracts.d.ts +26 -0
- package/src/common/contracts.ts +64 -1
- package/src/common/ghostty-present.mjs +100 -0
- package/src/common/ghostty-theme.mjs +149 -0
- package/src/common/niri-focus.mjs +179 -110
- package/src/common/session-cards.mjs +5 -2
- package/src/common/status-report.mjs +51 -0
- package/src/common/surface-bindings.mjs +234 -0
- package/src/common/terminal-identity.mjs +75 -12
- package/src/common/window-placement.mjs +59 -0
- package/src/common/workspace-view.mjs +161 -0
- package/src/native/agent-discovery.mjs +294 -0
- package/src/native/ak-runtime.mjs +164 -0
- package/src/native/codex-discovery.mjs +128 -0
- package/src/native/ghostty-tab-inventory.py +99 -0
- package/src/native/height-repair.mjs +154 -0
- package/src/native/main.mjs +120 -14
- package/src/native/panel-projection.mjs +67 -5
- package/src/native/placement.mjs +225 -0
- package/src/native/tab-inventory.mjs +188 -0
- package/src/native/theme-runtime.mjs +72 -0
- package/src/native/theme-source.mjs +197 -0
- package/src/native/workspace-events.mjs +16 -1
package/README.md
CHANGED
|
@@ -12,21 +12,26 @@ system4d:
|
|
|
12
12
|
|
|
13
13
|
# @tryinget/pi-activity-strip
|
|
14
14
|
|
|
15
|
-
A screen-top activity ribbon for
|
|
15
|
+
A screen-top activity ribbon for the coding agents running in your Ghostty tabs. Pi sessions publish their own telemetry; other terminal agents such as Claude Code are discovered from the process table.
|
|
16
16
|
|
|
17
17
|
The runtime is Electron-free. A Node controller retains the tested telemetry, identity, ordering, and exact-focus logic; a small Rust/Relm4/GTK4 panel owns rendering and the Wayland layer-shell surface.
|
|
18
18
|
|
|
19
19
|
## What it does
|
|
20
20
|
|
|
21
21
|
- auto-starts with interactive Pi TUI sessions
|
|
22
|
-
- shows one card per admitted Ghostty terminal on the focused Niri workspace
|
|
22
|
+
- shows one card per admitted Ghostty terminal on the focused Niri workspace, including tabs hidden behind another tab of their Ghostty window
|
|
23
|
+
- covers Pi sessions and other terminal agents (Claude Code, Codex, Gemini and more) found in Ghostty tabs
|
|
24
|
+
- restores tiled windows left at the wrong height when its reserved band appears or disappears
|
|
25
|
+
- draws itself in Ghostty's own theme and follows the desktop between light and dark
|
|
26
|
+
- sits on the same gap rhythm and corner radius as tiled windows, rather than as a bar on the screen edge
|
|
23
27
|
- aggregates independent publishers beneath stable terminal cards
|
|
28
|
+
- shows the AK task a session is working on: read-only `ak` output is joined onto cards, clicking the task reference focuses the claiming terminal, and claims that outlive their session or deferred tasks appear as non-clickable badges
|
|
24
29
|
- displays repo, phase, tool, detail, elapsed time, and freshness
|
|
25
|
-
- marks the exact currently focused terminal card
|
|
30
|
+
- marks the exact currently focused terminal card and prefixes hidden-tab cards with `⧉`
|
|
26
31
|
- keeps monitoring-success cards beside the Activity tile, then active and settled cards
|
|
27
32
|
- expands rich details on hover or keyboard focus
|
|
28
33
|
- supports Left/Right navigation and Shift+Left/Right manual movement
|
|
29
|
-
- focuses the exact matching Ghostty window on click or Enter
|
|
34
|
+
- focuses the exact matching Ghostty window on click or Enter, presenting a hidden tab first
|
|
30
35
|
- hides completely on workspaces without tracked cards
|
|
31
36
|
- releases its 84px exclusive zone automatically when hidden or crashed
|
|
32
37
|
|
|
@@ -43,7 +48,7 @@ Pi publisher streams
|
|
|
43
48
|
|
|
44
49
|
Layer-shell replaces the old floating Electron window and dynamic Niri-config strut helper. The package no longer edits `~/.config/niri/config.kdl`, resets tiled heights, or requires Electron.
|
|
45
50
|
|
|
46
|
-
The compact surface is 84px tall. One engaged card expands the surface to
|
|
51
|
+
The compact surface is 84px tall and sits inset by an 8px margin on the top, left and right, matching the compositor's window gaps, with the same 12px corner radius as tiled windows. It therefore reserves 92px in total. One engaged card expands the surface to 276px while the reservation is unchanged, so detail overlays content without repeatedly resizing tiled windows.
|
|
47
52
|
|
|
48
53
|
## Supported host
|
|
49
54
|
|
|
@@ -91,6 +96,7 @@ node ./bin/pi-activity-strip.mjs focus-session <full-pi-session-id>
|
|
|
91
96
|
node ./bin/pi-activity-strip.mjs status
|
|
92
97
|
node ./bin/pi-activity-strip.mjs doctor
|
|
93
98
|
node ./bin/pi-activity-strip.mjs snapshot
|
|
99
|
+
node ./bin/pi-activity-strip.mjs claude-hooks
|
|
94
100
|
node ./bin/pi-activity-strip.mjs stop
|
|
95
101
|
```
|
|
96
102
|
|
|
@@ -114,6 +120,14 @@ The shortcut toggles exclusive keyboard mode. On entry, the first card is select
|
|
|
114
120
|
- **Hide/reclaim:** zero cards unmaps the layer surface. Niri then removes its exclusive zone as part of normal Wayland surface lifecycle.
|
|
115
121
|
- **Crash behavior:** panel lifetime is bound to the Node controller through Linux parent-death signaling and stdin EOF. Unexpected panel exits are restarted with bounded backoff; a dead surface cannot retain an exclusive zone.
|
|
116
122
|
- **Exact focus:** card activation returns to Node, which performs existing fail-closed terminal identity resolution and Niri focus.
|
|
123
|
+
- **Hidden tabs:** a Ghostty window title only names its active tab. A bound surface whose title is not visible is placed through its Ghostty host process: one host window is exact containment; several host windows use the window remembered for that tab. Memory comes from titles seen while the strip runs and from a read-only AT-SPI inventory of tab labels, and is persisted per Niri instance under `~/.pi/agent/state/pi-activity-strip/surface-bindings.json`. A tab whose window has never been observed stays unplaced rather than guessed; `status` reports that count. Activating a hidden-tab card calls the host process's `present-surface` action on the session bus, then focuses the window, and reports success only after the title proves the tab is visible.
|
|
124
|
+
- **Agent tabs:** a tab is admitted as an agent when the process owning its terminal is a recognized agent CLI, never on a window title alone, so plain terminal programs are not cards. Claude Code tabs are identified exactly through the per-session scratchpad the process holds open, which yields the session id and the title Claude Code put on the terminal; that title places the tab in its window and is remembered so the tab stays placed once hidden.
|
|
125
|
+
- **AK task references:** cards can show the Agent Kernel task their session is working on. The controller reads the read-only `ak` CLI (`ak task list --status claimed --format json --all --verbose` and `ak task deferred --format json --all`) on a calm 15-second clock and joins claims by exact Pi session id under the AK5700 claim semantics: only `session-<uuid>` claims count, and an expired lease is vacant custody that renders nothing. A card whose session holds a live claim shows a clickable `AK #id · title` chip that reuses the card's own activation, so clicking it focuses the exact Ghostty window of the claiming session, presenting hidden tabs first. Claims whose lease has not lapsed but whose claiming session no longer exists ("claim outlives session") and tasks carrying an active deferral are joined by task repo onto cards working inside that repo and render as inert badges, never buttons — there is no live window to focus and no AK action is ever offered. Ambiguous session matches (one logical session resumed into two terminals), a missing `ak` binary, or malformed output bind nothing: fail closed, no chip, no invented state, strip behavior unchanged. The strip never writes AK state and never touches the society database directly.
|
|
126
|
+
- **Codex telemetry:** Codex keeps a thread index naming every session's rollout file, working directory and title. A process binds to its thread by an open rollout descriptor, or, before any task has run, by being the only session created in that directory after the process started; anything ambiguous binds nothing. The rollout tail then reports the running tool and its command, turn count, approval and sandbox policy, prompt and reply. Reading the index needs the runtime's built-in SQLite, and a host without it degrades to a process-only card.
|
|
127
|
+
- **Claude Code telemetry:** cards read live state from the tail of the session transcript, giving the topic, current tool and its target, last prompt, latest reply, turn count and activity clock with no configuration. That format is internal to Claude Code and can change between releases, so a transcript that no longer parses degrades to a process-only card rather than inventing activity. Optional hooks add the one state a transcript cannot express, that a session is blocked waiting for you; run `claude-hooks` for the settings fragment. Only low-frequency events are hooked, so nothing runs per tool call. OpenTelemetry is deliberately not used: it reports aggregate usage and cost, not which tool a session is running now.
|
|
128
|
+
- **Appearance:** the ribbon reads the same theme files Ghostty reads. It resolves the `theme` setting for the desktop's current colour scheme, including the `light:…,dark:…` form, and takes colours set directly in the config over the theme file, exactly as Ghostty layers them. State colours reuse the terminal's own meanings, so green is settled, yellow is working, red failed, and the cursor colour marks a session waiting for you. The panel derives every shade from eight named colours, so a theme change is a handful of values and one stylesheet reload rather than a restart. A theme that cannot be read falls back to a neutral palette.
|
|
129
|
+
- **Height repair:** showing or hiding the ribbon changes the output working area, and a window whose height is not automatic keeps the old value. After each change the strip compares window heights before and after, and resets to automatic only those windows still sitting at a height the moving windows just vacated. A height nobody vacated is never touched, each window is reset at most once per height, and a pass is bounded.
|
|
130
|
+
- **Two identity keys:** a Ghostty surface id is a per-process handle that can drift away from the value a long-lived Pi process captured at startup, while the 32-hex session token in the same title never does. Memory therefore stores both, and lookups prefer the exact surface. A session token that two windows claim is ambiguous and binds nothing; two terminals resuming one logical session in the same window are both placed there.
|
|
117
131
|
- **Ordering:** monitoring, active, and settled groups refresh on a calm 15-second clock. Manual moves survive until regroup or restart.
|
|
118
132
|
- **Accessibility:** cards expose native GTK labels, selected/expanded state, activation descriptions, and GTK accessible announcements.
|
|
119
133
|
|
|
@@ -123,6 +137,15 @@ The shortcut toggles exclusive keyboard mode. On entry, the first card is select
|
|
|
123
137
|
- `PI_ACTIVITY_STRIP_CLICK_THROUGH=1` installs an empty Wayland input region and disables keyboard entry.
|
|
124
138
|
- `PI_ACTIVITY_STRIP_NATIVE_PANEL_BIN=/absolute/path` selects another receipted panel artifact.
|
|
125
139
|
- `PI_ACTIVITY_STRIP_SOCKET_DIR` and `PI_ACTIVITY_STRIP_SOCKET_PATH` isolate broker fixtures and nested-compositor tests.
|
|
140
|
+
- `PI_ACTIVITY_STRIP_TAB_INVENTORY=0` disables the read-only AT-SPI tab inventory; hidden tabs are then placed only from titles seen while the strip runs.
|
|
141
|
+
- `PI_ACTIVITY_STRIP_AK_TASKS=0` disables AK task reference joining.
|
|
142
|
+
- `PI_ACTIVITY_STRIP_AK_BIN=/absolute/path` selects the `ak` binary used for the read-only task queries (default `ak` on `PATH`).
|
|
143
|
+
- `PI_ACTIVITY_STRIP_AGENT_TABS=0` disables discovery of non-Pi agent tabs.
|
|
144
|
+
- `PI_ACTIVITY_STRIP_AGENT_KINDS_DISABLED=claude,codex` excludes named agent kinds from discovery.
|
|
145
|
+
- `CODEX_HOME` selects a non-default Codex home when reading its thread index (default `~/.codex`).
|
|
146
|
+
- `PI_ACTIVITY_STRIP_PYTHON` selects the interpreter for the tab inventory (default `python3`).
|
|
147
|
+
- `PI_ACTIVITY_STRIP_HEIGHT_REPAIR=0` disables restoring windows stranded at the previous working-area height.
|
|
148
|
+
- `PI_ACTIVITY_STRIP_COLOR_SCHEME=light|dark` pins the ribbon to one scheme instead of following the desktop.
|
|
126
149
|
|
|
127
150
|
Unverified native binaries are rejected unless `PI_ACTIVITY_STRIP_ALLOW_UNVERIFIED_PANEL=1` is explicitly set for development fixtures.
|
|
128
151
|
|
|
@@ -159,14 +182,26 @@ Implemented:
|
|
|
159
182
|
- workspace-local Niri projection
|
|
160
183
|
- hide/reclaim and restore
|
|
161
184
|
- pointer and keyboard card interaction
|
|
162
|
-
- exact Ghostty activation
|
|
185
|
+
- exact Ghostty activation, including hidden tabs via `present-surface`
|
|
186
|
+
- hidden Ghostty tab placement through host process containment and learned window memory
|
|
187
|
+
- clickable AK task references joined from read-only `ak` output, with claim-outlives-session and deferred badges
|
|
188
|
+
- non-Pi agent tab discovery with an exact Claude Code adapter
|
|
189
|
+
- live Claude Code telemetry from its transcript, with optional hooks for blocked-on-you states
|
|
190
|
+
- live Codex telemetry from its thread index and rollout files
|
|
191
|
+
- Ghostty theme following, light and dark
|
|
192
|
+
- repair of windows stranded at the previous working-area height
|
|
163
193
|
- bounded panel restart and parent-death cleanup
|
|
164
194
|
- click-through input region
|
|
165
195
|
|
|
166
196
|
Not implemented:
|
|
167
197
|
|
|
198
|
+
- placement of a tab whose window has never been observed, on a host without the AT-SPI inventory (Ghostty exposes no surface listing of its own)
|
|
199
|
+
- distinguishing two terminals that resume one logical session when only the drifted session token is available; both are placed in the one window that claims that token
|
|
200
|
+
- live phase and tool detail for agents other than Claude Code and Codex, which have no adapter yet; their cards show the agent, directory, elapsed time and pid
|
|
201
|
+
- placement of an agent other than Claude Code whose tab is hidden inside a multi-window Ghostty process, since only Claude Code exposes a per-tab title identity
|
|
168
202
|
- one panel per output
|
|
169
203
|
- historical timeline
|
|
204
|
+
- any AK mutation from the strip (unclaim, land, reconstruct, apply); the ribbon is a read-only projection by construction
|
|
170
205
|
- persisted manual ordering
|
|
171
206
|
- remote observers via `pi-server`
|
|
172
207
|
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// ---
|
|
3
|
+
// summary: "Claude Code hook entrypoint that records one session's live state for the activity ribbon"
|
|
4
|
+
// read_when:
|
|
5
|
+
// - "changing how Claude Code sessions publish live state to the ribbon"
|
|
6
|
+
// ---
|
|
7
|
+
|
|
8
|
+
// Claude Code runs this for each configured hook event and waits for it, so it must be cheap and
|
|
9
|
+
// must never fail the session: every path exits 0 and nothing is written to stdout.
|
|
10
|
+
|
|
11
|
+
import fs from "node:fs";
|
|
12
|
+
import {
|
|
13
|
+
CLAUDE_EVENT_DIR,
|
|
14
|
+
claudeEventPath,
|
|
15
|
+
claudeEventRecord,
|
|
16
|
+
isSessionEndEvent,
|
|
17
|
+
} from "../src/common/claude-events.mjs";
|
|
18
|
+
|
|
19
|
+
const STDIN_LIMIT_BYTES = 1024 * 1024;
|
|
20
|
+
|
|
21
|
+
async function readPayload() {
|
|
22
|
+
const chunks = [];
|
|
23
|
+
let total = 0;
|
|
24
|
+
for await (const chunk of process.stdin) {
|
|
25
|
+
total += chunk.length;
|
|
26
|
+
if (total > STDIN_LIMIT_BYTES) break;
|
|
27
|
+
chunks.push(chunk);
|
|
28
|
+
}
|
|
29
|
+
try {
|
|
30
|
+
return JSON.parse(Buffer.concat(chunks).toString("utf8"));
|
|
31
|
+
} catch {
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
async function main() {
|
|
37
|
+
const payload = await readPayload();
|
|
38
|
+
if (!payload || typeof payload !== "object") return;
|
|
39
|
+
const record = claudeEventRecord(payload, { env: process.env });
|
|
40
|
+
if (!record) return;
|
|
41
|
+
const filePath = claudeEventPath(record.sessionId);
|
|
42
|
+
if (!filePath) return;
|
|
43
|
+
|
|
44
|
+
if (isSessionEndEvent(record)) {
|
|
45
|
+
try {
|
|
46
|
+
fs.unlinkSync(filePath);
|
|
47
|
+
} catch {
|
|
48
|
+
// The session never published, or another hook already retired it.
|
|
49
|
+
}
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const temporaryPath = `${filePath}.tmp.${process.pid}`;
|
|
54
|
+
try {
|
|
55
|
+
fs.mkdirSync(CLAUDE_EVENT_DIR, { recursive: true, mode: 0o700 });
|
|
56
|
+
fs.writeFileSync(temporaryPath, JSON.stringify(record), { mode: 0o600 });
|
|
57
|
+
fs.renameSync(temporaryPath, filePath);
|
|
58
|
+
} catch {
|
|
59
|
+
try {
|
|
60
|
+
fs.unlinkSync(temporaryPath);
|
|
61
|
+
} catch {
|
|
62
|
+
// Nothing was staged.
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
main()
|
|
68
|
+
.catch(() => {})
|
|
69
|
+
.finally(() => {
|
|
70
|
+
process.exitCode = 0;
|
|
71
|
+
});
|
|
@@ -34,7 +34,7 @@ const runtimeLockPath = path.join(ACTIVITY_STRIP_SOCKET_DIR, "runtime.lock");
|
|
|
34
34
|
|
|
35
35
|
function usage() {
|
|
36
36
|
console.log(
|
|
37
|
-
`Usage: pi-activity-strip <open|focus-strip|focus-session|status|doctor|snapshot|fix-top|stop|serve> [options]\n\nCommands:\n open Start the interactive top-row activity strip (--click-through opts out)\n focus-strip Focus the visible strip already resident on the focused Niri workspace\n focus-session ID Focus the one Ghostty/Niri window matching an exact Pi session identity\n status Check broker + overlay readiness and surface runtime warnings\n doctor Inspect host compatibility assumptions before opening the strip\n snapshot Print the current broker snapshot as JSON\n fix-top Confirm compositor-owned layer-shell placement\n stop Ask the running strip to shut down\n serve Internal helper; starts the native runtime in the foreground\n`,
|
|
37
|
+
`Usage: pi-activity-strip <open|focus-strip|focus-session|status|doctor|snapshot|claude-hooks|fix-top|stop|serve> [options]\n\nCommands:\n open Start the interactive top-row activity strip (--click-through opts out)\n focus-strip Focus the visible strip already resident on the focused Niri workspace\n focus-session ID Focus the one Ghostty/Niri window matching an exact Pi session identity\n status Check broker + overlay readiness and surface runtime warnings\n doctor Inspect host compatibility assumptions before opening the strip\n snapshot Print the current broker snapshot as JSON\n claude-hooks Print the Claude Code settings fragment for live agent telemetry\n fix-top Confirm compositor-owned layer-shell placement\n stop Ask the running strip to shut down\n serve Internal helper; starts the native runtime in the foreground\n`,
|
|
38
38
|
);
|
|
39
39
|
}
|
|
40
40
|
|
|
@@ -208,6 +208,27 @@ async function main() {
|
|
|
208
208
|
}
|
|
209
209
|
return;
|
|
210
210
|
}
|
|
211
|
+
case "claude-hooks": {
|
|
212
|
+
const { claudeHookSettings } = await import("../src/common/claude-hook-config.mjs");
|
|
213
|
+
const hookPath = path.join(
|
|
214
|
+
path.dirname(fileURLToPath(import.meta.url)),
|
|
215
|
+
"pi-activity-strip-claude-hook.mjs",
|
|
216
|
+
);
|
|
217
|
+
const settings = claudeHookSettings(`${process.execPath} ${hookPath}`);
|
|
218
|
+
if (jsonOutput) {
|
|
219
|
+
console.log(JSON.stringify(settings, null, 2));
|
|
220
|
+
} else {
|
|
221
|
+
console.log(
|
|
222
|
+
"Merge this into ~/.claude/settings.json so Claude Code sessions report live state:\n",
|
|
223
|
+
);
|
|
224
|
+
console.log(JSON.stringify(settings, null, 2));
|
|
225
|
+
console.log(
|
|
226
|
+
"\nOnly low-frequency events are hooked, so nothing runs per tool call. Tool and thinking",
|
|
227
|
+
);
|
|
228
|
+
console.log("state already come from the transcript without any configuration.");
|
|
229
|
+
}
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
211
232
|
case "fix-top":
|
|
212
233
|
console.log("Native layer-shell placement is compositor-owned; no repair was needed.");
|
|
213
234
|
process.exitCode = 0;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schema": "pi-activity-strip-native-artifact.v1",
|
|
3
3
|
"target": "x86_64-unknown-linux-gnu",
|
|
4
|
-
"sha256": "
|
|
4
|
+
"sha256": "999724e6bb34a0cceea631d1cbe58541f20221291b3e9d065e9bb19e193a3b27",
|
|
5
5
|
"cargoLockSha256": "f8ebc11bc721c569af982169e448a5ea4fed15bc06001017d97acda22b1c890b",
|
|
6
|
-
"sourceSha256": "
|
|
6
|
+
"sourceSha256": "1fa65ddf13e1a3c1267081de641e65617822fd409c88e865fec6f769b8161a35",
|
|
7
7
|
"rustc": "rustc 1.98.0 (88d9e12ae 2026-08-18)",
|
|
8
8
|
"glibcFloor": "GLIBC_2.34",
|
|
9
9
|
"neededSonames": [
|
|
Binary file
|
package/native/panel/src/app.rs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
use crate::card_view::CardView;
|
|
2
2
|
use crate::protocol::{Card, ViewMessage, demo_view, emit, emit_error, emit_ready};
|
|
3
|
-
use crate::runtime::{duplicate_labels, install_css, now_ms, start_input_reader};
|
|
3
|
+
use crate::runtime::{apply_theme, duplicate_labels, install_css, now_ms, start_input_reader};
|
|
4
4
|
use gtk4_layer_shell::{Edge, KeyboardMode, Layer, LayerShell};
|
|
5
5
|
use relm4::gtk;
|
|
6
6
|
use relm4::gtk::glib;
|
|
@@ -11,7 +11,10 @@ use std::collections::{HashMap, HashSet};
|
|
|
11
11
|
use std::time::Duration;
|
|
12
12
|
|
|
13
13
|
const COMPACT_HEIGHT: i32 = 84;
|
|
14
|
-
|
|
14
|
+
/// The ribbon sits on the same rhythm as tiled windows, so it reads as one of them rather than as
|
|
15
|
+
/// a bar bolted to the top edge. Matches `gaps` in the compositor's layout.
|
|
16
|
+
const OUTER_MARGIN: i32 = 8;
|
|
17
|
+
const EXPANDED_HEIGHT: i32 = 276;
|
|
15
18
|
const ORDER_REFRESH_MS: i64 = 15_000;
|
|
16
19
|
|
|
17
20
|
pub struct AppInit {
|
|
@@ -38,6 +41,7 @@ pub struct App {
|
|
|
38
41
|
#[derive(Debug)]
|
|
39
42
|
pub enum AppMsg {
|
|
40
43
|
View(ViewMessage),
|
|
44
|
+
Theme(String),
|
|
41
45
|
Tick,
|
|
42
46
|
Hover(String, bool),
|
|
43
47
|
Focus(String, bool),
|
|
@@ -69,36 +73,27 @@ impl Component for App {
|
|
|
69
73
|
|
|
70
74
|
#[name = "body"]
|
|
71
75
|
gtk::Box {
|
|
76
|
+
add_css_class: "band",
|
|
72
77
|
set_orientation: gtk::Orientation::Horizontal,
|
|
73
|
-
set_spacing:
|
|
74
|
-
set_margin_top: 4,
|
|
75
|
-
set_margin_bottom: 6,
|
|
76
|
-
set_margin_start: 10,
|
|
77
|
-
set_margin_end: 10,
|
|
78
|
+
set_spacing: 0,
|
|
78
79
|
|
|
79
80
|
#[name = "brand"]
|
|
80
81
|
gtk::Box {
|
|
81
82
|
add_css_class: "brand",
|
|
82
83
|
set_orientation: gtk::Orientation::Vertical,
|
|
83
|
-
set_width_request:
|
|
84
|
-
|
|
84
|
+
set_width_request: 132,
|
|
85
|
+
set_valign: gtk::Align::Center,
|
|
85
86
|
|
|
86
87
|
gtk::Label {
|
|
87
88
|
add_css_class: "brand-eyebrow",
|
|
88
|
-
set_label: "π
|
|
89
|
+
set_label: "π ACTIVITY",
|
|
89
90
|
set_halign: gtk::Align::Start,
|
|
90
91
|
},
|
|
91
92
|
gtk::Label {
|
|
92
93
|
add_css_class: "brand-title",
|
|
93
|
-
set_label: "
|
|
94
|
-
set_halign: gtk::Align::Start,
|
|
95
|
-
},
|
|
96
|
-
gtk::Label {
|
|
97
|
-
add_css_class: "brand-subtitle",
|
|
98
|
-
set_label: "Calm order · live detail",
|
|
94
|
+
set_label: "Sessions",
|
|
99
95
|
set_halign: gtk::Align::Start,
|
|
100
96
|
},
|
|
101
|
-
gtk::Box { set_vexpand: true },
|
|
102
97
|
#[name = "meta"]
|
|
103
98
|
gtk::Label {
|
|
104
99
|
add_css_class: "meta",
|
|
@@ -118,7 +113,9 @@ impl Component for App {
|
|
|
118
113
|
set_orientation: gtk::Orientation::Horizontal,
|
|
119
114
|
set_spacing: 8,
|
|
120
115
|
set_halign: gtk::Align::Start,
|
|
121
|
-
set_valign: gtk::Align::
|
|
116
|
+
set_valign: gtk::Align::Center,
|
|
117
|
+
set_margin_top: 8,
|
|
118
|
+
set_margin_bottom: 8,
|
|
122
119
|
}
|
|
123
120
|
}
|
|
124
121
|
}
|
|
@@ -141,8 +138,9 @@ impl Component for App {
|
|
|
141
138
|
root.set_anchor(Edge::Top, true);
|
|
142
139
|
root.set_anchor(Edge::Left, true);
|
|
143
140
|
root.set_anchor(Edge::Right, true);
|
|
144
|
-
root.set_margin(Edge::
|
|
145
|
-
root.set_margin(Edge::
|
|
141
|
+
root.set_margin(Edge::Top, OUTER_MARGIN);
|
|
142
|
+
root.set_margin(Edge::Left, OUTER_MARGIN);
|
|
143
|
+
root.set_margin(Edge::Right, OUTER_MARGIN);
|
|
146
144
|
root.set_exclusive_zone(COMPACT_HEIGHT);
|
|
147
145
|
root.set_keyboard_mode(KeyboardMode::None);
|
|
148
146
|
if init.click_through {
|
|
@@ -202,6 +200,7 @@ impl Component for App {
|
|
|
202
200
|
) {
|
|
203
201
|
match message {
|
|
204
202
|
AppMsg::View(view) => self.apply_view(widgets, root, &sender, view),
|
|
203
|
+
AppMsg::Theme(definitions) => apply_theme(&definitions),
|
|
205
204
|
AppMsg::Tick => {
|
|
206
205
|
if now_ms() >= self.next_order_refresh_at {
|
|
207
206
|
self.regroup();
|
|
@@ -407,6 +406,7 @@ impl App {
|
|
|
407
406
|
self.end_engagement();
|
|
408
407
|
root.set_keyboard_mode(KeyboardMode::None);
|
|
409
408
|
self.apply_expansion(widgets, root, None);
|
|
409
|
+
root.set_exclusive_zone(-1);
|
|
410
410
|
root.set_visible(false);
|
|
411
411
|
}
|
|
412
412
|
emit(
|