Compare commits
51 commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 1294ba741a | |||
| 6ea44ac60c | |||
| 56399996f5 | |||
| 2b1f67b1ea | |||
| 71f942ff36 | |||
| 7968270aa4 | |||
| b406970b93 | |||
| d75ba7fff6 | |||
| 98307b8a2e | |||
| 6c4fa04221 | |||
| b6fe86f418 | |||
| 3d41f39ad9 | |||
| c9f3b6b1ad | |||
| bb792cee95 | |||
| 376c6442f9 | |||
| 7b3a25eaaf | |||
| ec8d208f35 | |||
| 6796a44802 | |||
| 306cedfd68 | |||
| 189a52798b | |||
| 7abd247247 | |||
| 452fb171a6 | |||
| 0e9c83f2d8 | |||
| 72a2d073e2 | |||
| 28b68b4dc4 | |||
| 8943136384 | |||
| 43a68e7970 | |||
|
|
3fff367364 | ||
| 40722526d4 | |||
| 77f26422bf | |||
| 9f60f42071 | |||
| 885e64ff85 | |||
| a055dc5f2b | |||
| d861bbac4d | |||
| 2dc15a4849 | |||
| 107de1c3ff | |||
| aa56cac958 | |||
| e2972de37a | |||
| 6f0f7db513 | |||
| 7a203c70a7 | |||
| ffa1a407fe | |||
| b41c9662cb | |||
| 3f32c19fd0 | |||
| 332ec4064a | |||
| e7b0392d92 | |||
| 46ce549b2f | |||
| 764911b32d | |||
| 945ad61bf7 | |||
| 42230470fc | |||
| 8a7091755b | |||
| a4a6f1a3f9 |
6
.github/workflows/ci.yml
vendored
|
|
@ -15,7 +15,7 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v7
|
||||
|
||||
- name: Install system dependencies
|
||||
run: |
|
||||
|
|
@ -28,7 +28,7 @@ jobs:
|
|||
components: rustfmt, clippy
|
||||
|
||||
- name: Cache cargo registry
|
||||
uses: actions/cache@v4
|
||||
uses: actions/cache@v6
|
||||
with:
|
||||
path: |
|
||||
~/.cargo/registry
|
||||
|
|
@ -54,7 +54,7 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v7
|
||||
|
||||
- name: Install glib-compile-schemas
|
||||
run: sudo apt-get update -q && sudo apt-get install -y libglib2.0-bin
|
||||
|
|
|
|||
40
.github/workflows/eslint.yml
vendored
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
name: ESLint
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ 'main' ]
|
||||
pull_request:
|
||||
branches: [ 'main' ]
|
||||
schedule:
|
||||
- cron: '33 14 * * 5'
|
||||
|
||||
jobs:
|
||||
eslint:
|
||||
name: Run eslint scanning
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
security-events: write
|
||||
# Required for private repositories by github/codeql-action/upload-sarif
|
||||
actions: read
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v7
|
||||
|
||||
- name: Install
|
||||
run: |
|
||||
npm install eslint@^10.0.0 @eslint/js@^10.0.0
|
||||
npm install @microsoft/eslint-formatter-sarif@2.1.7
|
||||
|
||||
- name: Lint
|
||||
run: >
|
||||
npx eslint .
|
||||
--format @microsoft/eslint-formatter-sarif
|
||||
--output-file eslint-results.sarif
|
||||
continue-on-error: true
|
||||
|
||||
- name: Report
|
||||
uses: github/codeql-action/upload-sarif@v4
|
||||
with:
|
||||
sarif_file: eslint-results.sarif
|
||||
wait-for-processing: true
|
||||
8
.gitignore
vendored
|
|
@ -4,12 +4,18 @@ strata-daemon/target/
|
|||
# Bundled binary (no longer shipped - daemon must be installed separately)
|
||||
strata@edu4rdshl.dev/bin/
|
||||
|
||||
# Screenshots / scratch images
|
||||
# Screenshots / scratch images (project assets under assets/ are kept)
|
||||
*.png
|
||||
!assets/*.png
|
||||
|
||||
# External reference code (not part of this project)
|
||||
external_sources/
|
||||
|
||||
# Node / lint tooling
|
||||
node_modules/
|
||||
package-lock.json
|
||||
*.shell-extension.zip
|
||||
|
||||
# Editor / OS
|
||||
.vscode/
|
||||
.idea/
|
||||
|
|
|
|||
77
AGENTS.md
|
|
@ -13,6 +13,13 @@ contrib/systemd/ systemd user service unit for distro packaging
|
|||
ARCHITECTURE.md In-depth design document
|
||||
```
|
||||
|
||||
## Upstream guidelines
|
||||
|
||||
- EGO review: https://gjs.guide/extensions/review-guidelines/review-guidelines.html
|
||||
- GJS D-Bus: https://gjs.guide/guides/gio/dbus.html
|
||||
|
||||
The conventions in this file follow both.
|
||||
|
||||
## Core principle
|
||||
|
||||
"JS draws, Rust thinks." The extension must never block the GNOME Shell
|
||||
|
|
@ -62,7 +69,9 @@ ssh fedoradev 'glib-compile-schemas ~/.local/share/gnome-shell/extensions/strata
|
|||
| `strata-daemon/src/db.rs` | SQLite schema, FTS5, insert, prune, search, thumbnail |
|
||||
| `strata-daemon/src/config.rs` | Data dir, DB path (`~/.local/share/strata/clipboard.db`) |
|
||||
| `strata@edu4rdshl.dev/extension.js` | Daemon lifecycle (PATH lookup + systemd detection), clipboard ingest, focus tracking, `_pushConfig` |
|
||||
| `strata@edu4rdshl.dev/ui/panel.js` | Popup panel, lazy-load pagination, search, `_pageSize` |
|
||||
| `strata@edu4rdshl.dev/ui/panel.js` | Popup panel, lazy-load pagination, search, `_pageSize`, theme class toggle (`_applyTheme`) |
|
||||
| `strata@edu4rdshl.dev/stylesheet.css` | Dark theme (default, auto-loaded by GNOME) |
|
||||
| `strata@edu4rdshl.dev/light.css` | Light theme overrides, scoped under `.strata-theme-light` |
|
||||
| `strata@edu4rdshl.dev/ui/clipboardItem.js` | Individual row widget |
|
||||
| `strata@edu4rdshl.dev/prefs.js` | Preferences window (Adw) |
|
||||
| `strata@edu4rdshl.dev/dbus.js` | D-Bus proxy definition and XML interface |
|
||||
|
|
@ -70,7 +79,7 @@ ssh fedoradev 'glib-compile-schemas ~/.local/share/gnome-shell/extensions/strata
|
|||
|
||||
## D-Bus interface summary
|
||||
|
||||
Service `org.gnome.Strata`, object `/org/gnome/Strata`, interface `org.gnome.Strata.Manager`.
|
||||
Service `dev.edu4rdshl.Strata`, object `/dev/edu4rdshl/Strata`, interface `dev.edu4rdshl.Strata.Manager`.
|
||||
|
||||
Methods: `GetHistory(offset u32, limit u32) -> json s`,
|
||||
`SearchHistory(query s, limit u32) -> json s`,
|
||||
|
|
@ -84,16 +93,76 @@ Signals: `ItemAdded(id s, mime_type s, preview s)`, `ItemDeleted(id s)`, `Histor
|
|||
|
||||
## GSettings keys
|
||||
|
||||
`max-history`, `page-size`, `max-text-mb`, `max-image-mb`, `panel-position`,
|
||||
`max-history`, `page-size`, `max-text-mb`, `max-image-mb`, `theme`, `panel-position`,
|
||||
`panel-width`, `panel-max-height`, `keyboard-shortcut`, `move-activated-to-top`,
|
||||
`excluded-apps`.
|
||||
|
||||
`theme` is `auto`/`light`/`dark`. `auto` follows `org.gnome.desktop.interface
|
||||
color-scheme`. Light styling lives in `light.css`, scoped under a
|
||||
`.strata-theme-light` class the panel toggles on its root box; `extension.js`
|
||||
loads/unloads `light.css` via the St theme context. New non-`stylesheet.css`
|
||||
CSS files must be added to the `pack` target as `--extra-source` (only
|
||||
`stylesheet.css` is auto-included by `gnome-extensions pack`).
|
||||
|
||||
## Conventions
|
||||
|
||||
- No `--` em-dashes, no emojis in code comments or docs.
|
||||
- Rust: use `tracing::info!`, `tracing::warn!`, `tracing::error!` (qualified path, not bare imports). No `println!` in daemon code.
|
||||
- GJS: `console.log('[Strata] ...')` / `console.error('[Strata] ...')` prefix for all extension logs.
|
||||
- GJS: route all errors through the `logError(label, err)` helper at the top
|
||||
of `extension.js` and `ui/panel.js`. It prepends `[Strata]` and strips the
|
||||
`GDBus.Error:` prefix from D-Bus errors. Do not call `console.error`
|
||||
directly. Do not use `console.log` for normal flow events; only errors
|
||||
should appear in the journal.
|
||||
- Size limits travel as bytes over D-Bus. MB conversion happens extension-side.
|
||||
- `Ordering::Relaxed` is intentional on `Arc<AtomicUsize>` limits (advisory, not critical path).
|
||||
- Never execute clipboard content. Writes go through `wl-clipboard-rs` (`copy_multi`) in the daemon, never via shell subprocess or `eval`.
|
||||
- Excluded apps list is checked before storing any clipboard item.
|
||||
- Ingest paths are mutually exclusive by environment: on GNOME the monitor cannot bind (Mutter exposes neither data-control protocol) so ingest is GJS `SubmitItem`; on wlroots the built-in monitor is the path.
|
||||
- List queries (`get_history_page`, `search_history`) return `content_text` truncated to `PREVIEW_CHARS` via `substr`; full content is served only by `GetItemContent` for paste-back.
|
||||
|
||||
## D-Bus client conventions
|
||||
|
||||
- Use the `makeProxyWrapper` proxy from `dbus.js`. Do not construct
|
||||
`Gio.DBusProxy` directly elsewhere.
|
||||
- Method calls: `*Async` for await-style, `*Remote` for fire-and-forget.
|
||||
Never call a synchronous variant.
|
||||
- Signal subscriptions: `this._proxy.connectSignal('Name', handler)` paired
|
||||
with `disconnectSignal(id)` in `_disconnectSignals`. Do not use the
|
||||
low-level `Gio.DBus.session.signal_subscribe`.
|
||||
- Monitor `notify::g-name-owner` on the proxy to react to daemon
|
||||
availability (initial load, config re-push after respawn).
|
||||
|
||||
## Extension lifecycle (disable cleanup)
|
||||
|
||||
Every resource opened while enabled must be released in `disable()` or in a
|
||||
helper called from `disable()`. The EGO static analyzer (shexli) flags
|
||||
implicit cleanup as a warning, so be explicit:
|
||||
|
||||
- Every `obj.connect('signal', ...)` must store its ID; `disable()` must
|
||||
call `obj.disconnect(id)`, even on actors that get `destroy()`ed.
|
||||
- Every `GLib.timeout_add(...)` must store its source ID so it can be
|
||||
removed in `disable()` (or in the fire callback for one-shot sources).
|
||||
- Every `GLib.idle_add(...)` must go through `this._addIdleSource(callback)`,
|
||||
which tracks the source ID in `_idleSources`. `_clearIdleSources()` flushes
|
||||
pending sources in `disable()`.
|
||||
- Every `proxy.connectSignal(...)` must be paired with `disconnectSignal`.
|
||||
|
||||
## EGO submission
|
||||
|
||||
Before submitting to extensions.gnome.org, pack and run the `shexli` static
|
||||
analyzer:
|
||||
|
||||
```sh
|
||||
make pack
|
||||
pip install -U shexli
|
||||
shexli strata@edu4rdshl.dev.shell-extension.zip
|
||||
```
|
||||
|
||||
Address any `warning` or `error` findings. A `manual_review` finding is
|
||||
expected for direct `St.Clipboard` access (Strata is a clipboard manager);
|
||||
declare it in the long description on the EGO upload form so the reviewer
|
||||
doesn't have to guess.
|
||||
|
||||
`shell-version` in `metadata.json` must list only Shell versions the
|
||||
extension has actually been tested on. Aspirational entries are a known
|
||||
rejection cause.
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ together and the trade-offs at each layer.
|
|||
| | ItemAdded / ItemDeleted / HistoryCleared |
|
||||
+--------+-------------------------------------------------------------------------+
|
||||
|
|
||||
| session D-Bus (org.gnome.Strata)
|
||||
| session D-Bus (dev.edu4rdshl.Strata)
|
||||
v
|
||||
+----------------------- strata-daemon (Rust process) --------------------------+
|
||||
| |
|
||||
|
|
@ -35,7 +35,7 @@ together and the trade-offs at each layer.
|
|||
| | | SQLite (WAL, FTS5) | |
|
||||
| | +---------------------+ |
|
||||
| v |
|
||||
| image::load_from_memory --> PNG thumbnail (~256 px) |
|
||||
| image::load_from_memory --> PNG thumbnail (~200 px) |
|
||||
| |
|
||||
+-------------------------------------------------------------------------------+
|
||||
```
|
||||
|
|
@ -57,17 +57,31 @@ hot ingest path (it fires `SubmitItem` and returns immediately).
|
|||
`bin/strata-daemon` and registers a watchdog:
|
||||
|
||||
- If the child exits, schedule a respawn with exponential backoff
|
||||
(1 s, 2 s, 4 s, capped at 30 s).
|
||||
- After 5 rapid restarts within 60 s, stop and surface a notification.
|
||||
(1 s, 2 s, 4 s, 8 s, 16 s). A run that lasts at least 5 s resets the
|
||||
counter, so only a rapid crash loop escalates.
|
||||
- After 5 rapid restarts, stop retrying and log an error. (A missing
|
||||
`strata-daemon` binary is reported up front with a desktop notification;
|
||||
the crash-loop give-up is log-only.)
|
||||
- On disable, send `Shutdown` over D-Bus first, then `SIGTERM` if it
|
||||
doesn't exit within 2 s.
|
||||
doesn't exit within 1.5 s.
|
||||
|
||||
### Startup
|
||||
|
||||
The extension listens for `notify::g-name-owner` on the D-Bus proxy. When
|
||||
the daemon's `org.gnome.Strata` name becomes owned, the panel triggers
|
||||
the daemon's `dev.edu4rdshl.Strata` name becomes owned, the panel triggers
|
||||
its initial fetch. No polling, no fixed delays.
|
||||
|
||||
### Single instance
|
||||
|
||||
Exactly one daemon should serve the bus name. Two layers enforce it: the
|
||||
extension skips spawning when `GetNameOwner` shows the name is already owned
|
||||
(so a daemon started out-of-band, e.g. via a systemd user service, is reused),
|
||||
and the daemon itself requests the name with `DoNotQueue` -- if the name is
|
||||
already taken it errors out and exits rather than queueing or stealing it.
|
||||
It deliberately does not use `ReplaceExisting`: taking the name from a running
|
||||
instance would orphan that instance (zbus does not terminate a replaced owner),
|
||||
so the late starter bows out instead.
|
||||
|
||||
## Ingest path
|
||||
|
||||
```
|
||||
|
|
@ -126,7 +140,7 @@ CREATE TABLE clipboard_history (
|
|||
mime_type TEXT NOT NULL,
|
||||
content_text TEXT, -- one of these two is populated
|
||||
content_blob BLOB, -- (text vs binary)
|
||||
thumbnail_blob BLOB, -- pre-decoded PNG, ~256 px
|
||||
thumbnail_blob BLOB, -- pre-decoded PNG, ~200 px
|
||||
content_hash TEXT NOT NULL, -- blake3 of raw bytes
|
||||
source_app TEXT,
|
||||
created_at INTEGER NOT NULL
|
||||
|
|
@ -182,15 +196,16 @@ search query, not the SQL parser.
|
|||
|
||||
### Pruning
|
||||
|
||||
`upsert_item` checks `COUNT(*) > max_history` after each insert and
|
||||
deletes the oldest excess rows by `created_at ASC`, returning their ids.
|
||||
The D-Bus layer emits `ItemDeleted` for each so the extension can unlink
|
||||
the matching `~/.cache/strata/thumbnails/<id>.png`.
|
||||
After a genuinely new item is inserted, the ingest task calls `prune`,
|
||||
which deletes every row outside the newest `max_history` (by `created_at`)
|
||||
and returns their ids. The D-Bus layer emits `ItemDeleted` for each so the
|
||||
extension can unlink the matching `~/.cache/strata/thumbnails/<id>.png`.
|
||||
|
||||
## Concurrency
|
||||
|
||||
The Rust daemon runs `tokio::main(flavor = "multi_thread")`. zbus
|
||||
dispatches each incoming method call on the executor. rusqlite is sync,
|
||||
The Rust daemon runs on a multi-threaded tokio runtime (`#[tokio::main]`,
|
||||
which defaults to the multi-thread flavor). zbus dispatches each incoming
|
||||
method call on the executor. rusqlite is sync,
|
||||
so every DB call is wrapped:
|
||||
|
||||
```rust
|
||||
|
|
@ -227,14 +242,22 @@ history size.
|
|||
### Paginated history
|
||||
|
||||
`GetHistory(offset, limit)` returns metadata only (id, mime, short text
|
||||
preview, timestamp). The panel loads `page-size` rows on open, then
|
||||
another page each time the scroll position passes ~80 % of the viewport.
|
||||
The Rust side serves these from the `idx_created_at DESC` index with
|
||||
`LIMIT/OFFSET`, which stays O(log n) for any history size.
|
||||
preview, timestamp). The preview is truncated in SQL (`substr`, first
|
||||
~200 chars), so a page of large text items costs a few KB of JSON rather
|
||||
than megabytes; the full payload is only fetched on paste-back via
|
||||
`GetItemContent`. The panel loads `page-size` rows on open, then another
|
||||
page each time the scroll position comes within a fixed threshold (200 px)
|
||||
of the bottom. The Rust side serves these from the `idx_created_at DESC`
|
||||
index with `LIMIT/OFFSET`, which stays O(log n) for any history size.
|
||||
|
||||
Search shortcuts this path: when the search box is non-empty the panel
|
||||
calls `SearchHistory(query, limit)` instead and disables scroll-driven
|
||||
appends, so an in-progress search and a scroll event cannot race.
|
||||
Search uses a parallel path: when the search box is non-empty the panel
|
||||
calls `SearchHistory(query, max-history)`, which returns the full match set
|
||||
(bounded by the configured history size, not an arbitrary cap). The panel
|
||||
snapshots those results and renders them lazily, a page at a time as you
|
||||
scroll -- the same paging mechanism as the recent view, but fed from the
|
||||
in-memory snapshot instead of re-querying. A search epoch plus a
|
||||
results-epoch guard discard stale renders, so a fast new query (or a scroll
|
||||
landing during a query's fetch) can never paint the previous query's rows.
|
||||
|
||||
### On-demand thumbnails
|
||||
|
||||
|
|
@ -270,6 +293,27 @@ image.
|
|||
path in Strata executes clipboard content (no `spawn`, no
|
||||
`launch_uri`, no `show_uri`).
|
||||
|
||||
## Theming
|
||||
|
||||
Light and dark are handled by GNOME Shell's built-in per-variant stylesheet
|
||||
loading, not by any code in the extension. When it enables an extension the
|
||||
Shell loads `stylesheet-<variant>.css`, where the variant comes from
|
||||
`Main.getStyleVariant()` (the shell's own light/dark), and falls back to
|
||||
`stylesheet.css`; it reloads that sheet when the color scheme changes.
|
||||
|
||||
Strata ships two sheets and no `stylesheet.css`:
|
||||
|
||||
- `stylesheet-dark.css` is the full dark theme (the base).
|
||||
- `stylesheet-light.css` does `@import url("stylesheet-dark.css")` and then
|
||||
overrides the colors for a light panel. Its rules follow the import, so they
|
||||
win by load order.
|
||||
|
||||
This is the structure the built-in `window-list` extension uses. Because the
|
||||
variant tracks the *shell* style, the panel matches the shell chrome: a normal
|
||||
session prefers dark, so the panel is dark, and it turns light only when the
|
||||
shell itself is light (a `prefer-light` color scheme, the Classic session, or
|
||||
high contrast). There is no theme setting and no manual stylesheet loading.
|
||||
|
||||
## Wayland clipboard monitor
|
||||
|
||||
The daemon contains a `wl-clipboard-rs` monitor for `ext-data-control-v1`
|
||||
|
|
@ -289,7 +333,7 @@ and it is small and isolated.
|
|||
| App to history | Password leak | `x-kde-passwordManagerHint` opt-out |
|
||||
| User to search | SQL injection | rusqlite `params![]`, FTS5 input bound as value |
|
||||
| Daemon to FS | Path traversal via id | Ids are server-generated UUID v4 |
|
||||
| Daemon to extension | Signal spoofing | D-Bus enforces single owner of `org.gnome.Strata` |
|
||||
| Daemon to extension | Signal spoofing | D-Bus enforces single owner of `dev.edu4rdshl.Strata` |
|
||||
| Stored item to paste | Command execution | No spawn, no launch_uri, no markup parsing |
|
||||
|
||||
## Non-GNOME front-end
|
||||
|
|
|
|||
230
CHANGELOG.md
|
|
@ -6,6 +6,236 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
|||
|
||||
---
|
||||
|
||||
## [0.11.0] - 2026-07-02
|
||||
|
||||
The daemon is unchanged from 0.10.0; all changes are in the GNOME Shell extension.
|
||||
|
||||
### Changed
|
||||
|
||||
- Light and dark styling follows the GNOME Shell style variant via
|
||||
`stylesheet-dark.css` and `stylesheet-light.css`, loaded automatically by the
|
||||
Shell, instead of loading `light.css` into the theme context by hand. The
|
||||
manual theme setting and its preferences row are gone; the panel matches the
|
||||
shell.
|
||||
- Signal connections use `connectObject`/`disconnectObject`.
|
||||
|
||||
### Fixed
|
||||
|
||||
- `disable()` stops the daemon synchronously with `SIGTERM` instead of deferring
|
||||
the kill to a timeout.
|
||||
- The daemon-restart timeout is cleared before a new one is scheduled.
|
||||
- Removed the `try`/`catch` around `send_signal`, which does not throw.
|
||||
|
||||
### Performance
|
||||
|
||||
- The thumbnail cache is cleared asynchronously in batches instead of a
|
||||
synchronous enumerate and delete on the compositor thread.
|
||||
- The thumbnail path cache is pruned on delete and clear-all.
|
||||
- Each row computes its type (image, URL, color) once.
|
||||
|
||||
---
|
||||
|
||||
## [0.10.0] - 2026-06-25
|
||||
|
||||
The daemon is unchanged from 0.9.0; all changes are in the GNOME Shell extension.
|
||||
|
||||
### Fixed
|
||||
|
||||
- URL items now show their hostname as a subtitle. The old code used the WHATWG
|
||||
`URL` API, which GJS does not provide, so it always threw and the subtitle
|
||||
never appeared. It now uses `GLib.Uri`.
|
||||
- The packaged extension was missing `dbus.js`. The extension imports it, but
|
||||
`make pack` did not bundle it, so installing from the packaged zip would
|
||||
fail to load. It is now included.
|
||||
|
||||
### Changed
|
||||
|
||||
- `ClipboardItem` uses a `constructor()` with an explicit `GTypeName` instead of
|
||||
`_init()`.
|
||||
- The error-logging helper lives in a single `util.js` module shared by the
|
||||
extension, panel, and item widget.
|
||||
|
||||
### Internal
|
||||
|
||||
- Adopted the GJS ESLint style guide: an `eslint.config.js` flat config, an
|
||||
`npm run lint` script, and a GitHub Actions workflow that lints on push and
|
||||
pull requests. The extension passes with no warnings.
|
||||
|
||||
---
|
||||
|
||||
## [0.9.0] - 2026-06-25
|
||||
|
||||
The daemon is unchanged from 0.8.0; all changes are in the GNOME Shell extension.
|
||||
|
||||
### Changed
|
||||
|
||||
- App exclusion is enforced before a copy is sent to the daemon, instead of
|
||||
storing the item and deleting it afterward. Excluded content no longer
|
||||
reaches the database, and the focused app is checked at copy time.
|
||||
- The D-Bus client follows the GJS guide: signals are handled through the proxy
|
||||
(`connectSignal`) and D-Bus errors are stripped of their `GDBus.Error` prefix
|
||||
before logging.
|
||||
- `shell-version` declares GNOME Shell 50 only, the version the extension is
|
||||
tested on. Installs on older releases are no longer offered.
|
||||
- The daemon-missing notification points to the project page for install
|
||||
instructions.
|
||||
|
||||
### Fixed
|
||||
|
||||
- The initial history load retries on the next daemon connection if the first
|
||||
fetch fails, instead of leaving the panel empty until it is reopened.
|
||||
- The D-Bus proxy callback is ignored when the extension was disabled (or
|
||||
re-enabled) while the proxy was still being created.
|
||||
- `disable()` disconnects the panel indicator signal and drops pending idle
|
||||
callbacks, so nothing runs against a torn-down extension.
|
||||
|
||||
### Internal
|
||||
|
||||
- Extension logging goes through one helper per file. Removed dead fields,
|
||||
stale comments, and leftover narration flagged by the EGO review guidelines
|
||||
and the shexli static analyzer.
|
||||
|
||||
---
|
||||
|
||||
## [0.8.0] - 2026-05-26
|
||||
|
||||
### Changed
|
||||
|
||||
- Upgraded daemon dependencies: zbus 4 -> 5, rusqlite 0.31 -> 0.40, dirs 5 -> 6.
|
||||
|
||||
### Fixed
|
||||
|
||||
- Single-instance daemon: the bus name is now requested with `DoNotQueue`
|
||||
instead of `ReplaceExisting | AllowReplacement`. If the name is already owned
|
||||
the daemon exits cleanly instead of (a) running without owning it (zbus 5
|
||||
returns `InQueue` as `Ok`) or (b) stealing the name and leaving the previous
|
||||
instance running as an orphan (zbus does not terminate a replaced owner).
|
||||
- Real SQLite errors are no longer swallowed as "not found": `upsert_item`'s
|
||||
dedup lookup and `get_thumbnail` / `get_raw_item` now distinguish a missing
|
||||
row (`Ok(None)`) from a genuine error (propagated), via `optional()`.
|
||||
- Daemon supervisor: a guard prevents spawning two daemons when an in-flight
|
||||
name-owner check overlaps a backoff retry, and the exit handler ignores
|
||||
foreign/stale subprocess exits so restart accounting can't be corrupted.
|
||||
- Panel: clearing history (or a `HistoryCleared` signal) now invalidates the
|
||||
active search snapshot, so scrolling can't render stale rows; the
|
||||
scroll-into-view idle is guarded against a destroyed panel.
|
||||
|
||||
### Internal
|
||||
|
||||
- clippy pedantic/nursery cleanup across the daemon (format args, redundant
|
||||
clone, pass-by-reference, doc backticks), with `#[allow]` + rationale for the
|
||||
intentional lints (the single-writer lock hold, zbus interface `async`).
|
||||
|
||||
---
|
||||
|
||||
## [0.7.0] - 2026-05-26
|
||||
|
||||
### Fixed
|
||||
|
||||
- Theme stylesheet reload no longer recurses. `load_stylesheet` itself emits
|
||||
the St theme context's `changed` signal, so reloading `light.css` on every
|
||||
`changed` fed back into itself and hit "too much recursion" - flooding the
|
||||
journal and spinning the CPU on screen unlock (which restyles widgets and
|
||||
fires `changed`). `light.css` is now loaded once and the `changed`
|
||||
subscription is removed entirely. (Dark/light switching is unaffected - it is
|
||||
the panel's class toggle, not this load. A GNOME Shell *theme* switch no
|
||||
longer auto-re-applies the sheet; that is recoverable by re-enabling.)
|
||||
|
||||
### Changed
|
||||
|
||||
- **BREAKING (D-Bus): the service was renamed from `org.gnome.Strata` to
|
||||
`dev.edu4rdshl.Strata`.** The `org.gnome.*` namespace is reserved for
|
||||
official GNOME software; Strata is a third-party project, so it now uses the
|
||||
reverse-DNS of its own domain (matching the `strata@edu4rdshl.dev` UUID).
|
||||
Bus name, object path (`/dev/edu4rdshl/Strata`), and interface
|
||||
(`dev.edu4rdshl.Strata.Manager`) all changed. The bundled daemon and
|
||||
extension are updated together; only external `busctl` scripts or non-GNOME
|
||||
front-ends that hard-coded the old name need updating. The GSettings schema
|
||||
(`org.gnome.shell.extensions.strata`) is unchanged - that namespace is the
|
||||
correct convention for GNOME Shell extension settings.
|
||||
|
||||
---
|
||||
|
||||
## [0.6.0] - 2026-05-26
|
||||
|
||||
### Added
|
||||
|
||||
- Lazy, full-history search. Search now covers the entire stored history (up
|
||||
to `max-history`) instead of an arbitrary 500-result cap, and renders a page
|
||||
at a time as you scroll instead of building every match at once. Results are
|
||||
snapshotted once and paged from memory, so scrolling never re-queries.
|
||||
|
||||
### Fixed
|
||||
|
||||
- Images other than PNG/JPEG (GIF, WebP, BMP, TIFF, ICO) were silently dropped
|
||||
because the daemon could not decode them. They are now decoded and stored.
|
||||
AVIF and SVG are no longer accepted (not decodable here), rather than
|
||||
accepted-then-dropped.
|
||||
- Search no longer "blinks" (paints an empty list) between keystrokes; the
|
||||
first page renders in the same frame as the clear.
|
||||
- Search render race conditions: a fast new query can no longer be blocked by a
|
||||
superseded render, render a previous query's stale results, or leave a pruned
|
||||
item behind as a phantom row on scroll.
|
||||
- `ItemAdded` preview length now matches the history/search queries (200
|
||||
chars), so a just-copied row and the same row after a reload show the same
|
||||
text.
|
||||
- Deterministic ordering for items that share a millisecond timestamp
|
||||
(`created_at DESC, rowid DESC`), so pruning can't evict the wrong one.
|
||||
- Lowering **max history** now prunes stored items immediately instead of
|
||||
waiting for the next copy.
|
||||
- Extension lifecycle: the `excluded-apps` settings handler and the daemon
|
||||
force-kill timer are now released on disable; the exclusion-path delete is
|
||||
null-guarded.
|
||||
- The daemon requests its bus name with `AllowReplacement` for a clean hand-off
|
||||
on extension reload; the Wayland monitor clears stale offers on clipboard
|
||||
clear.
|
||||
|
||||
### Changed
|
||||
|
||||
- Image rows show a generic "Image" label instead of singling out PNG.
|
||||
|
||||
---
|
||||
|
||||
## [0.5.0] - 2026-05-26
|
||||
|
||||
### Added
|
||||
|
||||
- Light/dark theme support. A new **Theme** preference (Automatic / Light /
|
||||
Dark) controls the panel palette; Automatic follows the system
|
||||
`org.gnome.desktop.interface color-scheme`. The dark theme is unchanged.
|
||||
Light styling lives in `light.css`, scoped under a `.strata-theme-light`
|
||||
class toggled on the panel root box, loaded into the St theme context by
|
||||
the extension. Switching is a single class toggle with no runtime cost on
|
||||
the ingest/render paths.
|
||||
|
||||
### Fixed
|
||||
|
||||
- The keyboard shortcut now hides the panel when it is already open. The
|
||||
binding was registered without `Shell.ActionMode.POPUP`, so while the
|
||||
panel's modal grab was active the second press was swallowed and
|
||||
`toggle()` never ran.
|
||||
- The search placeholder ("Search...") is now legible in the light theme; it
|
||||
previously inherited a light-on-dark Shell color.
|
||||
|
||||
### Packaging
|
||||
|
||||
- `make pack` now bundles `light.css` (`--extra-source`); only
|
||||
`stylesheet.css` is auto-included by `gnome-extensions pack`.
|
||||
|
||||
---
|
||||
|
||||
## [0.4.0] - 2026-05-26
|
||||
|
||||
### Performance
|
||||
|
||||
- `GetHistory` / `SearchHistory` now truncate `content_text` to a preview
|
||||
(`substr`, ~200 chars) in SQL instead of returning the full payload. A
|
||||
page of large text items previously serialized up to megabytes of JSON
|
||||
over D-Bus and parsed it on the GJS main loop, only to render a 140-char
|
||||
snippet. Full content is still served on demand by `GetItemContent`.
|
||||
|
||||
---
|
||||
|
||||
## [0.3.0] - 2026-05-25
|
||||
|
||||
### Fixed
|
||||
|
|
|
|||
674
LICENSE
Normal file
|
|
@ -0,0 +1,674 @@
|
|||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<https://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
||||
2
Makefile
|
|
@ -37,6 +37,8 @@ install: schemas
|
|||
pack: schemas
|
||||
gnome-extensions pack $(EXTENSION_UUID) \
|
||||
--extra-source=ui \
|
||||
--extra-source=dbus.js \
|
||||
--extra-source=util.js \
|
||||
--force
|
||||
@echo "Packed: $(EXTENSION_UUID).shell-extension.zip"
|
||||
|
||||
|
|
|
|||
150
README.md
|
|
@ -1,3 +1,7 @@
|
|||
<p align="center">
|
||||
<img src="assets/icon.svg" alt="Strata logo" width="96" height="96">
|
||||
</p>
|
||||
|
||||
# Strata
|
||||
|
||||
A fast, stutter-free clipboard manager for GNOME Shell.
|
||||
|
|
@ -6,13 +10,90 @@ All heavy work (hashing, decoding, storage, search, thumbnails) lives in a Rust
|
|||
daemon. The GNOME Shell extension only renders UI and forwards events over
|
||||
D-Bus, so the compositor is never blocked, even with thousands of items.
|
||||
|
||||
<p align="center">
|
||||
<a href="https://extensions.gnome.org/extension/10291/strata/">
|
||||
<img src="assets/ego.svg" width="200" alt="Download from extensions.gnome.org">
|
||||
</a>
|
||||
</p>
|
||||
|
||||
> **Requires a companion daemon.** Installing from GNOME Extensions is only half
|
||||
> the setup. See [Installing the daemon](#installing-the-daemon).
|
||||
|
||||
The motivation behind this is explained in the technical blog post [Rethinking the GNOME clipboard issues](https://edu4rdshl.dev/posts/rethinking-the-gnome-clipboard-issues/)
|
||||
|
||||
## Features
|
||||
|
||||
**Content types.** Strata captures and previews:
|
||||
|
||||
- **Text** (UTF-8). When an app offers both rich and plain text, Strata stores
|
||||
the plain text rather than styled HTML.
|
||||
- **URLs** are shown link-styled, with the hostname as a subtitle.
|
||||
- **Colors**: hex values (`#rgb` / `#rrggbb`) get a color swatch.
|
||||
- **Images**: PNG, JPEG, GIF, WebP, BMP, TIFF, ICO, shown as thumbnails.
|
||||
Decoding and resizing happen once, in the daemon, at copy time.
|
||||
- **Files**: file-manager copy/cut (URI lists, e.g. from Nautilus).
|
||||
|
||||
Unknown MIME types are ignored (a strict allowlist).
|
||||
|
||||
**Search.**
|
||||
|
||||
- Full-text search over the entire stored history, backed by SQLite FTS5.
|
||||
- Prefix matching, diacritic-insensitive (`cafe` matches `café`).
|
||||
- Text only; images and binaries are not indexed.
|
||||
|
||||
**Appearance.**
|
||||
|
||||
- Light and dark styling follows the GNOME Shell automatically, matching the
|
||||
rest of the shell UI.
|
||||
- Configurable panel position (top/center/bottom by left/center/right), width,
|
||||
and maximum height.
|
||||
- Optional "move an item to the top" when you paste it.
|
||||
|
||||
**Performance.**
|
||||
|
||||
- All hashing, decoding, storage, search, and thumbnailing run in the Rust
|
||||
daemon, off the compositor's main loop.
|
||||
- Lazy loading: the panel loads one page of history at a time and fetches more
|
||||
on scroll; thumbnails are fetched on demand and cached on disk; search
|
||||
renders a page at a time. The full table never sits in memory.
|
||||
- Deduplication: copying the same content twice moves the existing entry to the
|
||||
top (blake3 content hash) instead of adding a duplicate.
|
||||
|
||||
**Reliability.**
|
||||
|
||||
- SQLite in WAL mode with atomic upserts; history survives a crash.
|
||||
- The extension supervises the daemon, respawning it with exponential backoff.
|
||||
Only one daemon runs at a time; a second exits rather than contend for the
|
||||
bus name.
|
||||
- Configurable history limit (default 200, up to 2000); oldest items are pruned
|
||||
automatically.
|
||||
|
||||
**Privacy and safety.**
|
||||
|
||||
- Password-manager aware: entries marked sensitive (the
|
||||
`x-kde-passwordManagerHint` used by KeePassXC and others) are never stored.
|
||||
- App exclusions: items copied while a listed app has focus are skipped. The
|
||||
default list covers common password managers (1Password, KeePassXC,
|
||||
Bitwarden, and others).
|
||||
- Size caps: text and image payloads larger than a configurable limit (1 MB and
|
||||
5 MB by default) are not stored.
|
||||
- Never executes clipboard content: no shell exec, no `launch_uri`, no markup
|
||||
parsing; paste-back only writes to the clipboard.
|
||||
|
||||
**Controls.**
|
||||
|
||||
- Top-bar icon and popup panel, opened with a configurable shortcut (default
|
||||
`Super+Shift+V`).
|
||||
- Keyboard navigation (arrow keys, `Esc` to close), click-outside to dismiss,
|
||||
per-row delete, and "Clear all".
|
||||
|
||||
## Architecture
|
||||
|
||||
Strata is **two components**, and you need **both** for it to work:
|
||||
|
||||
| Component | Language | Role |
|
||||
|---|---|---|
|
||||
| [`strata-daemon/`](strata-daemon/) | Rust + tokio + zbus | Storage (SQLite + FTS5), dedup, thumbnails, D-Bus service `org.gnome.Strata` |
|
||||
| [`strata-daemon/`](strata-daemon/) | Rust + tokio + zbus | Storage (SQLite + FTS5), dedup, thumbnails, D-Bus service `dev.edu4rdshl.Strata` |
|
||||
| [`strata@edu4rdshl.dev/`](strata@edu4rdshl.dev/) | GJS (GNOME Shell extension) | Top-bar panel, search UI, paste-back, clipboard ingest |
|
||||
|
||||
The extension auto-connects to the daemon on enable. If the daemon is managed
|
||||
|
|
@ -26,9 +107,35 @@ GNOME Shell (GJS) ──D-Bus──▶ strata-daemon ──▶ SQLite (~/.lo
|
|||
└──▶ thumbnails (~/.cache/strata)
|
||||
```
|
||||
|
||||
## Installing the daemon
|
||||
|
||||
Strata is two parts: the GNOME Shell extension and a small background daemon
|
||||
(`strata-daemon`) that does the storage, search, and thumbnailing. Installing
|
||||
the extension from [GNOME Extensions](https://extensions.gnome.org/extension/10291/strata/)
|
||||
is only half the setup; **without the daemon the extension does nothing.**
|
||||
|
||||
Install the daemon with whichever fits your system:
|
||||
|
||||
- **Arch (AUR):** `paru -S strata-daemon` (or `strata-daemon-git` for the latest `main`).
|
||||
- **From source** (needs Rust/Cargo 1.74+):
|
||||
|
||||
```sh
|
||||
git clone https://github.com/Edu4rdSHL/Strata.git
|
||||
cd Strata
|
||||
make install-daemon # builds and installs to ~/.local/bin
|
||||
```
|
||||
|
||||
Make sure `~/.local/bin` is in your `$PATH`.
|
||||
|
||||
Then log out and back in (Wayland) or `Alt+F2` → `r` (X11). The extension finds
|
||||
`strata-daemon` in `$PATH` and starts it automatically; no separate service is
|
||||
needed.
|
||||
|
||||
For distro packages and the systemd user service, see [Install](#install).
|
||||
|
||||
## Requirements
|
||||
|
||||
- GNOME Shell 50 (tested). May work on 45–49 but untested — if you try it and it works, please open an issue to let us know.
|
||||
- GNOME Shell 50. Older releases may work if built from source but are not tested or supported.
|
||||
- `strata-daemon` binary in `$PATH` (see Install below)
|
||||
- Rust 1.74+ (build only)
|
||||
- `glib-compile-schemas` (from `glib2-devel` / `libglib2.0-dev-bin`)
|
||||
|
|
@ -36,6 +143,32 @@ GNOME Shell (GJS) ──D-Bus──▶ strata-daemon ──▶ SQLite (~/.lo
|
|||
|
||||
## Install
|
||||
|
||||
### Arch Linux (AUR)
|
||||
|
||||
Strata is split into a daemon package and an extension package; install both.
|
||||
Two channels are available -- pick one channel and don't mix them:
|
||||
|
||||
- **Stable (tagged releases):** `strata-daemon` + `gnome-shell-extension-strata`
|
||||
- **Git (latest `main`):** `strata-daemon-git` + `gnome-shell-extension-strata-git`
|
||||
|
||||
```sh
|
||||
# Stable
|
||||
paru -S strata-daemon gnome-shell-extension-strata
|
||||
|
||||
# or Git
|
||||
paru -S strata-daemon-git gnome-shell-extension-strata-git
|
||||
```
|
||||
|
||||
(Use your AUR helper of choice, e.g. `yay` instead of `paru`.) Then log out /
|
||||
log back in (Wayland) or `Alt+F2` → `r` (X11) and enable:
|
||||
|
||||
```sh
|
||||
gnome-extensions enable strata@edu4rdshl.dev
|
||||
```
|
||||
|
||||
The daemon is installed to `/usr/bin/strata-daemon` (already in `$PATH`), so
|
||||
the extension finds it automatically.
|
||||
|
||||
### From source (local build)
|
||||
|
||||
```sh
|
||||
|
|
@ -93,6 +226,19 @@ the wire protocol and a `busctl` example.
|
|||
The shipped UI is a GNOME Shell extension. Ports to other desktops only
|
||||
need a new front-end against the same D-Bus interface.
|
||||
|
||||
## How it looks
|
||||
|
||||
A responsive panel that drops down from the top bar and follows the GNOME
|
||||
shell's look.
|
||||
|
||||
<p align="center">
|
||||
<img src="assets/panel-desktop.png" alt="Strata's clipboard panel open on the GNOME desktop" width="100%">
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
<img src="assets/panel.png" alt="Close-up of the Strata panel: a URL with its hostname, an image thumbnail, color swatches, and text entries" width="400">
|
||||
</p>
|
||||
|
||||
## Deeper reading
|
||||
|
||||
- [`ARCHITECTURE.md`](ARCHITECTURE.md): design goals, process model,
|
||||
|
|
|
|||
170
assets/ego.svg
Normal file
|
After Width: | Height: | Size: 18 KiB |
7
assets/icon.svg
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" role="img" aria-label="Strata">
|
||||
<!-- App-icon variant: staggered strata layers on a rounded dark square. -->
|
||||
<rect width="64" height="64" rx="14" fill="#1e1e1e"/>
|
||||
<rect x="10" y="15" width="34" height="9" rx="3" fill="#62a0ea"/>
|
||||
<rect x="15" y="27.5" width="34" height="9" rx="3" fill="#3584e4"/>
|
||||
<rect x="20" y="40" width="34" height="9" rx="3" fill="#1a5fb4"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 444 B |
6
assets/logo.svg
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" role="img" aria-label="Strata">
|
||||
<!-- Staggered strata layers (also a clipboard-history stack). -->
|
||||
<rect x="8" y="13" width="38" height="10" rx="3" fill="#62a0ea"/>
|
||||
<rect x="14" y="27" width="38" height="10" rx="3" fill="#3584e4"/>
|
||||
<rect x="20" y="41" width="38" height="10" rx="3" fill="#1a5fb4"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 375 B |
21
assets/og-card.svg
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1200 630" font-family="Liberation Sans, DejaVu Sans, sans-serif">
|
||||
<defs>
|
||||
<linearGradient id="bg" x1="0" y1="0" x2="0" y2="1">
|
||||
<stop offset="0" stop-color="#232323"/>
|
||||
<stop offset="1" stop-color="#181818"/>
|
||||
</linearGradient>
|
||||
</defs>
|
||||
<rect width="1200" height="630" fill="url(#bg)"/>
|
||||
|
||||
<!-- staggered strata mark, scaled from the 64-unit logo -->
|
||||
<g transform="translate(130,150) scale(5.4)">
|
||||
<rect x="8" y="13" width="38" height="10" rx="3" fill="#62a0ea"/>
|
||||
<rect x="14" y="27" width="38" height="10" rx="3" fill="#3584e4"/>
|
||||
<rect x="20" y="41" width="38" height="10" rx="3" fill="#1a5fb4"/>
|
||||
</g>
|
||||
|
||||
<!-- wordmark + tagline -->
|
||||
<text x="500" y="305" font-size="140" font-weight="700" fill="#ffffff">Strata</text>
|
||||
<text x="505" y="368" font-size="34" fill="#bcbcbc">Stutter-free clipboard history for GNOME</text>
|
||||
<text x="505" y="414" font-size="29" fill="#6f6f6f">JS draws, Rust thinks.</text>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1,004 B |
BIN
assets/og-image.jpg
Normal file
|
After Width: | Height: | Size: 30 KiB |
BIN
assets/panel-desktop.png
Normal file
|
After Width: | Height: | Size: 421 KiB |
BIN
assets/panel.png
Normal file
|
After Width: | Height: | Size: 89 KiB |
149
eslint.config.js
Normal file
|
|
@ -0,0 +1,149 @@
|
|||
// SPDX-License-Identifier: CC0-1.0
|
||||
// SPDX-FileCopyrightText: No rights reserved
|
||||
|
||||
import js from '@eslint/js';
|
||||
|
||||
export default [
|
||||
js.configs.recommended,
|
||||
{
|
||||
languageOptions: {
|
||||
globals: {
|
||||
ARGV: 'readonly',
|
||||
Debugger: 'readonly',
|
||||
GIRepositoryGType: 'readonly',
|
||||
globalThis: 'readonly',
|
||||
imports: 'readonly',
|
||||
Intl: 'readonly',
|
||||
log: 'readonly',
|
||||
logError: 'readonly',
|
||||
pkg: 'readonly',
|
||||
print: 'readonly',
|
||||
printerr: 'readonly',
|
||||
window: 'readonly',
|
||||
TextEncoder: 'readonly',
|
||||
TextDecoder: 'readonly',
|
||||
console: 'readonly',
|
||||
setTimeout: 'readonly',
|
||||
setInterval: 'readonly',
|
||||
clearTimeout: 'readonly',
|
||||
clearInterval: 'readonly',
|
||||
// GNOME Shell Only
|
||||
global: 'readonly',
|
||||
_: 'readonly',
|
||||
C_: 'readonly',
|
||||
N_: 'readonly',
|
||||
ngettext: 'readonly',
|
||||
},
|
||||
parserOptions: {
|
||||
ecmaVersion: 2022,
|
||||
sourceType: 'module',
|
||||
},
|
||||
},
|
||||
rules: {
|
||||
// See: https://eslint.org/docs/latest/rules/#possible-problems
|
||||
'array-callback-return': 'error',
|
||||
'no-await-in-loop': 'error',
|
||||
'no-constant-binary-expression': 'error',
|
||||
'no-constructor-return': 'error',
|
||||
'no-new-native-nonconstructor': 'error',
|
||||
'no-promise-executor-return': 'error',
|
||||
'no-self-compare': 'error',
|
||||
'no-template-curly-in-string': 'error',
|
||||
'no-unmodified-loop-condition': 'error',
|
||||
'no-unreachable-loop': 'error',
|
||||
'no-unused-private-class-members': 'error',
|
||||
'no-use-before-define': [
|
||||
'error',
|
||||
{
|
||||
functions: false,
|
||||
classes: true,
|
||||
variables: true,
|
||||
allowNamedExports: true,
|
||||
},
|
||||
],
|
||||
// See: https://eslint.org/docs/latest/rules/#suggestions
|
||||
'block-scoped-var': 'error',
|
||||
'complexity': 'warn',
|
||||
'consistent-return': 'error',
|
||||
'default-param-last': 'error',
|
||||
'eqeqeq': 'error',
|
||||
'no-array-constructor': 'error',
|
||||
'no-caller': 'error',
|
||||
'no-extend-native': 'error',
|
||||
'no-extra-bind': 'error',
|
||||
'no-extra-label': 'error',
|
||||
'no-iterator': 'error',
|
||||
'no-label-var': 'error',
|
||||
'no-loop-func': 'error',
|
||||
'no-multi-assign': 'warn',
|
||||
'no-new-object': 'error',
|
||||
'no-new-wrappers': 'error',
|
||||
'no-proto': 'error',
|
||||
'no-shadow': 'warn',
|
||||
'no-unused-vars': [
|
||||
'error',
|
||||
{
|
||||
varsIgnorePattern: '^_',
|
||||
argsIgnorePattern: '^_',
|
||||
},
|
||||
],
|
||||
'no-var': 'warn',
|
||||
'unicode-bom': 'error',
|
||||
// GJS Restrictions
|
||||
'no-restricted-globals': [
|
||||
'error',
|
||||
{
|
||||
name: 'Debugger',
|
||||
message: 'Internal use only',
|
||||
},
|
||||
{
|
||||
name: 'GIRepositoryGType',
|
||||
message: 'Internal use only',
|
||||
},
|
||||
{
|
||||
name: 'log',
|
||||
message: 'Use console.log()',
|
||||
},
|
||||
{
|
||||
name: 'logError',
|
||||
message: 'Use console.warn() or console.error()',
|
||||
},
|
||||
],
|
||||
'no-restricted-properties': [
|
||||
'error',
|
||||
{
|
||||
object: 'imports',
|
||||
property: 'format',
|
||||
message: 'Use template strings',
|
||||
},
|
||||
{
|
||||
object: 'pkg',
|
||||
property: 'initFormat',
|
||||
message: 'Use template strings',
|
||||
},
|
||||
{
|
||||
object: 'Lang',
|
||||
property: 'copyProperties',
|
||||
message: 'Use Object.assign()',
|
||||
},
|
||||
{
|
||||
object: 'Lang',
|
||||
property: 'bind',
|
||||
message: 'Use arrow notation or Function.prototype.bind()',
|
||||
},
|
||||
{
|
||||
object: 'Lang',
|
||||
property: 'Class',
|
||||
message: 'Use ES6 classes',
|
||||
},
|
||||
],
|
||||
'no-restricted-syntax': [
|
||||
'error',
|
||||
{
|
||||
selector: 'MethodDefinition[key.name="_init"] CallExpression[arguments.length<=1][callee.object.type="Super"][callee.property.name="_init"]',
|
||||
message: 'Use constructor() and super()',
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
];
|
||||
14
package.json
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
"name": "strata-extension",
|
||||
"version": "0.9.0",
|
||||
"description": "Lint tooling for the Strata GNOME Shell extension",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"lint": "eslint 'strata@edu4rdshl.dev'"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@eslint/js": "^10.0.0",
|
||||
"eslint": "^10.0.0"
|
||||
}
|
||||
}
|
||||
562
strata-daemon/Cargo.lock
generated
|
|
@ -8,18 +8,6 @@ version = "2.0.1"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa"
|
||||
|
||||
[[package]]
|
||||
name = "ahash"
|
||||
version = "0.8.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5a15f179cd60c4584b8a8c596927aadc462e27f2ca70c04e0071964a73ba7a75"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"once_cell",
|
||||
"version_check",
|
||||
"zerocopy",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "aho-corasick"
|
||||
version = "1.1.4"
|
||||
|
|
@ -85,17 +73,6 @@ dependencies = [
|
|||
"slab",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "async-fs"
|
||||
version = "2.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8034a681df4aed8b8edbd7fbe472401ecf009251c8b40556b304567052e294c5"
|
||||
dependencies = [
|
||||
"async-lock",
|
||||
"blocking",
|
||||
"futures-lite",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "async-io"
|
||||
version = "2.6.0"
|
||||
|
|
@ -111,7 +88,7 @@ dependencies = [
|
|||
"polling",
|
||||
"rustix",
|
||||
"slab",
|
||||
"windows-sys 0.61.2",
|
||||
"windows-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -169,7 +146,7 @@ dependencies = [
|
|||
"rustix",
|
||||
"signal-hook-registry",
|
||||
"slab",
|
||||
"windows-sys 0.61.2",
|
||||
"windows-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -218,16 +195,7 @@ dependencies = [
|
|||
"cc",
|
||||
"cfg-if",
|
||||
"constant_time_eq",
|
||||
"cpufeatures 0.3.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "block-buffer"
|
||||
version = "0.10.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71"
|
||||
dependencies = [
|
||||
"generic-array",
|
||||
"cpufeatures",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -284,10 +252,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801"
|
||||
|
||||
[[package]]
|
||||
name = "cfg_aliases"
|
||||
version = "0.2.1"
|
||||
name = "color_quant"
|
||||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724"
|
||||
checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b"
|
||||
|
||||
[[package]]
|
||||
name = "concurrent-queue"
|
||||
|
|
@ -304,15 +272,6 @@ version = "0.4.2"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3d52eff69cd5e647efe296129160853a42795992097e8af39800e1060caeea9b"
|
||||
|
||||
[[package]]
|
||||
name = "cpufeatures"
|
||||
version = "0.2.17"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cpufeatures"
|
||||
version = "0.3.0"
|
||||
|
|
@ -338,44 +297,30 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28"
|
||||
|
||||
[[package]]
|
||||
name = "crypto-common"
|
||||
version = "0.1.7"
|
||||
name = "crunchy"
|
||||
version = "0.2.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a"
|
||||
dependencies = [
|
||||
"generic-array",
|
||||
"typenum",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "digest"
|
||||
version = "0.10.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292"
|
||||
dependencies = [
|
||||
"block-buffer",
|
||||
"crypto-common",
|
||||
]
|
||||
checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5"
|
||||
|
||||
[[package]]
|
||||
name = "dirs"
|
||||
version = "5.0.1"
|
||||
version = "6.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "44c45a9d03d6676652bcb5e724c7e988de1acad23a711b5217ab9cbecbec2225"
|
||||
checksum = "c3e8aa94d75141228480295a7d0e7feb620b1a5ad9f12bc40be62411e38cce4e"
|
||||
dependencies = [
|
||||
"dirs-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "dirs-sys"
|
||||
version = "0.4.1"
|
||||
version = "0.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "520f05a5cbd335fae5a99ff7a6ab8627577660ee5cfd6a94a6a929b52ff0321c"
|
||||
checksum = "e01a3366d27ee9890022452ee61b2b63a67e6f13f58900b651ff5665f0bb1fab"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"option-ext",
|
||||
"redox_users",
|
||||
"windows-sys 0.48.0",
|
||||
"windows-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -424,7 +369,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"windows-sys 0.61.2",
|
||||
"windows-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -466,6 +411,12 @@ version = "2.4.1"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9f1f227452a390804cdb637b74a86990f2a7d7ba4b7d5693aac9b4dd6defd8d6"
|
||||
|
||||
[[package]]
|
||||
name = "fax"
|
||||
version = "0.2.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "caf1079563223d5d59d83c85886a56e586cfd5c1a26292e971a0fa266531ac5a"
|
||||
|
||||
[[package]]
|
||||
name = "fdeflate"
|
||||
version = "0.3.7"
|
||||
|
|
@ -503,6 +454,12 @@ version = "0.1.5"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2"
|
||||
|
||||
[[package]]
|
||||
name = "foldhash"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb"
|
||||
|
||||
[[package]]
|
||||
name = "futures-core"
|
||||
version = "0.3.32"
|
||||
|
|
@ -528,12 +485,6 @@ dependencies = [
|
|||
"pin-project-lite",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "futures-sink"
|
||||
version = "0.3.32"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c39754e157331b013978ec91992bde1ac089843443c49cbc7f46150b0fad0893"
|
||||
|
||||
[[package]]
|
||||
name = "futures-task"
|
||||
version = "0.3.32"
|
||||
|
|
@ -547,24 +498,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "389ca41296e6190b48053de0321d02a77f32f8a5d2461dd38762c0593805c6d6"
|
||||
dependencies = [
|
||||
"futures-core",
|
||||
"futures-io",
|
||||
"futures-sink",
|
||||
"futures-task",
|
||||
"memchr",
|
||||
"pin-project-lite",
|
||||
"slab",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "generic-array"
|
||||
version = "0.14.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a"
|
||||
dependencies = [
|
||||
"typenum",
|
||||
"version_check",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "getrandom"
|
||||
version = "0.2.17"
|
||||
|
|
@ -590,12 +528,24 @@ dependencies = [
|
|||
]
|
||||
|
||||
[[package]]
|
||||
name = "hashbrown"
|
||||
version = "0.14.5"
|
||||
name = "gif"
|
||||
version = "0.14.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1"
|
||||
checksum = "ee8cfcc411d9adbbaba82fb72661cc1bcca13e8bba98b364e62b2dba8f960159"
|
||||
dependencies = [
|
||||
"ahash",
|
||||
"color_quant",
|
||||
"weezl",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "half"
|
||||
version = "2.7.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6ea2d84b969582b4b1864a92dc5d27cd2b77b622a8d79306834f1be5ba20d84b"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"crunchy",
|
||||
"zerocopy",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -604,7 +554,16 @@ version = "0.15.5"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1"
|
||||
dependencies = [
|
||||
"foldhash",
|
||||
"foldhash 0.1.5",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hashbrown"
|
||||
version = "0.16.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100"
|
||||
dependencies = [
|
||||
"foldhash 0.2.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -615,11 +574,11 @@ checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a"
|
|||
|
||||
[[package]]
|
||||
name = "hashlink"
|
||||
version = "0.9.1"
|
||||
version = "0.11.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6ba4ff7128dee98c7dc9794b6a411377e1404dba1c97deb8d1a55297bd25d8af"
|
||||
checksum = "ea0b22561a9c04a7cb1a302c013e0259cd3b4bb619f145b32f72b8b4bcbed230"
|
||||
dependencies = [
|
||||
"hashbrown 0.14.5",
|
||||
"hashbrown 0.16.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -654,13 +613,27 @@ checksum = "85ab80394333c02fe689eaf900ab500fbd0c2213da414687ebf995a65d5a6104"
|
|||
dependencies = [
|
||||
"bytemuck",
|
||||
"byteorder-lite",
|
||||
"color_quant",
|
||||
"gif",
|
||||
"image-webp",
|
||||
"moxcms",
|
||||
"num-traits",
|
||||
"png",
|
||||
"tiff",
|
||||
"zune-core",
|
||||
"zune-jpeg",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "image-webp"
|
||||
version = "0.2.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "525e9ff3e1a4be2fbea1fdf0e98686a6d98b4d8f937e1bf7402245af1909e8c3"
|
||||
dependencies = [
|
||||
"byteorder-lite",
|
||||
"quick-error",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "indexmap"
|
||||
version = "2.14.0"
|
||||
|
|
@ -720,9 +693,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "libsqlite3-sys"
|
||||
version = "0.28.0"
|
||||
version = "0.38.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0c10584274047cb335c23d3e61bcef8e323adae7c5c8c760540f73610177fc3f"
|
||||
checksum = "a76001fb4daed01e5f2b518aac0b4dc592e7c734da63dbffcf0c64fa612a8d0c"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"pkg-config",
|
||||
|
|
@ -746,9 +719,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "log"
|
||||
version = "0.4.29"
|
||||
version = "0.4.30"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897"
|
||||
checksum = "616ec5685824bcc94416c6d4a7a446eea774a31efd7062c8480ba6fd06d7a6e5"
|
||||
|
||||
[[package]]
|
||||
name = "matchers"
|
||||
|
|
@ -792,7 +765,7 @@ checksum = "50b7e5b27aa02a74bac8c3f23f448f8d87ff11f92d3aac1a6ed369ee08cc56c1"
|
|||
dependencies = [
|
||||
"libc",
|
||||
"wasi",
|
||||
"windows-sys 0.61.2",
|
||||
"windows-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -805,19 +778,6 @@ dependencies = [
|
|||
"pxfm",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "nix"
|
||||
version = "0.29.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "71e2746dc3a24dd78b3cfcb7be93368c6de9963d30f43a6a73998a9cf4b17b46"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"cfg-if",
|
||||
"cfg_aliases",
|
||||
"libc",
|
||||
"memoffset",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "nom"
|
||||
version = "8.0.0"
|
||||
|
|
@ -833,7 +793,7 @@ version = "0.50.3"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5"
|
||||
dependencies = [
|
||||
"windows-sys 0.61.2",
|
||||
"windows-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -874,7 +834,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "7d8fae84b431384b68627d0f9b3b1245fcf9f46f6c0e3dc902e9dce64edd1967"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"windows-sys 0.61.2",
|
||||
"windows-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -964,16 +924,7 @@ dependencies = [
|
|||
"hermit-abi",
|
||||
"pin-project-lite",
|
||||
"rustix",
|
||||
"windows-sys 0.61.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ppv-lite86"
|
||||
version = "0.2.21"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9"
|
||||
dependencies = [
|
||||
"zerocopy",
|
||||
"windows-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -1010,6 +961,12 @@ version = "0.1.29"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e0c5ccf5294c6ccd63a74f1565028353830a9c2f5eb0c682c355c471726a6e3f"
|
||||
|
||||
[[package]]
|
||||
name = "quick-error"
|
||||
version = "2.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a993555f31e5a609f617c12db6250dedcac1b0a85076912c436e6fc9b2c8e6a3"
|
||||
|
||||
[[package]]
|
||||
name = "quick-xml"
|
||||
version = "0.39.4"
|
||||
|
|
@ -1034,36 +991,6 @@ version = "6.0.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf"
|
||||
|
||||
[[package]]
|
||||
name = "rand"
|
||||
version = "0.8.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5ca0ecfa931c29007047d1bc58e623ab12e5590e8c7cc53200d5202b69266d8a"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"rand_chacha",
|
||||
"rand_core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_chacha"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"
|
||||
dependencies = [
|
||||
"ppv-lite86",
|
||||
"rand_core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_core"
|
||||
version = "0.6.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
|
||||
dependencies = [
|
||||
"getrandom 0.2.17",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "redox_syscall"
|
||||
version = "0.5.18"
|
||||
|
|
@ -1075,13 +1002,13 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "redox_users"
|
||||
version = "0.4.6"
|
||||
version = "0.5.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ba009ff324d1fc1b900bd1fdb31564febe58a8ccc8a6fdbb93b543d33b13ca43"
|
||||
checksum = "a4e608c6638b9c18977b00b475ac1f28d14e84b27d8d42f70e0bf1e3dec127ac"
|
||||
dependencies = [
|
||||
"getrandom 0.2.17",
|
||||
"libredox",
|
||||
"thiserror 1.0.69",
|
||||
"thiserror",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -1102,10 +1029,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "dc897dd8d9e8bd1ed8cdad82b5966c3e0ecae09fb1907d58efaa013543185d0a"
|
||||
|
||||
[[package]]
|
||||
name = "rusqlite"
|
||||
version = "0.31.0"
|
||||
name = "rsqlite-vfs"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b838eba278d213a8beaf485bd313fd580ca4505a00d5871caeb1457c55322cae"
|
||||
checksum = "c51c9ae4df8a7fba42103df5c621fa3c37eccf3a3c650879e90fc48b11cc192c"
|
||||
dependencies = [
|
||||
"hashbrown 0.16.1",
|
||||
"thiserror",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rusqlite"
|
||||
version = "0.40.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1b3492ea85308705c3a5cc24fb9b9cf77273d30590349070db42991202b214c4"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"fallible-iterator",
|
||||
|
|
@ -1113,6 +1050,7 @@ dependencies = [
|
|||
"hashlink",
|
||||
"libsqlite3-sys",
|
||||
"smallvec",
|
||||
"sqlite-wasm-rs",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -1125,7 +1063,7 @@ dependencies = [
|
|||
"errno",
|
||||
"libc",
|
||||
"linux-raw-sys",
|
||||
"windows-sys 0.61.2",
|
||||
"windows-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -1200,17 +1138,6 @@ dependencies = [
|
|||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sha1"
|
||||
version = "0.10.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"cpufeatures 0.2.17",
|
||||
"digest",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sharded-slab"
|
||||
version = "0.1.7"
|
||||
|
|
@ -1261,18 +1188,24 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "3a766e1110788c36f4fa1c2b71b387a7815aa65f88ce0229841826633d93723e"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"windows-sys 0.61.2",
|
||||
"windows-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "static_assertions"
|
||||
version = "1.1.0"
|
||||
name = "sqlite-wasm-rs"
|
||||
version = "0.5.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
|
||||
checksum = "dc3efc0da82635d7e1ced0053bbbfa8c7ab9645d0bf36ceb4f7127bb85315d75"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"js-sys",
|
||||
"rsqlite-vfs",
|
||||
"wasm-bindgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "strata-daemon"
|
||||
version = "0.3.0"
|
||||
version = "0.11.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"blake3",
|
||||
|
|
@ -1313,16 +1246,7 @@ dependencies = [
|
|||
"getrandom 0.4.2",
|
||||
"once_cell",
|
||||
"rustix",
|
||||
"windows-sys 0.61.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thiserror"
|
||||
version = "1.0.69"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52"
|
||||
dependencies = [
|
||||
"thiserror-impl 1.0.69",
|
||||
"windows-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -1331,18 +1255,7 @@ version = "2.0.18"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4288b5bcbc7920c07a1149a35cf9590a2aa808e0bc1eafaade0b80947865fbc4"
|
||||
dependencies = [
|
||||
"thiserror-impl 2.0.18",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thiserror-impl"
|
||||
version = "1.0.69"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"thiserror-impl",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -1365,6 +1278,20 @@ dependencies = [
|
|||
"cfg-if",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tiff"
|
||||
version = "0.11.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b63feaf3343d35b6ca4d50483f94843803b0f51634937cc2ec519fc32232bc52"
|
||||
dependencies = [
|
||||
"fax",
|
||||
"flate2",
|
||||
"half",
|
||||
"quick-error",
|
||||
"weezl",
|
||||
"zune-jpeg",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tokio"
|
||||
version = "1.52.3"
|
||||
|
|
@ -1380,7 +1307,7 @@ dependencies = [
|
|||
"socket2",
|
||||
"tokio-macros",
|
||||
"tracing",
|
||||
"windows-sys 0.61.2",
|
||||
"windows-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -1496,12 +1423,6 @@ dependencies = [
|
|||
"petgraph",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "typenum"
|
||||
version = "1.20.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "40ce102ab67701b8526c123c1bab5cbe42d7040ccfd0f64af1a385808d2f43de"
|
||||
|
||||
[[package]]
|
||||
name = "uds_windows"
|
||||
version = "1.2.1"
|
||||
|
|
@ -1510,7 +1431,7 @@ checksum = "f2f6fb2847f6742cd76af783a2a2c49e9375d0a111c7bef6f71cd9e738c72d6e"
|
|||
dependencies = [
|
||||
"memoffset",
|
||||
"tempfile",
|
||||
"windows-sys 0.61.2",
|
||||
"windows-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -1533,6 +1454,7 @@ checksum = "ddd74a9687298c6858e9b88ec8935ec45d22e8fd5e6394fa1bd4e99a87789c76"
|
|||
dependencies = [
|
||||
"getrandom 0.4.2",
|
||||
"js-sys",
|
||||
"serde_core",
|
||||
"wasm-bindgen",
|
||||
]
|
||||
|
||||
|
|
@ -1548,12 +1470,6 @@ version = "0.2.15"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426"
|
||||
|
||||
[[package]]
|
||||
name = "version_check"
|
||||
version = "0.9.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a"
|
||||
|
||||
[[package]]
|
||||
name = "wasi"
|
||||
version = "0.11.1+wasi-snapshot-preview1"
|
||||
|
|
@ -1727,39 +1643,18 @@ dependencies = [
|
|||
"pkg-config",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "weezl"
|
||||
version = "0.1.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a28ac98ddc8b9274cb41bb4d9d4d5c425b6020c50c46f25559911905610b4a88"
|
||||
|
||||
[[package]]
|
||||
name = "windows-link"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5"
|
||||
|
||||
[[package]]
|
||||
name = "windows-sys"
|
||||
version = "0.48.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9"
|
||||
dependencies = [
|
||||
"windows-targets 0.48.5",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-sys"
|
||||
version = "0.52.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
|
||||
dependencies = [
|
||||
"windows-targets 0.52.6",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-sys"
|
||||
version = "0.59.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b"
|
||||
dependencies = [
|
||||
"windows-targets 0.52.6",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-sys"
|
||||
version = "0.61.2"
|
||||
|
|
@ -1769,127 +1664,6 @@ dependencies = [
|
|||
"windows-link",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-targets"
|
||||
version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c"
|
||||
dependencies = [
|
||||
"windows_aarch64_gnullvm 0.48.5",
|
||||
"windows_aarch64_msvc 0.48.5",
|
||||
"windows_i686_gnu 0.48.5",
|
||||
"windows_i686_msvc 0.48.5",
|
||||
"windows_x86_64_gnu 0.48.5",
|
||||
"windows_x86_64_gnullvm 0.48.5",
|
||||
"windows_x86_64_msvc 0.48.5",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-targets"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"
|
||||
dependencies = [
|
||||
"windows_aarch64_gnullvm 0.52.6",
|
||||
"windows_aarch64_msvc 0.52.6",
|
||||
"windows_i686_gnu 0.52.6",
|
||||
"windows_i686_gnullvm",
|
||||
"windows_i686_msvc 0.52.6",
|
||||
"windows_x86_64_gnu 0.52.6",
|
||||
"windows_x86_64_gnullvm 0.52.6",
|
||||
"windows_x86_64_msvc 0.52.6",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_gnullvm"
|
||||
version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8"
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_gnullvm"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_msvc"
|
||||
version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc"
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_msvc"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_gnu"
|
||||
version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_gnu"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_gnullvm"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_msvc"
|
||||
version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_msvc"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnu"
|
||||
version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnu"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnullvm"
|
||||
version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnullvm"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_msvc"
|
||||
version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_msvc"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
|
||||
|
||||
[[package]]
|
||||
name = "winnow"
|
||||
version = "1.0.3"
|
||||
|
|
@ -2003,7 +1777,7 @@ dependencies = [
|
|||
"log",
|
||||
"os_pipe",
|
||||
"rustix",
|
||||
"thiserror 2.0.18",
|
||||
"thiserror",
|
||||
"tree_magic_mini",
|
||||
"wayland-backend",
|
||||
"wayland-client",
|
||||
|
|
@ -2011,25 +1785,14 @@ dependencies = [
|
|||
"wayland-protocols-wlr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "xdg-home"
|
||||
version = "1.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ec1cdab258fb55c0da61328dc52c8764709b249011b2cad0454c72f0bf10a1f6"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"windows-sys 0.59.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zbus"
|
||||
version = "4.4.0"
|
||||
version = "5.15.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bb97012beadd29e654708a0fdb4c84bc046f537aecfde2c3ee0a9e4b4d48c725"
|
||||
checksum = "c3bcbf15c8708d7fc1be0c993622e0a5cbd5e8b52bfa40afa4c3e0cd8d724ac1"
|
||||
dependencies = [
|
||||
"async-broadcast",
|
||||
"async-executor",
|
||||
"async-fs",
|
||||
"async-io",
|
||||
"async-lock",
|
||||
"async-process",
|
||||
|
|
@ -2040,21 +1803,19 @@ dependencies = [
|
|||
"enumflags2",
|
||||
"event-listener",
|
||||
"futures-core",
|
||||
"futures-sink",
|
||||
"futures-util",
|
||||
"futures-lite",
|
||||
"hex",
|
||||
"nix",
|
||||
"libc",
|
||||
"ordered-stream",
|
||||
"rand",
|
||||
"rustix",
|
||||
"serde",
|
||||
"serde_repr",
|
||||
"sha1",
|
||||
"static_assertions",
|
||||
"tokio",
|
||||
"tracing",
|
||||
"uds_windows",
|
||||
"windows-sys 0.52.0",
|
||||
"xdg-home",
|
||||
"uuid",
|
||||
"windows-sys",
|
||||
"winnow",
|
||||
"zbus_macros",
|
||||
"zbus_names",
|
||||
"zvariant",
|
||||
|
|
@ -2062,25 +1823,27 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "zbus_macros"
|
||||
version = "4.4.0"
|
||||
version = "5.15.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "267db9407081e90bbfa46d841d3cbc60f59c0351838c4bc65199ecd79ab1983e"
|
||||
checksum = "51fa5406ad9175a8c825a931f8cf347116b531b3634fcb0b627c290f1f2516ff"
|
||||
dependencies = [
|
||||
"proc-macro-crate",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"zbus_names",
|
||||
"zvariant",
|
||||
"zvariant_utils",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zbus_names"
|
||||
version = "3.0.0"
|
||||
version = "4.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4b9b1fef7d021261cc16cba64c351d291b715febe0fa10dc3a443ac5a5022e6c"
|
||||
checksum = "7074f3e50b894eac91750142016d30d0a89be8e67dbfd9704fb875825760e52d"
|
||||
dependencies = [
|
||||
"serde",
|
||||
"static_assertions",
|
||||
"winnow",
|
||||
"zvariant",
|
||||
]
|
||||
|
||||
|
|
@ -2127,22 +1890,23 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "zvariant"
|
||||
version = "4.2.0"
|
||||
version = "5.11.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2084290ab9a1c471c38fc524945837734fbf124487e105daec2bb57fd48c81fe"
|
||||
checksum = "1c1567a6ec68df868cbbfde844cfc6d81649fe5109a62b116b19fabd53e618ee"
|
||||
dependencies = [
|
||||
"endi",
|
||||
"enumflags2",
|
||||
"serde",
|
||||
"static_assertions",
|
||||
"winnow",
|
||||
"zvariant_derive",
|
||||
"zvariant_utils",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zvariant_derive"
|
||||
version = "4.2.0"
|
||||
version = "5.11.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "73e2ba546bda683a90652bac4a279bc146adad1386f25379cf73200d2002c449"
|
||||
checksum = "c7d5b780599bbde114e39d9a0799577fad1ced5105d38515745f7b3099d8ceda"
|
||||
dependencies = [
|
||||
"proc-macro-crate",
|
||||
"proc-macro2",
|
||||
|
|
@ -2153,11 +1917,13 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "zvariant_utils"
|
||||
version = "2.1.0"
|
||||
version = "3.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c51bcff7cc3dbb5055396bcf774748c3dab426b4b8659046963523cee4808340"
|
||||
checksum = "6d464f5733ffa07a3164d656f18533caace9d0638596721355d73256a410d691"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"serde",
|
||||
"syn",
|
||||
"winnow",
|
||||
]
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "strata-daemon"
|
||||
version = "0.3.0"
|
||||
version = "0.11.0"
|
||||
edition = "2021"
|
||||
description = "Strata clipboard manager backend daemon"
|
||||
|
||||
|
|
@ -13,7 +13,7 @@ path = "src/main.rs"
|
|||
tokio = { version = "1", features = ["full"] }
|
||||
|
||||
# D-Bus (async, tokio-native)
|
||||
zbus = { version = "4", features = ["tokio"] }
|
||||
zbus = { version = "5", features = ["tokio"] }
|
||||
|
||||
# Wayland clipboard monitoring (custom event loop)
|
||||
wayland-client = "0.31"
|
||||
|
|
@ -25,13 +25,13 @@ wayland-protocols-wlr = { version = "0.3", features = ["client"] }
|
|||
wl-clipboard-rs = "0.9"
|
||||
|
||||
# Storage
|
||||
rusqlite = { version = "0.31", features = ["bundled"] }
|
||||
rusqlite = { version = "0.40", features = ["bundled"] }
|
||||
serde = { version = "1", features = ["derive"] }
|
||||
serde_json = "1"
|
||||
uuid = { version = "1", features = ["v4"] }
|
||||
|
||||
# Image thumbnail generation (runs in spawn_blocking — never blocks async runtime)
|
||||
image = { version = "0.25", default-features = false, features = ["png", "jpeg"] }
|
||||
image = { version = "0.25", default-features = false, features = ["png", "jpeg", "gif", "webp", "bmp", "tiff", "ico"] }
|
||||
|
||||
# Fast content hashing for deduplication
|
||||
blake3 = "1"
|
||||
|
|
@ -41,7 +41,7 @@ tracing = "0.1"
|
|||
tracing-subscriber = { version = "0.3", features = ["env-filter", "fmt"] }
|
||||
|
||||
# XDG paths
|
||||
dirs = "5"
|
||||
dirs = "6"
|
||||
|
||||
# Error handling
|
||||
anyhow = "1"
|
||||
|
|
|
|||
|
|
@ -24,9 +24,9 @@ manually if you're using a non-GNOME front-end.
|
|||
|
||||
## D-Bus interface
|
||||
|
||||
- **Bus name:** `org.gnome.Strata`
|
||||
- **Object path:** `/org/gnome/Strata`
|
||||
- **Interface:** `org.gnome.Strata.Manager`
|
||||
- **Bus name:** `dev.edu4rdshl.Strata`
|
||||
- **Object path:** `/dev/edu4rdshl/Strata`
|
||||
- **Interface:** `dev.edu4rdshl.Strata.Manager`
|
||||
|
||||
| Member | Signature | Notes |
|
||||
|---|---|---|
|
||||
|
|
@ -51,15 +51,15 @@ manually if you're using a non-GNOME front-end.
|
|||
./target/release/strata-daemon
|
||||
|
||||
# In another terminal:
|
||||
busctl --user call org.gnome.Strata /org/gnome/Strata \
|
||||
org.gnome.Strata.Manager GetHistory uu 0 10
|
||||
busctl --user call dev.edu4rdshl.Strata /dev/edu4rdshl/Strata \
|
||||
dev.edu4rdshl.Strata.Manager GetHistory uu 0 10
|
||||
|
||||
# Submit text:
|
||||
busctl --user call org.gnome.Strata /org/gnome/Strata \
|
||||
org.gnome.Strata.Manager SubmitItem say "text/plain;charset=utf-8" 5 104 101 108 108 111
|
||||
busctl --user call dev.edu4rdshl.Strata /dev/edu4rdshl/Strata \
|
||||
dev.edu4rdshl.Strata.Manager SubmitItem say "text/plain;charset=utf-8" 5 104 101 108 108 111
|
||||
|
||||
# Listen for new items:
|
||||
busctl --user monitor org.gnome.Strata
|
||||
busctl --user monitor dev.edu4rdshl.Strata
|
||||
```
|
||||
|
||||
## Supported clipboard payloads
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
/// Wayland clipboard monitor using the ext-data-control-v1 protocol (GNOME 47+)
|
||||
/// with a zwlr-data-control-v1 fallback for wlroots-based compositors.
|
||||
/// Wayland clipboard monitor using the ext-data-control-v1 protocol with a
|
||||
/// zwlr-data-control-v1 fallback for wlroots-based compositors. GNOME's Mutter
|
||||
/// exposes neither, so on GNOME this monitor does not bind and clipboard
|
||||
/// content arrives from the extension via Meta.Selection + `SubmitItem`.
|
||||
///
|
||||
/// Runs on a dedicated OS thread (NOT on the tokio runtime) to avoid blocking
|
||||
/// the async executor. Communicates clipboard change events to the tokio world
|
||||
|
|
@ -57,9 +59,9 @@ impl MonitorState {
|
|||
self.offers.entry(id).or_default().push(mime);
|
||||
}
|
||||
|
||||
fn commit_selection(&mut self, offer_id: ObjectId) {
|
||||
fn commit_selection(&mut self, offer_id: &ObjectId) {
|
||||
// Take the mime list for this offer (and discard stale in-flight offers).
|
||||
let mimes = self.offers.remove(&offer_id).unwrap_or_default();
|
||||
let mimes = self.offers.remove(offer_id).unwrap_or_default();
|
||||
self.offers.clear(); // discard any superseded offers
|
||||
if !mimes.is_empty() {
|
||||
let _ = self.tx.send(ClipboardChange { mime_types: mimes });
|
||||
|
|
@ -117,13 +119,15 @@ impl Dispatch<ExtDataControlDeviceV1, ()> for MonitorState {
|
|||
}
|
||||
ext_data_control_device_v1::Event::Selection { id: Some(offer) } => {
|
||||
let oid = offer.id();
|
||||
state.commit_selection(oid);
|
||||
state.commit_selection(&oid);
|
||||
// Politely destroy the offer - the compositor will clean up
|
||||
// the Wayland object.
|
||||
offer.destroy();
|
||||
}
|
||||
ext_data_control_device_v1::Event::Selection { id: None } => {
|
||||
// null id means "clipboard cleared" - ignore.
|
||||
// null id means "clipboard cleared". Drop any accumulated offers
|
||||
// so the map can't grow across copy-then-clear cycles.
|
||||
state.offers.clear();
|
||||
}
|
||||
ext_data_control_device_v1::Event::Finished => {
|
||||
tracing::warn!("ext-data-control device finished (compositor revoked access)");
|
||||
|
|
@ -179,10 +183,12 @@ impl Dispatch<ZwlrDataControlDeviceV1, ()> for MonitorState {
|
|||
}
|
||||
zwlr_data_control_device_v1::Event::Selection { id: Some(offer) } => {
|
||||
let oid = offer.id();
|
||||
state.commit_selection(oid);
|
||||
state.commit_selection(&oid);
|
||||
offer.destroy();
|
||||
}
|
||||
zwlr_data_control_device_v1::Event::Selection { id: None } => {}
|
||||
zwlr_data_control_device_v1::Event::Selection { id: None } => {
|
||||
state.offers.clear();
|
||||
}
|
||||
|
||||
zwlr_data_control_device_v1::Event::Finished => {
|
||||
tracing::warn!("zwlr-data-control device finished");
|
||||
|
|
@ -227,7 +233,7 @@ pub fn spawn(tx: UnboundedSender<ClipboardChange>) -> Result<()> {
|
|||
std::thread::Builder::new()
|
||||
.name("strata-wl-monitor".into())
|
||||
.spawn(move || {
|
||||
if let Err(e) = run_loop(conn, protocol, tx) {
|
||||
if let Err(e) = run_loop(&conn, protocol, tx) {
|
||||
tracing::error!("Clipboard monitor exited with error: {e:#}");
|
||||
}
|
||||
})?;
|
||||
|
|
@ -245,7 +251,9 @@ fn probe_protocol(conn: &Connection) -> Result<Protocol> {
|
|||
// A quick roundtrip to get the global list; no persistent state needed here.
|
||||
let (globals, _) = registry_queue_init::<MonitorState>(conn)?;
|
||||
|
||||
// ext-data-control-v1 preferred (GNOME 47+, KDE Plasma 6)
|
||||
// ext-data-control-v1 preferred (KDE Plasma 6 and other compositors that
|
||||
// expose it). GNOME's Mutter does NOT expose it, so this probe fails on
|
||||
// GNOME and ingest falls back to the extension's SubmitItem path.
|
||||
if globals.contents().with_list(|list| {
|
||||
list.iter()
|
||||
.any(|g| g.interface == "ext_data_control_manager_v1")
|
||||
|
|
@ -263,17 +271,18 @@ fn probe_protocol(conn: &Connection) -> Result<Protocol> {
|
|||
|
||||
bail!(
|
||||
"No supported clipboard control protocol found.\n\
|
||||
- GNOME: requires GNOME 47+ (Mutter implements ext-data-control-v1)\n\
|
||||
- GNOME: Mutter exposes neither protocol; ingest comes from the\n\
|
||||
extension via Meta.Selection + SubmitItem (this is expected).\n\
|
||||
- wlroots: requires zwlr-data-control-v1 (Sway, Hyprland, etc.)"
|
||||
);
|
||||
}
|
||||
|
||||
fn run_loop(
|
||||
conn: Connection,
|
||||
conn: &Connection,
|
||||
protocol: Protocol,
|
||||
tx: UnboundedSender<ClipboardChange>,
|
||||
) -> Result<()> {
|
||||
let (globals, mut queue) = registry_queue_init::<MonitorState>(&conn)?;
|
||||
let (globals, mut queue) = registry_queue_init::<MonitorState>(conn)?;
|
||||
let qh = queue.handle();
|
||||
let mut state = MonitorState::new(tx);
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ pub fn write_to_clipboard(req: WriteRequest) -> Result<()> {
|
|||
vec![
|
||||
MimeSource {
|
||||
source: Source::Bytes(bytes.clone().into()),
|
||||
mime_type: MimeType::Specific(mime.clone()),
|
||||
mime_type: MimeType::Specific(mime),
|
||||
},
|
||||
MimeSource {
|
||||
source: Source::Bytes(bytes.into()),
|
||||
|
|
|
|||
|
|
@ -1,9 +1,22 @@
|
|||
// SQLite is single-writer, and `lock_conn`'s guard is intentionally held for
|
||||
// each function's whole body -- the upsert's SELECT-then-INSERT must be atomic
|
||||
// under one lock. `significant_drop_tightening` would have us drop the guard
|
||||
// earlier, which would break that guarantee, so it is allowed for this module.
|
||||
#![allow(clippy::significant_drop_tightening)]
|
||||
|
||||
use anyhow::{Context, Result};
|
||||
use rusqlite::{params, Connection};
|
||||
use rusqlite::{params, Connection, OptionalExtension};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::path::Path;
|
||||
use std::sync::{Mutex, MutexGuard};
|
||||
|
||||
/// Characters of `content_text` returned as a display preview by the paginated
|
||||
/// and search list queries. The full payload is never sent over these paths --
|
||||
/// it is fetched on demand via `get_raw_item` / `GetItemContent` for paste-back.
|
||||
/// Keeping the trim in SQL means a page of large text items costs a few KB of
|
||||
/// JSON, not megabytes, and the work stays in the daemon.
|
||||
pub const PREVIEW_CHARS: usize = 200;
|
||||
|
||||
/// Metadata for a clipboard entry - does NOT include thumbnail bytes.
|
||||
/// Thumbnails are fetched separately via `get_thumbnail` for lazy loading.
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
|
|
@ -14,11 +27,11 @@ pub struct ItemMeta {
|
|||
pub content_text: Option<String>,
|
||||
pub source_app: Option<String>,
|
||||
pub created_at: i64,
|
||||
/// True if this item has a stored thumbnail (clients should call get_thumbnail to fetch it).
|
||||
/// True if this item has a stored thumbnail (clients should call `get_thumbnail` to fetch it).
|
||||
pub has_thumbnail: bool,
|
||||
}
|
||||
|
||||
/// A row as stored in SQLite (blob is raw bytes, not base64).
|
||||
/// A row as stored in `SQLite` (blob is raw bytes, not base64).
|
||||
#[allow(dead_code)]
|
||||
pub struct RawItem {
|
||||
pub id: String,
|
||||
|
|
@ -36,12 +49,12 @@ pub struct Db {
|
|||
|
||||
/// Acquire the DB lock, transparently recovering from poison.
|
||||
///
|
||||
/// A mutex is "poisoned" when a thread panics while holding it. For our SQLite
|
||||
/// A mutex is "poisoned" when a thread panics while holding it. For our `SQLite`
|
||||
/// connection this is safe to recover from because rusqlite uses RAII statements
|
||||
/// and transactions - any in-flight statement or transaction has already been
|
||||
/// rolled back by the time the panic unwinds past it. Without this recovery,
|
||||
/// a single panic anywhere in the daemon would permanently break ALL future
|
||||
/// database access (every subsequent .lock().unwrap() would panic too).
|
||||
/// database access (every subsequent .`lock().unwrap()` would panic too).
|
||||
fn lock_conn(m: &Mutex<Connection>) -> MutexGuard<'_, Connection> {
|
||||
match m.lock() {
|
||||
Ok(g) => g,
|
||||
|
|
@ -55,7 +68,7 @@ fn lock_conn(m: &Mutex<Connection>) -> MutexGuard<'_, Connection> {
|
|||
impl Db {
|
||||
pub fn open(path: &Path) -> Result<Self> {
|
||||
let conn = Connection::open(path)
|
||||
.with_context(|| format!("Opening SQLite database at {:?}", path))?;
|
||||
.with_context(|| format!("Opening SQLite database at {}", path.display()))?;
|
||||
|
||||
// Performance pragmas: WAL mode for concurrent reads, synchronous=NORMAL is safe
|
||||
// for a clipboard history (we can tolerate losing the last item on a crash).
|
||||
|
|
@ -133,14 +146,18 @@ impl Db {
|
|||
let conn = lock_conn(&self.conn);
|
||||
let now_ms = chrono_now_ms();
|
||||
|
||||
// Check for existing item with this hash.
|
||||
// Check for existing item with this hash. optional() maps "no match" to
|
||||
// None; a real read error propagates instead of being swallowed (which
|
||||
// would make a duplicate look new and then fail the INSERT on the UNIQUE
|
||||
// index with a confusing error).
|
||||
let existing: Option<String> = conn
|
||||
.query_row(
|
||||
"SELECT id FROM clipboard_history WHERE content_hash = ?1",
|
||||
params![content_hash],
|
||||
|row| row.get(0),
|
||||
)
|
||||
.ok();
|
||||
.optional()
|
||||
.context("Checking for existing item")?;
|
||||
|
||||
if let Some(id) = existing {
|
||||
conn.execute(
|
||||
|
|
@ -174,13 +191,14 @@ impl Db {
|
|||
return Ok(Vec::new());
|
||||
}
|
||||
|
||||
let mut stmt = conn.prepare(
|
||||
"SELECT id, mime_type, content_text, source_app, created_at,
|
||||
let sql = format!(
|
||||
"SELECT id, mime_type, substr(content_text, 1, {PREVIEW_CHARS}), source_app, created_at,
|
||||
thumbnail_blob IS NOT NULL AS has_thumb
|
||||
FROM clipboard_history
|
||||
ORDER BY created_at DESC
|
||||
LIMIT ?1 OFFSET ?2",
|
||||
)?;
|
||||
ORDER BY created_at DESC, rowid DESC
|
||||
LIMIT ?1 OFFSET ?2"
|
||||
);
|
||||
let mut stmt = conn.prepare(&sql)?;
|
||||
|
||||
let items = stmt
|
||||
.query_map(params![effective_limit as i64, offset as i64], |row| {
|
||||
|
|
@ -198,9 +216,9 @@ impl Db {
|
|||
Ok(items)
|
||||
}
|
||||
|
||||
/// Full-text search over content_text. Only text items can match - images
|
||||
/// Full-text search over `content_text`. Only text items can match - images
|
||||
/// and other non-text content are NOT indexed and never appear in results.
|
||||
/// Empty query returns []; callers should use get_history_page for that.
|
||||
/// Empty query returns []; callers should use `get_history_page` for that.
|
||||
pub fn search_history(&self, query: &str, limit: usize) -> Result<Vec<ItemMeta>> {
|
||||
let conn = lock_conn(&self.conn);
|
||||
|
||||
|
|
@ -211,7 +229,7 @@ impl Db {
|
|||
.map(|t| {
|
||||
// Escape embedded double-quotes by doubling them per FTS5 syntax.
|
||||
let escaped = t.replace('"', "\"\"");
|
||||
format!("\"{}\"*", escaped)
|
||||
format!("\"{escaped}\"*")
|
||||
})
|
||||
.collect();
|
||||
|
||||
|
|
@ -220,14 +238,15 @@ impl Db {
|
|||
}
|
||||
let fts_query = tokens.join(" ");
|
||||
|
||||
let mut stmt = conn.prepare(
|
||||
"SELECT h.id, h.mime_type, h.content_text, h.source_app, h.created_at,
|
||||
let sql = format!(
|
||||
"SELECT h.id, h.mime_type, substr(h.content_text, 1, {PREVIEW_CHARS}), h.source_app, h.created_at,
|
||||
h.thumbnail_blob IS NOT NULL AS has_thumb
|
||||
FROM clipboard_history h
|
||||
WHERE h.rowid IN (SELECT rowid FROM clipboard_fts WHERE clipboard_fts MATCH ?1)
|
||||
ORDER BY h.created_at DESC
|
||||
LIMIT ?2",
|
||||
)?;
|
||||
ORDER BY h.created_at DESC, h.rowid DESC
|
||||
LIMIT ?2"
|
||||
);
|
||||
let mut stmt = conn.prepare(&sql)?;
|
||||
|
||||
let items = stmt
|
||||
.query_map(params![fts_query, limit as i64], |row| {
|
||||
|
|
@ -249,39 +268,43 @@ impl Db {
|
|||
/// (text item, or doesn't exist).
|
||||
pub fn get_thumbnail(&self, id: &str) -> Result<Option<Vec<u8>>> {
|
||||
let conn = lock_conn(&self.conn);
|
||||
let blob: Option<Option<Vec<u8>>> = conn
|
||||
// thumbnail_blob is itself nullable, so the row yields Option<Vec<u8>>.
|
||||
// optional() maps a missing row to Ok(None); real errors propagate.
|
||||
let blob = conn
|
||||
.query_row(
|
||||
"SELECT thumbnail_blob FROM clipboard_history WHERE id = ?1",
|
||||
params![id],
|
||||
|row| row.get(0),
|
||||
|row| row.get::<_, Option<Vec<u8>>>(0),
|
||||
)
|
||||
.ok();
|
||||
.optional()
|
||||
.context("Fetching thumbnail")?;
|
||||
Ok(blob.flatten())
|
||||
}
|
||||
|
||||
/// Fetch raw item content for clipboard write-back. Does not load
|
||||
/// thumbnail_blob -- callers only need the original payload.
|
||||
/// `thumbnail_blob` -- callers only need the original payload.
|
||||
pub fn get_raw_item(&self, id: &str) -> Result<Option<RawItem>> {
|
||||
let conn = lock_conn(&self.conn);
|
||||
let result = conn
|
||||
.query_row(
|
||||
"SELECT id, mime_type, content_text, content_blob, source_app, created_at
|
||||
// optional() maps a missing row to Ok(None); real errors propagate
|
||||
// instead of being silently swallowed as "not found".
|
||||
conn.query_row(
|
||||
"SELECT id, mime_type, content_text, content_blob, source_app, created_at
|
||||
FROM clipboard_history WHERE id = ?1",
|
||||
params![id],
|
||||
|row| {
|
||||
Ok(RawItem {
|
||||
id: row.get(0)?,
|
||||
mime_type: row.get(1)?,
|
||||
content_text: row.get(2)?,
|
||||
content_blob: row.get(3)?,
|
||||
thumbnail_blob: None,
|
||||
source_app: row.get(4)?,
|
||||
created_at: row.get(5)?,
|
||||
})
|
||||
},
|
||||
)
|
||||
.ok();
|
||||
Ok(result)
|
||||
params![id],
|
||||
|row| {
|
||||
Ok(RawItem {
|
||||
id: row.get(0)?,
|
||||
mime_type: row.get(1)?,
|
||||
content_text: row.get(2)?,
|
||||
content_blob: row.get(3)?,
|
||||
thumbnail_blob: None,
|
||||
source_app: row.get(4)?,
|
||||
created_at: row.get(5)?,
|
||||
})
|
||||
},
|
||||
)
|
||||
.optional()
|
||||
.context("Fetching clipboard item")
|
||||
}
|
||||
|
||||
pub fn delete_item(&self, id: &str) -> Result<bool> {
|
||||
|
|
@ -297,7 +320,7 @@ impl Db {
|
|||
}
|
||||
|
||||
/// Prune history to `max_history` most recent items. Returns the IDs of
|
||||
/// items that were deleted, so the caller can emit ItemDeleted signals
|
||||
/// items that were deleted, so the caller can emit `ItemDeleted` signals
|
||||
/// (lets clients clean up per-item caches like thumbnail files).
|
||||
pub fn prune(&self, max_history: usize) -> Result<Vec<String>> {
|
||||
let conn = lock_conn(&self.conn);
|
||||
|
|
@ -311,7 +334,7 @@ impl Db {
|
|||
let mut stmt = conn.prepare(
|
||||
"SELECT id FROM clipboard_history
|
||||
WHERE id NOT IN (
|
||||
SELECT id FROM clipboard_history ORDER BY created_at DESC LIMIT ?1
|
||||
SELECT id FROM clipboard_history ORDER BY created_at DESC, rowid DESC LIMIT ?1
|
||||
)",
|
||||
)?;
|
||||
let ids: Vec<String> = stmt
|
||||
|
|
@ -322,10 +345,7 @@ impl Db {
|
|||
}
|
||||
// Delete by collected IDs so the ORDER BY subquery runs only once.
|
||||
let placeholders = ids.iter().map(|_| "?").collect::<Vec<_>>().join(", ");
|
||||
let sql = format!(
|
||||
"DELETE FROM clipboard_history WHERE id IN ({})",
|
||||
placeholders
|
||||
);
|
||||
let sql = format!("DELETE FROM clipboard_history WHERE id IN ({placeholders})");
|
||||
conn.execute(&sql, rusqlite::params_from_iter(ids.iter()))?;
|
||||
Ok(ids)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,22 +1,22 @@
|
|||
use std::sync::atomic::{AtomicUsize, Ordering};
|
||||
use std::sync::Arc;
|
||||
|
||||
use zbus::{interface, object_server::SignalContext};
|
||||
use zbus::{interface, object_server::SignalEmitter};
|
||||
|
||||
use crate::db::{Db, RawItem};
|
||||
|
||||
/// Maximum thumbnail dimension for images (px). Larger images are resized down.
|
||||
pub const THUMB_PX: u32 = 200;
|
||||
/// Default maximum raw image size to accept (bytes). Overridable via SetConfig.
|
||||
/// Default maximum raw image size to accept (bytes). Overridable via `SetConfig`.
|
||||
pub const DEFAULT_MAX_IMAGE_BYTES: usize = 5 * 1024 * 1024;
|
||||
/// Default maximum text size to accept. Overridable via SetConfig.
|
||||
/// Default maximum text size to accept. Overridable via `SetConfig`.
|
||||
pub const DEFAULT_MAX_TEXT_BYTES: usize = 1024 * 1024;
|
||||
/// Default maximum history item count. Overridable via SetConfig.
|
||||
/// Default maximum history item count. Overridable via `SetConfig`.
|
||||
pub const DEFAULT_MAX_HISTORY: usize = 200;
|
||||
|
||||
/// Runtime-configurable limits shared between the D-Bus service and the
|
||||
/// clipboard processing tasks. All three are read on every ingest / prune
|
||||
/// call, so updates via SetConfig take effect immediately.
|
||||
/// call, so updates via `SetConfig` take effect immediately.
|
||||
#[derive(Clone)]
|
||||
pub struct Limits {
|
||||
pub max_history: Arc<AtomicUsize>,
|
||||
|
|
@ -57,10 +57,18 @@ pub struct StrataManager {
|
|||
pub shutdown_tx: tokio::sync::mpsc::UnboundedSender<()>,
|
||||
}
|
||||
|
||||
#[interface(name = "org.gnome.Strata.Manager")]
|
||||
#[interface(name = "dev.edu4rdshl.Strata.Manager")]
|
||||
impl StrataManager {
|
||||
/// Called by the GJS extension when it detects a clipboard change via Meta.Selection.
|
||||
/// `content` is the raw bytes of the clipboard payload (D-Bus `ay`).
|
||||
///
|
||||
/// Trust note: the password-manager hint (`x-kde-passwordManagerHint`) is
|
||||
/// honored client-side by the extension before it ever calls this, but the
|
||||
/// hint is not forwarded, so this method cannot re-check it. Treat callers of
|
||||
/// `SubmitItem` as trusted (the session bus is per-user). Forwarding the
|
||||
/// sensitivity flag to enforce it here is left for a future contract change.
|
||||
// async is required by the zbus #[interface] method signature, not by the body.
|
||||
#[allow(clippy::unused_async)]
|
||||
async fn submit_item(&self, mime_type: String, content: Vec<u8>) -> zbus::fdo::Result<()> {
|
||||
self.submit_tx
|
||||
.send(SubmitRequest {
|
||||
|
|
@ -69,8 +77,9 @@ impl StrataManager {
|
|||
})
|
||||
.map_err(|e| zbus::fdo::Error::Failed(e.to_string()))
|
||||
}
|
||||
/// Return a page of recent items as JSON metadata (no inline thumbnail bytes).
|
||||
/// Clients call GetThumbnail(id) lazily for items with has_thumbnail=true.
|
||||
/// Return a page of recent items as JSON metadata (no inline thumbnail bytes,
|
||||
/// `content_text` truncated to a preview). Clients call GetThumbnail(id) lazily
|
||||
/// for items with `has_thumbnail=true` and GetItemContent(id) for full content.
|
||||
/// `offset` is from the most recent item (0 = newest).
|
||||
async fn get_history(&self, offset: u32, limit: u32) -> zbus::fdo::Result<String> {
|
||||
let db = self.db.clone();
|
||||
|
|
@ -86,7 +95,7 @@ impl StrataManager {
|
|||
}
|
||||
|
||||
/// Full-text search across the entire DB. Empty query returns []; callers
|
||||
/// should fall back to GetHistory in that case.
|
||||
/// should fall back to `GetHistory` in that case.
|
||||
async fn search_history(&self, query: String, limit: u32) -> zbus::fdo::Result<String> {
|
||||
let db = self.db.clone();
|
||||
let items = tokio::task::spawn_blocking(move || db.search_history(&query, limit as usize))
|
||||
|
|
@ -166,7 +175,7 @@ impl StrataManager {
|
|||
async fn delete_item(
|
||||
&self,
|
||||
id: String,
|
||||
#[zbus(signal_context)] ctx: SignalContext<'_>,
|
||||
#[zbus(signal_context)] ctx: SignalEmitter<'_>,
|
||||
) -> zbus::fdo::Result<()> {
|
||||
let db = self.db.clone();
|
||||
let id_clone = id.clone();
|
||||
|
|
@ -183,7 +192,7 @@ impl StrataManager {
|
|||
/// Remove all items from history.
|
||||
async fn clear_history(
|
||||
&self,
|
||||
#[zbus(signal_context)] ctx: SignalContext<'_>,
|
||||
#[zbus(signal_context)] ctx: SignalEmitter<'_>,
|
||||
) -> zbus::fdo::Result<()> {
|
||||
let db = self.db.clone();
|
||||
tokio::task::spawn_blocking(move || db.clear_history())
|
||||
|
|
@ -197,13 +206,14 @@ impl StrataManager {
|
|||
}
|
||||
|
||||
/// Push runtime limits from the front-end. Takes effect immediately.
|
||||
/// All three values are absolute (max_text and max_image are bytes,
|
||||
/// All three values are absolute (`max_text` and `max_image` are bytes,
|
||||
/// not MB). 0 means "leave unchanged" for that field.
|
||||
async fn set_config(
|
||||
&self,
|
||||
max_history: u32,
|
||||
max_text_bytes: u32,
|
||||
max_image_bytes: u32,
|
||||
#[zbus(signal_context)] ctx: SignalEmitter<'_>,
|
||||
) -> zbus::fdo::Result<()> {
|
||||
use std::sync::atomic::Ordering;
|
||||
if max_history > 0 {
|
||||
|
|
@ -227,10 +237,29 @@ impl StrataManager {
|
|||
self.limits.max_text_bytes(),
|
||||
self.limits.max_image_bytes(),
|
||||
);
|
||||
|
||||
// Lowering max_history should shrink stored history immediately, not
|
||||
// wait until the next copy triggers a prune. Prune now and emit
|
||||
// ItemDeleted for each removed id so clients can drop their caches.
|
||||
if max_history > 0 {
|
||||
let db = self.db.clone();
|
||||
let max = max_history as usize;
|
||||
let pruned = tokio::task::spawn_blocking(move || db.prune(max))
|
||||
.await
|
||||
.map_err(|e| zbus::fdo::Error::Failed(e.to_string()))?
|
||||
.map_err(|e| zbus::fdo::Error::Failed(e.to_string()))?;
|
||||
for id in &pruned {
|
||||
if let Err(e) = Self::item_deleted(&ctx, id).await {
|
||||
tracing::warn!("Emitting ItemDeleted for pruned id={}: {}", id, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Gracefully shut down the daemon.
|
||||
// async is required by the zbus #[interface] method signature, not by the body.
|
||||
#[allow(clippy::unused_async)]
|
||||
async fn shutdown(&self) {
|
||||
tracing::info!("Shutdown requested via D-Bus");
|
||||
// Signal the main loop to exit. The reply is sent before the process exits
|
||||
|
|
@ -243,12 +272,12 @@ impl StrataManager {
|
|||
// -----------------------------------------------------------------
|
||||
|
||||
/// Emitted when a new item is stored (after dedup + thumbnail generation).
|
||||
/// `preview` is a text excerpt (≤120 chars) for text items, or empty for
|
||||
/// `preview` is a text excerpt (≤ `PREVIEW_CHARS`) for text items, or empty for
|
||||
/// images and other binary types - clients should call GetThumbnail(id) to
|
||||
/// fetch image thumbnails lazily.
|
||||
#[zbus(signal)]
|
||||
pub async fn item_added(
|
||||
ctx: &SignalContext<'_>,
|
||||
ctx: &SignalEmitter<'_>,
|
||||
id: &str,
|
||||
mime_type: &str,
|
||||
preview: &str,
|
||||
|
|
@ -256,9 +285,9 @@ impl StrataManager {
|
|||
|
||||
/// Emitted when an item is removed.
|
||||
#[zbus(signal)]
|
||||
pub async fn item_deleted(ctx: &SignalContext<'_>, id: &str) -> zbus::Result<()>;
|
||||
pub async fn item_deleted(ctx: &SignalEmitter<'_>, id: &str) -> zbus::Result<()>;
|
||||
|
||||
/// Emitted when the entire history is cleared.
|
||||
#[zbus(signal)]
|
||||
pub async fn history_cleared(ctx: &SignalContext<'_>) -> zbus::Result<()>;
|
||||
pub async fn history_cleared(ctx: &SignalEmitter<'_>) -> zbus::Result<()>;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,32 +49,41 @@ async fn main() -> Result<()> {
|
|||
};
|
||||
|
||||
let dbus_conn = zbus::connection::Builder::session()?
|
||||
.serve_at("/org/gnome/Strata", manager)?
|
||||
.serve_at("/dev/edu4rdshl/Strata", manager)?
|
||||
.build()
|
||||
.await
|
||||
.context("Building D-Bus connection")?;
|
||||
|
||||
// Request the well-known name with ReplaceExisting so a new instance always
|
||||
// wins the race against the outgoing instance during extension reload.
|
||||
// Single-instance daemon: request the name with DoNotQueue. The extension
|
||||
// spawns exactly one daemon and skips spawning if the name is already owned,
|
||||
// so if the name IS taken here, another instance is already serving - the
|
||||
// request returns an error (rather than silently queuing, which would leave
|
||||
// us running without owning the name while clients talk to the other one)
|
||||
// and we exit. We deliberately do NOT use ReplaceExisting: stealing the name
|
||||
// would orphan the running instance (zbus does not terminate a replaced
|
||||
// owner), so we let the existing one keep it and bow out.
|
||||
dbus_conn
|
||||
.request_name_with_flags(
|
||||
"org.gnome.Strata",
|
||||
zbus::fdo::RequestNameFlags::ReplaceExisting.into(),
|
||||
"dev.edu4rdshl.Strata",
|
||||
zbus::fdo::RequestNameFlags::DoNotQueue.into(),
|
||||
)
|
||||
.await
|
||||
.context("Acquiring D-Bus name org.gnome.Strata")?;
|
||||
.context("Acquiring D-Bus name dev.edu4rdshl.Strata (is another instance running?)")?;
|
||||
|
||||
tracing::info!("D-Bus service registered as org.gnome.Strata");
|
||||
tracing::info!("D-Bus service registered as dev.edu4rdshl.Strata");
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Clipboard monitor (Wayland protocols - optional, soft-fail on GNOME)
|
||||
// GJS provides clipboard content via SubmitItem when this is unavailable.
|
||||
// Clipboard monitor (Wayland protocols - optional, soft-fail on GNOME).
|
||||
// GNOME's Mutter does not expose ext-data-control-v1 or zwlr-data-control-v1,
|
||||
// so this fails to bind there and the extension feeds content via SubmitItem
|
||||
// instead. On wlroots compositors (Sway, Hyprland) the monitor is the path.
|
||||
// -----------------------------------------------------------------------
|
||||
match clipboard::monitor::spawn(clip_tx) {
|
||||
Ok(()) => tracing::info!("Wayland clipboard monitor started"),
|
||||
Err(_) => tracing::info!(
|
||||
if clipboard::monitor::spawn(clip_tx).is_ok() {
|
||||
tracing::info!("Wayland clipboard monitor started");
|
||||
} else {
|
||||
tracing::info!(
|
||||
"Wayland clipboard monitor unavailable, using GJS Meta.Selection path (expected on GNOME)"
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
|
|
@ -150,9 +159,7 @@ fn pick_mime(mimes: &[String]) -> Option<&str> {
|
|||
"image/webp",
|
||||
"image/bmp",
|
||||
"image/tiff",
|
||||
"image/avif",
|
||||
"image/x-icon",
|
||||
"image/svg+xml",
|
||||
// Plain text (UTF-8 preferred, then locale, then X11 legacy aliases).
|
||||
// Ranked above rich-text so editors that expose both text/plain and
|
||||
// text/html give us the raw source, not styled markup.
|
||||
|
|
@ -194,12 +201,11 @@ async fn process_change(
|
|||
tracing::debug!("Skipping clipboard change marked as sensitive");
|
||||
return Ok(());
|
||||
}
|
||||
let mime = match pick_mime(mime_types) {
|
||||
Some(m) => m.to_string(),
|
||||
None => {
|
||||
tracing::debug!("No usable MIME type in {:?}", mime_types);
|
||||
return Ok(());
|
||||
}
|
||||
let mime = if let Some(m) = pick_mime(mime_types) {
|
||||
m.to_string()
|
||||
} else {
|
||||
tracing::debug!("No usable MIME type in {:?}", mime_types);
|
||||
return Ok(());
|
||||
};
|
||||
|
||||
tracing::debug!("Processing Wayland clipboard change, MIME: {}", mime);
|
||||
|
|
@ -269,7 +275,10 @@ async fn process_bytes(
|
|||
(None, Some(raw_bytes), Some(thumb_bytes), String::new())
|
||||
} else {
|
||||
let text = String::from_utf8_lossy(&raw_bytes).into_owned();
|
||||
let preview: String = text.chars().take(120).collect();
|
||||
// Same preview length as the paginated/search queries (db::PREVIEW_CHARS),
|
||||
// so a just-copied row and the same row after a reload carry identical
|
||||
// text. `take` is lazy, so this never scans past the first N chars.
|
||||
let preview: String = text.chars().take(db::PREVIEW_CHARS).collect();
|
||||
(Some(text), None, None, preview)
|
||||
};
|
||||
|
||||
|
|
@ -305,16 +314,16 @@ async fn process_bytes(
|
|||
if is_new {
|
||||
let iface = conn
|
||||
.object_server()
|
||||
.interface::<_, StrataManager>("/org/gnome/Strata")
|
||||
.interface::<_, StrataManager>("/dev/edu4rdshl/Strata")
|
||||
.await
|
||||
.context("Getting StrataManager interface ref")?;
|
||||
|
||||
StrataManager::item_added(iface.signal_context(), &id, &mime, &preview)
|
||||
StrataManager::item_added(iface.signal_emitter(), &id, &mime, &preview)
|
||||
.await
|
||||
.context("Emitting ItemAdded signal")?;
|
||||
|
||||
for pid in &pruned_ids {
|
||||
if let Err(e) = StrataManager::item_deleted(iface.signal_context(), pid).await {
|
||||
if let Err(e) = StrataManager::item_deleted(iface.signal_emitter(), pid).await {
|
||||
tracing::warn!("Emitting ItemDeleted for pruned id={}: {}", pid, e);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,6 +52,7 @@ Open with `gnome-extensions prefs strata@edu4rdshl.dev`:
|
|||
- **Maximum image size** (1–100 MB, larger items are not stored)
|
||||
|
||||
**Appearance**
|
||||
- **Theme** (Automatic / Light / Dark; Automatic follows the system light/dark preference)
|
||||
- **Panel width** (pixels)
|
||||
- **Panel max height** (pixels, list scrolls past this)
|
||||
- **Move activated item to top**
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import Gio from 'gi://Gio';
|
|||
|
||||
const STRATA_IFACE_XML = `
|
||||
<node>
|
||||
<interface name="org.gnome.Strata.Manager">
|
||||
<interface name="dev.edu4rdshl.Strata.Manager">
|
||||
|
||||
<method name="GetHistory">
|
||||
<arg type="u" direction="in" name="offset"/>
|
||||
|
|
@ -75,5 +75,5 @@ const STRATA_IFACE_XML = `
|
|||
|
||||
export const StrataProxy = Gio.DBusProxy.makeProxyWrapper(STRATA_IFACE_XML);
|
||||
|
||||
export const BUS_NAME = 'org.gnome.Strata';
|
||||
export const OBJECT_PATH = '/org/gnome/Strata';
|
||||
export const BUS_NAME = 'dev.edu4rdshl.Strata';
|
||||
export const OBJECT_PATH = '/dev/edu4rdshl/Strata';
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ import * as PanelMenu from 'resource:///org/gnome/shell/ui/panelMenu.js';
|
|||
|
||||
import { StrataProxy, BUS_NAME, OBJECT_PATH } from './dbus.js';
|
||||
import { StrataPanel } from './ui/panel.js';
|
||||
import { logError } from './util.js';
|
||||
|
||||
export default class StrataExtension extends Extension {
|
||||
/** @type {Gio.Subprocess | null} */
|
||||
|
|
@ -21,6 +22,9 @@ export default class StrataExtension extends Extension {
|
|||
_daemonRestartAttempts = 0;
|
||||
_shuttingDown = false;
|
||||
_daemonRestartTimerId = null;
|
||||
/** True while a GetNameOwner check before spawning is in flight, so an
|
||||
* overlapping respawn attempt can't spawn a second daemon. */
|
||||
_spawnPending = false;
|
||||
|
||||
/** @type {StrataPanel | null} */
|
||||
_panel = null;
|
||||
|
|
@ -31,18 +35,12 @@ export default class StrataExtension extends Extension {
|
|||
_itemDeletedId = null;
|
||||
_historyClearedId = null;
|
||||
|
||||
/** @type {number | null} focused-window signal connection ID */
|
||||
_focusSignalId = null;
|
||||
|
||||
/** @type {string} WM class of the currently focused app (lower-cased) */
|
||||
_currentFocusedApp = '';
|
||||
|
||||
/** @type {object | null} PanelMenu.Button indicator */
|
||||
_indicator = null;
|
||||
|
||||
/** @type {number | null} Meta.Selection owner-changed signal ID */
|
||||
_selectionChangedId = null;
|
||||
|
||||
/** @type {number | null} Debounce timer for clipboard reads */
|
||||
_clipboardDebounceId = null;
|
||||
|
||||
|
|
@ -53,45 +51,28 @@ export default class StrataExtension extends Extension {
|
|||
_excludedApps = [];
|
||||
_pendingSignalId = null;
|
||||
|
||||
/** @type {boolean} Re-entrancy guard for signal processing */
|
||||
#busy = false;
|
||||
|
||||
/** @type {number | null} Keyboard shortcut binding ID */
|
||||
_shortcutId = null;
|
||||
/** @type {Set<number>} Pending GLib.idle_add source IDs to flush on disable. */
|
||||
_idleSources = new Set();
|
||||
|
||||
enable() {
|
||||
this._shuttingDown = false;
|
||||
this._daemonRestartAttempts = 0;
|
||||
|
||||
this._settings = this.getSettings();
|
||||
this._excludedApps = this._settings.get_strv('excluded-apps');
|
||||
this._settings.connect('changed::excluded-apps', () => {
|
||||
this._excludedApps = this._settings.get_strv('excluded-apps');
|
||||
});
|
||||
|
||||
this._excludedApps = this._readExcluded();
|
||||
this._readSizeLimits();
|
||||
this._configChangedIds = [
|
||||
this._settings.connect('changed::max-history', () => { this._readSizeLimits(); this._pushConfig(); }),
|
||||
this._settings.connect('changed::max-text-mb', () => { this._readSizeLimits(); this._pushConfig(); }),
|
||||
this._settings.connect('changed::max-image-mb', () => { this._readSizeLimits(); this._pushConfig(); }),
|
||||
];
|
||||
this._settings.connectObject(
|
||||
'changed::excluded-apps', () => { this._excludedApps = this._readExcluded(); },
|
||||
'changed::max-history', () => { this._readSizeLimits(); this._pushConfig(); },
|
||||
'changed::max-text-mb', () => { this._readSizeLimits(); this._pushConfig(); },
|
||||
'changed::max-image-mb', () => { this._readSizeLimits(); this._pushConfig(); },
|
||||
this);
|
||||
|
||||
// 1. Top-bar indicator icon.
|
||||
this._addIndicator();
|
||||
|
||||
// 2. Spawn the Rust daemon.
|
||||
this._spawnDaemon();
|
||||
|
||||
// 3. Connect D-Bus proxy (async - doesn't block if daemon isn't ready yet).
|
||||
this._connectProxy();
|
||||
|
||||
// 4. Track focused window (lightweight - no clipboard I/O).
|
||||
this._connectFocusTracking();
|
||||
|
||||
// 5. Monitor clipboard via Meta.Selection (GNOME-native, no Wayland protocol needed).
|
||||
this._connectClipboardMonitor();
|
||||
|
||||
// 6. Register keyboard shortcut.
|
||||
this._registerShortcut();
|
||||
}
|
||||
|
||||
|
|
@ -102,21 +83,16 @@ export default class StrataExtension extends Extension {
|
|||
GLib.Source.remove(this._daemonRestartTimerId);
|
||||
this._daemonRestartTimerId = null;
|
||||
}
|
||||
// Clean up in reverse order.
|
||||
this._unregisterShortcut();
|
||||
this._disconnectClipboardMonitor();
|
||||
this._disconnectFocusTracking();
|
||||
this._disconnectSignals();
|
||||
if (this._proxyOwnerId && this._proxy) {
|
||||
this._proxy.disconnect(this._proxyOwnerId);
|
||||
this._proxyOwnerId = 0;
|
||||
}
|
||||
if (this._configChangedIds && this._settings) {
|
||||
for (const id of this._configChangedIds) this._settings.disconnect(id);
|
||||
this._configChangedIds = null;
|
||||
}
|
||||
this._clearIdleSources();
|
||||
this._proxy?.disconnectObject(this);
|
||||
this._settings?.disconnectObject(this);
|
||||
this._panel?.destroy();
|
||||
this._panel = null;
|
||||
this._indicator?.disconnectObject(this);
|
||||
this._indicator?.destroy();
|
||||
this._indicator = null;
|
||||
this._stopDaemon();
|
||||
|
|
@ -133,20 +109,19 @@ export default class StrataExtension extends Extension {
|
|||
style_class: 'system-status-icon',
|
||||
});
|
||||
this._indicator.add_child(icon);
|
||||
this._indicator.connect('button-press-event', () => {
|
||||
this._indicator.connectObject('button-press-event', () => {
|
||||
this._panel?.toggle();
|
||||
return false; // EVENT_PROPAGATE
|
||||
});
|
||||
}, this);
|
||||
Main.panel.addToStatusArea('strata', this._indicator);
|
||||
}
|
||||
|
||||
|
||||
_connectClipboardMonitor() {
|
||||
const selection = global.display.get_selection();
|
||||
this._selectionChangedId = selection.connect('owner-changed', (_sel, type) => {
|
||||
global.display.get_selection().connectObject('owner-changed', (_sel, type) => {
|
||||
if (type !== Meta.SelectionType.SELECTION_CLIPBOARD) return;
|
||||
this._scheduleClipboardRead();
|
||||
});
|
||||
}, this);
|
||||
}
|
||||
|
||||
_disconnectClipboardMonitor() {
|
||||
|
|
@ -157,10 +132,7 @@ export default class StrataExtension extends Extension {
|
|||
this._clipboardDebounceId = null;
|
||||
}
|
||||
this._clipboardTransferPending = false;
|
||||
if (this._selectionChangedId !== null) {
|
||||
global.display.get_selection().disconnect(this._selectionChangedId);
|
||||
this._selectionChangedId = null;
|
||||
}
|
||||
global.display.get_selection().disconnectObject(this);
|
||||
}
|
||||
|
||||
/** Debounce entry point - coalesces rapid clipboard changes (e.g. from
|
||||
|
|
@ -177,8 +149,6 @@ export default class StrataExtension extends Extension {
|
|||
});
|
||||
}
|
||||
|
||||
/** Single in-flight transfer at a time - prevents queuing multiple concurrent
|
||||
* transfer_async + base64_encode operations that would stall the main thread. */
|
||||
_readClipboard() {
|
||||
if (this._clipboardTransferPending) return;
|
||||
const selection = global.display.get_selection();
|
||||
|
|
@ -187,6 +157,7 @@ export default class StrataExtension extends Extension {
|
|||
// copied secrets with this hint mime. Honoring it lets users keep
|
||||
// their passwords out of clipboard history.
|
||||
if (mimes.includes('x-kde-passwordManagerHint')) return;
|
||||
if (this._isExcluded(this._currentFocusedApp)) return;
|
||||
const mime = this._pickMime(mimes);
|
||||
if (!mime) return;
|
||||
|
||||
|
|
@ -206,14 +177,10 @@ export default class StrataExtension extends Extension {
|
|||
const bytes = outputStream.steal_as_bytes();
|
||||
const size = bytes.get_size();
|
||||
if (size === 0) return;
|
||||
const MAX_TEXT = this._maxTextBytes;
|
||||
const MAX_IMAGE = this._maxImageBytes;
|
||||
if (size > (mime.startsWith('image/') ? MAX_IMAGE : MAX_TEXT)) return;
|
||||
// Send raw bytes as a D-Bus `ay` so we avoid blocking
|
||||
// synchronous base64 work on the GJS main thread.
|
||||
if (size > (mime.startsWith('image/') ? this._maxImageBytes : this._maxTextBytes)) return;
|
||||
this._proxy?.SubmitItemRemote(mime, bytes.get_data(), () => {});
|
||||
} catch (e) {
|
||||
console.error('[Strata] Clipboard read error:', e.message);
|
||||
logError('Clipboard read error', e);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
|
@ -222,10 +189,8 @@ export default class StrataExtension extends Extension {
|
|||
/** Pick the best MIME type to store from the offered list (mirrors Rust pick_mime). */
|
||||
_pickMime(mimes) {
|
||||
const PREFERRED = [
|
||||
// Raster images (size-capped at MAX_IMAGE).
|
||||
'image/png', 'image/jpeg', 'image/jpg', 'image/gif', 'image/webp',
|
||||
'image/bmp', 'image/tiff', 'image/avif', 'image/x-icon',
|
||||
'image/svg+xml',
|
||||
'image/bmp', 'image/tiff', 'image/x-icon',
|
||||
// Plain text (UTF-8 preferred, then locale, then X11 legacy aliases).
|
||||
// Ranked above rich-text so editors that expose both text/plain and
|
||||
// text/html give us raw source, not styled markup.
|
||||
|
|
@ -243,15 +208,18 @@ export default class StrataExtension extends Extension {
|
|||
];
|
||||
for (const want of PREFERRED)
|
||||
if (mimes.includes(want)) return want;
|
||||
// Allowlist only: see comment in pick_mime (daemon). Reading unknown
|
||||
// mime types could pull a 1 GB blob into Shell memory before we can
|
||||
// size-check it.
|
||||
// Allowlist only: see pick_mime in the daemon. Unknown mime types are skipped.
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
_spawnDaemon() {
|
||||
if (this._shuttingDown) return;
|
||||
// Coalesce overlapping spawn attempts: the async GetNameOwner check below
|
||||
// can still be in flight when the backoff timer fires _spawnDaemon again.
|
||||
// Without this guard both could call _doSpawnDaemon and spawn two daemons.
|
||||
if (this._spawnPending) return;
|
||||
this._spawnPending = true;
|
||||
|
||||
// Check if a daemon is already running (e.g. via systemd user service).
|
||||
// If the D-Bus name is already owned we must not spawn a second instance.
|
||||
|
|
@ -261,12 +229,12 @@ export default class StrataExtension extends Extension {
|
|||
new GLib.Variant('(s)', [BUS_NAME]),
|
||||
null, Gio.DBusCallFlags.NONE, 2000, null,
|
||||
(_conn, result) => {
|
||||
this._spawnPending = false;
|
||||
if (this._shuttingDown) return;
|
||||
try {
|
||||
_conn.call_finish(result);
|
||||
// Name already owned - daemon managed externally (systemd etc).
|
||||
console.log('[Strata] daemon already running, skipping spawn');
|
||||
} catch (_) {
|
||||
// Name not owned - spawn it ourselves.
|
||||
// Name already owned (e.g. systemd user service) - don't spawn a second instance.
|
||||
} catch {
|
||||
this._doSpawnDaemon();
|
||||
}
|
||||
}
|
||||
|
|
@ -277,10 +245,7 @@ export default class StrataExtension extends Extension {
|
|||
if (this._shuttingDown) return;
|
||||
const daemonPath = GLib.find_program_in_path('strata-daemon');
|
||||
if (!daemonPath) {
|
||||
console.error(
|
||||
'[Strata] strata-daemon not found in PATH. ' +
|
||||
'Install the strata-daemon package or place the binary in your PATH.'
|
||||
);
|
||||
logError('strata-daemon not found in PATH. Install the strata-daemon package or place the binary in your PATH.');
|
||||
this._notifyDaemonMissing();
|
||||
return;
|
||||
}
|
||||
|
|
@ -291,9 +256,9 @@ export default class StrataExtension extends Extension {
|
|||
});
|
||||
this._daemon.init(null);
|
||||
this._daemonSpawnTime = GLib.get_monotonic_time() / 1000; // ms
|
||||
this._daemon.wait_async(null, () => this._onDaemonExited());
|
||||
this._daemon.wait_async(null, (proc) => this._onDaemonExited(proc));
|
||||
} catch (e) {
|
||||
console.error('[Strata] Failed to spawn daemon:', e);
|
||||
logError('Failed to spawn daemon', e);
|
||||
this._scheduleDaemonRestart();
|
||||
}
|
||||
}
|
||||
|
|
@ -307,42 +272,36 @@ export default class StrataExtension extends Extension {
|
|||
Main.messageTray.add(source);
|
||||
const notification = new MessageTray.Notification({
|
||||
source,
|
||||
title: 'Strata: daemon not found',
|
||||
body: 'Install the strata-daemon package to enable clipboard history.',
|
||||
title: 'Strata: daemon not installed',
|
||||
body: 'Install the strata-daemon package. See the project page for instructions.',
|
||||
urgency: MessageTray.Urgency.HIGH,
|
||||
});
|
||||
source.addNotification(notification);
|
||||
} catch (_) {
|
||||
} catch {
|
||||
// Message tray may not be available (e.g. during early startup) - already logged above.
|
||||
}
|
||||
}
|
||||
|
||||
_onDaemonExited() {
|
||||
if (!this._daemon) return; // shutdown initiated by _stopDaemon
|
||||
const exit = this._daemon.get_exit_status();
|
||||
_onDaemonExited(proc) {
|
||||
// Ignore exits from anything that is not the current daemon: a stop
|
||||
// initiated by _stopDaemon (which nulls _daemon), or a stray subprocess
|
||||
// from an overlapping spawn. Otherwise we'd misattribute its exit.
|
||||
if (!this._daemon || proc !== this._daemon) return;
|
||||
const exit = proc.get_exit_status();
|
||||
const lifetimeMs = (GLib.get_monotonic_time() / 1000) - this._daemonSpawnTime;
|
||||
this._daemon = null;
|
||||
|
||||
if (this._shuttingDown) {
|
||||
console.log(`[Strata] daemon exited cleanly during shutdown (status=${exit})`);
|
||||
return;
|
||||
}
|
||||
if (this._shuttingDown) return;
|
||||
|
||||
// Reset attempt counter if the daemon ran long enough to be considered healthy.
|
||||
if (lifetimeMs >= 5000) {
|
||||
this._daemonRestartAttempts = 0;
|
||||
}
|
||||
this._daemonRestartAttempts++;
|
||||
console.error(
|
||||
`[Strata] daemon exited with status ${exit} after ${Math.round(lifetimeMs)}ms ` +
|
||||
`(restart attempt ${this._daemonRestartAttempts})`
|
||||
);
|
||||
logError(`daemon exited with status ${exit} after ${Math.round(lifetimeMs)}ms (restart attempt ${this._daemonRestartAttempts})`);
|
||||
|
||||
if (this._daemonRestartAttempts > 5) {
|
||||
console.error(
|
||||
'[Strata] Daemon crashed 5 times in rapid succession - giving up. ' +
|
||||
'Disable and re-enable the extension to retry.'
|
||||
);
|
||||
logError('Daemon crashed 5 times in rapid succession - giving up. Disable and re-enable the extension to retry.');
|
||||
return;
|
||||
}
|
||||
this._scheduleDaemonRestart();
|
||||
|
|
@ -350,9 +309,12 @@ export default class StrataExtension extends Extension {
|
|||
|
||||
_scheduleDaemonRestart() {
|
||||
if (this._shuttingDown) return;
|
||||
if (this._daemonRestartTimerId !== null) {
|
||||
GLib.Source.remove(this._daemonRestartTimerId);
|
||||
this._daemonRestartTimerId = null;
|
||||
}
|
||||
// Exponential backoff: 1s, 2s, 4s, 8s, 16s
|
||||
const backoffMs = 1000 * Math.pow(2, Math.max(0, this._daemonRestartAttempts - 1));
|
||||
console.log(`[Strata] respawning daemon in ${backoffMs}ms`);
|
||||
this._daemonRestartTimerId = GLib.timeout_add(GLib.PRIORITY_DEFAULT, backoffMs, () => {
|
||||
this._daemonRestartTimerId = null;
|
||||
this._spawnDaemon();
|
||||
|
|
@ -362,18 +324,9 @@ export default class StrataExtension extends Extension {
|
|||
|
||||
_stopDaemon() {
|
||||
if (!this._daemon) return;
|
||||
// Capture reference immediately so the timer doesn't kill a newly-spawned daemon.
|
||||
const daemonToStop = this._daemon;
|
||||
const daemon = this._daemon;
|
||||
this._daemon = null;
|
||||
try {
|
||||
// Graceful shutdown via D-Bus first.
|
||||
this._proxy?.ShutdownRemote(() => {});
|
||||
} catch (_) {}
|
||||
// Give it 1.5s then force-terminate.
|
||||
GLib.timeout_add(GLib.PRIORITY_LOW, 1500, () => {
|
||||
try { daemonToStop.send_signal(15); } catch (_) {} // SIGTERM
|
||||
return GLib.SOURCE_REMOVE;
|
||||
});
|
||||
daemon.send_signal(15); // SIGTERM
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -384,22 +337,23 @@ export default class StrataExtension extends Extension {
|
|||
BUS_NAME,
|
||||
OBJECT_PATH,
|
||||
(proxy, error) => {
|
||||
if (this._shuttingDown || proxy !== this._proxy) return;
|
||||
if (error) {
|
||||
console.error('[Strata] D-Bus proxy error:', error);
|
||||
logError('D-Bus proxy error', error);
|
||||
return;
|
||||
}
|
||||
this._connectSignals();
|
||||
this._panel = new StrataPanel(proxy, this._settings, this._indicator);
|
||||
this._panel = new StrataPanel(proxy, this._settings);
|
||||
// Push config now if the daemon is already up, and
|
||||
// again on every owner transition so a respawned
|
||||
// daemon picks up the latest values.
|
||||
this._pushConfig();
|
||||
this._proxyOwnerId = proxy.connect('notify::g-name-owner',
|
||||
() => { if (proxy.g_name_owner) this._pushConfig(); });
|
||||
proxy.connectObject('notify::g-name-owner',
|
||||
() => { if (proxy.g_name_owner) this._pushConfig(); }, this);
|
||||
}
|
||||
);
|
||||
} catch (e) {
|
||||
console.error('[Strata] Failed to create D-Bus proxy:', e);
|
||||
logError('Failed to create D-Bus proxy', e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -422,80 +376,77 @@ export default class StrataExtension extends Extension {
|
|||
}
|
||||
|
||||
_connectSignals() {
|
||||
this._itemAddedId = Gio.DBus.session.signal_subscribe(
|
||||
BUS_NAME,
|
||||
'org.gnome.Strata.Manager',
|
||||
'ItemAdded',
|
||||
OBJECT_PATH,
|
||||
null,
|
||||
Gio.DBusSignalFlags.NONE,
|
||||
this._onItemAdded.bind(this)
|
||||
);
|
||||
this._itemAddedId = this._proxy.connectSignal('ItemAdded',
|
||||
(_p, _sender, [id, mimeType, preview]) =>
|
||||
this._onItemAdded(id, mimeType, preview));
|
||||
|
||||
this._itemDeletedId = Gio.DBus.session.signal_subscribe(
|
||||
BUS_NAME,
|
||||
'org.gnome.Strata.Manager',
|
||||
'ItemDeleted',
|
||||
OBJECT_PATH,
|
||||
null,
|
||||
Gio.DBusSignalFlags.NONE,
|
||||
(_conn, _sender, _path, _iface, _signal, params) => {
|
||||
const [id] = params.deepUnpack();
|
||||
// Best-effort: unlink the on-disk thumbnail file (if any).
|
||||
// GLib.unlink returns -1 if file doesn't exist; we ignore that.
|
||||
this._itemDeletedId = this._proxy.connectSignal('ItemDeleted',
|
||||
(_p, _sender, [id]) => {
|
||||
try {
|
||||
const cachePath =
|
||||
`${GLib.get_user_cache_dir()}/strata/thumbnails/${id}.png`;
|
||||
GLib.unlink(cachePath);
|
||||
} catch (_) { /* not all items have thumbnails - fine */ }
|
||||
GLib.idle_add(GLib.PRIORITY_DEFAULT_IDLE, () => {
|
||||
this._panel?.removeItem(id);
|
||||
return GLib.SOURCE_REMOVE;
|
||||
});
|
||||
}
|
||||
);
|
||||
} catch { /* no cached thumbnail for this id */ }
|
||||
this._addIdleSource(() => this._panel?.removeItem(id));
|
||||
});
|
||||
|
||||
this._historyClearedId = Gio.DBus.session.signal_subscribe(
|
||||
BUS_NAME,
|
||||
'org.gnome.Strata.Manager',
|
||||
'HistoryCleared',
|
||||
OBJECT_PATH,
|
||||
null,
|
||||
Gio.DBusSignalFlags.NONE,
|
||||
this._historyClearedId = this._proxy.connectSignal('HistoryCleared',
|
||||
() => {
|
||||
// Wipe all on-disk thumbnails when daemon clears history.
|
||||
this._clearThumbnailCache();
|
||||
this._addIdleSource(() => this._panel?.clearItems());
|
||||
});
|
||||
}
|
||||
|
||||
/** Delete every cached thumbnail without blocking the compositor:
|
||||
* enumerate and unlink asynchronously in batches. */
|
||||
_clearThumbnailCache() {
|
||||
const dir = Gio.File.new_for_path(
|
||||
`${GLib.get_user_cache_dir()}/strata/thumbnails`);
|
||||
dir.enumerate_children_async(
|
||||
'standard::name', Gio.FileQueryInfoFlags.NONE,
|
||||
GLib.PRIORITY_DEFAULT, null,
|
||||
(d, res) => {
|
||||
let en;
|
||||
try {
|
||||
const dir = `${GLib.get_user_cache_dir()}/strata/thumbnails`;
|
||||
const d = Gio.File.new_for_path(dir);
|
||||
if (d.query_exists(null)) {
|
||||
const en = d.enumerate_children(
|
||||
'standard::name', Gio.FileQueryInfoFlags.NONE, null);
|
||||
let info;
|
||||
while ((info = en.next_file(null))) {
|
||||
try { d.get_child(info.get_name()).delete(null); } catch (_) {}
|
||||
en = d.enumerate_children_finish(res);
|
||||
} catch {
|
||||
return; // dir missing or unreadable
|
||||
}
|
||||
const step = () => {
|
||||
en.next_files_async(32, GLib.PRIORITY_DEFAULT, null, (e, r) => {
|
||||
let infos;
|
||||
try {
|
||||
infos = e.next_files_finish(r);
|
||||
} catch {
|
||||
infos = [];
|
||||
}
|
||||
en.close(null);
|
||||
}
|
||||
} catch (e) { console.error('[Strata] cache clear failed:', e); }
|
||||
GLib.idle_add(GLib.PRIORITY_DEFAULT_IDLE, () => {
|
||||
this._panel?.clearItems();
|
||||
return GLib.SOURCE_REMOVE;
|
||||
});
|
||||
}
|
||||
);
|
||||
if (infos.length === 0) {
|
||||
e.close_async(GLib.PRIORITY_DEFAULT, null, () => {});
|
||||
return;
|
||||
}
|
||||
for (const info of infos) {
|
||||
e.get_child(info).delete_async(
|
||||
GLib.PRIORITY_DEFAULT, null,
|
||||
(f, rr) => { try { f.delete_finish(rr); } catch { /* best-effort */ } });
|
||||
}
|
||||
step();
|
||||
});
|
||||
};
|
||||
step();
|
||||
});
|
||||
}
|
||||
|
||||
_disconnectSignals() {
|
||||
if (this._itemAddedId !== null) {
|
||||
Gio.DBus.session.signal_unsubscribe(this._itemAddedId);
|
||||
if (this._itemAddedId && this._proxy) {
|
||||
this._proxy.disconnectSignal(this._itemAddedId);
|
||||
this._itemAddedId = null;
|
||||
}
|
||||
if (this._itemDeletedId !== null) {
|
||||
Gio.DBus.session.signal_unsubscribe(this._itemDeletedId);
|
||||
if (this._itemDeletedId && this._proxy) {
|
||||
this._proxy.disconnectSignal(this._itemDeletedId);
|
||||
this._itemDeletedId = null;
|
||||
}
|
||||
if (this._historyClearedId !== null) {
|
||||
Gio.DBus.session.signal_unsubscribe(this._historyClearedId);
|
||||
if (this._historyClearedId && this._proxy) {
|
||||
this._proxy.disconnectSignal(this._historyClearedId);
|
||||
this._historyClearedId = null;
|
||||
}
|
||||
if (this._pendingSignalId !== null) {
|
||||
|
|
@ -505,7 +456,24 @@ export default class StrataExtension extends Extension {
|
|||
}
|
||||
|
||||
|
||||
_onItemAdded(_conn, _sender, _path, _iface, _signal, params) {
|
||||
/** Schedule a one-shot idle callback whose source ID is tracked so disable()
|
||||
* can drop pending work instead of leaking a closure on `this`. */
|
||||
_addIdleSource(callback) {
|
||||
const id = GLib.idle_add(GLib.PRIORITY_DEFAULT_IDLE, () => {
|
||||
this._idleSources.delete(id);
|
||||
callback();
|
||||
return GLib.SOURCE_REMOVE;
|
||||
});
|
||||
this._idleSources.add(id);
|
||||
return id;
|
||||
}
|
||||
|
||||
_clearIdleSources() {
|
||||
for (const id of this._idleSources) GLib.Source.remove(id);
|
||||
this._idleSources.clear();
|
||||
}
|
||||
|
||||
_onItemAdded(id, mimeType, preview) {
|
||||
// Debounce: if the daemon emits a burst, coalesce into one update.
|
||||
if (this._pendingSignalId !== null) {
|
||||
GLib.Source.remove(this._pendingSignalId);
|
||||
|
|
@ -513,64 +481,43 @@ export default class StrataExtension extends Extension {
|
|||
}
|
||||
this._pendingSignalId = GLib.timeout_add(GLib.PRIORITY_DEFAULT, 50, () => {
|
||||
this._pendingSignalId = null;
|
||||
this._processItemAdded(params).catch(e => console.error('[Strata] ItemAdded error:', e));
|
||||
this._addIdleSource(() => this._panel?.prependItem(id, mimeType, preview));
|
||||
return GLib.SOURCE_REMOVE;
|
||||
});
|
||||
}
|
||||
|
||||
async _processItemAdded(params) {
|
||||
if (this.#busy) return;
|
||||
this.#busy = true;
|
||||
try {
|
||||
const [id, mimeType, preview] = params.deepUnpack();
|
||||
|
||||
// Exclusion check - no clipboard I/O, just string comparison.
|
||||
if (this._isExcluded(this._currentFocusedApp)) {
|
||||
try {
|
||||
await this._proxy.DeleteItemAsync(id);
|
||||
} catch (e) {
|
||||
// ignore - item may already be gone
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Defer UI mutation to after the current frame renders.
|
||||
GLib.idle_add(GLib.PRIORITY_DEFAULT_IDLE, () => {
|
||||
this._panel?.prependItem(id, mimeType, preview);
|
||||
return GLib.SOURCE_REMOVE;
|
||||
});
|
||||
} finally {
|
||||
this.#busy = false;
|
||||
}
|
||||
_readExcluded() {
|
||||
return this._settings.get_strv('excluded-apps').map(s => s.toLowerCase());
|
||||
}
|
||||
|
||||
_isExcluded(appClass) {
|
||||
if (!appClass) return false;
|
||||
return this._excludedApps.some(ex => appClass.includes(ex.toLowerCase()));
|
||||
return this._excludedApps.some(ex => appClass.includes(ex));
|
||||
}
|
||||
|
||||
|
||||
_connectFocusTracking() {
|
||||
this._focusSignalId = global.display.connect('notify::focus-window', () => {
|
||||
global.display.connectObject('notify::focus-window', () => {
|
||||
const win = global.display.focus_window;
|
||||
this._currentFocusedApp = (win?.get_wm_class() ?? '').toLowerCase();
|
||||
});
|
||||
}, this);
|
||||
}
|
||||
|
||||
_disconnectFocusTracking() {
|
||||
if (this._focusSignalId !== null) {
|
||||
global.display.disconnect(this._focusSignalId);
|
||||
this._focusSignalId = null;
|
||||
}
|
||||
global.display.disconnectObject(this);
|
||||
}
|
||||
|
||||
|
||||
_registerShortcut() {
|
||||
// POPUP is included so the shortcut still fires while the panel's own
|
||||
// modal grab is active (pushModal sets actionMode POPUP). Without it the
|
||||
// second press is swallowed by the grab and toggle() never runs, so the
|
||||
// panel could open but not close via the shortcut.
|
||||
Main.wm.addKeybinding(
|
||||
'keyboard-shortcut',
|
||||
this._settings,
|
||||
Meta.KeyBindingFlags.IGNORE_AUTOREPEAT,
|
||||
Shell.ActionMode.NORMAL | Shell.ActionMode.OVERVIEW,
|
||||
Shell.ActionMode.NORMAL | Shell.ActionMode.OVERVIEW | Shell.ActionMode.POPUP,
|
||||
() => this._panel?.toggle()
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
{
|
||||
"name": "Strata",
|
||||
"description": "A fast, stutter-free clipboard manager. All I/O runs in a Rust daemon - GNOME Shell is never blocked.",
|
||||
"description": "A fast clipboard manager. Storage, search and image decoding run in a separate Rust daemon.",
|
||||
"uuid": "strata@edu4rdshl.dev",
|
||||
"version": 3,
|
||||
"shell-version": ["45", "46", "47", "48", "49", "50"],
|
||||
"version": 11,
|
||||
"shell-version": ["50"],
|
||||
"settings-schema": "org.gnome.shell.extensions.strata",
|
||||
"url": "https://github.com/Edu4rdSHL/Strata"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,15 +1,8 @@
|
|||
/**
|
||||
* prefs.js - Strata preferences window (GNOME 45+ / Adw).
|
||||
*
|
||||
* Pages:
|
||||
* General: max-history SpinRow, keyboard-shortcut ShortcutRow
|
||||
* Privacy: excluded-apps ExpanderRow + StringList (one entry per line)
|
||||
*/
|
||||
/* prefs.js - Strata preferences window. */
|
||||
|
||||
import Adw from 'gi://Adw';
|
||||
import Gtk from 'gi://Gtk';
|
||||
import Gdk from 'gi://Gdk';
|
||||
import GLib from 'gi://GLib';
|
||||
import Gio from 'gi://Gio';
|
||||
|
||||
import { ExtensionPreferences } from 'resource:///org/gnome/Shell/Extensions/js/extensions/prefs.js';
|
||||
|
|
@ -22,17 +15,12 @@ export default class StrataPreferences extends ExtensionPreferences {
|
|||
window.add(this._buildPrivacyPage(settings));
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// General page
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
_buildGeneralPage(settings) {
|
||||
const page = new Adw.PreferencesPage({
|
||||
title: 'General',
|
||||
icon_name: 'preferences-system-symbolic',
|
||||
});
|
||||
|
||||
// ── History ──────────────────────────────────────────────────────────
|
||||
const historyGroup = new Adw.PreferencesGroup({ title: 'History' });
|
||||
|
||||
const maxHistoryRow = new Adw.SpinRow({
|
||||
|
|
@ -89,7 +77,6 @@ export default class StrataPreferences extends ExtensionPreferences {
|
|||
|
||||
page.add(historyGroup);
|
||||
|
||||
// ── Appearance ───────────────────────────────────────────────────────
|
||||
const appearanceGroup = new Adw.PreferencesGroup({ title: 'Appearance' });
|
||||
|
||||
const panelWidthRow = new Adw.SpinRow({
|
||||
|
|
@ -157,7 +144,6 @@ export default class StrataPreferences extends ExtensionPreferences {
|
|||
|
||||
page.add(appearanceGroup);
|
||||
|
||||
// ── Keyboard ─────────────────────────────────────────────────────────
|
||||
const kbGroup = new Adw.PreferencesGroup({ title: 'Keyboard' });
|
||||
|
||||
const shortcutRow = new Adw.ActionRow({
|
||||
|
|
@ -185,10 +171,6 @@ export default class StrataPreferences extends ExtensionPreferences {
|
|||
return page;
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Privacy page
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
_buildPrivacyPage(settings) {
|
||||
const page = new Adw.PreferencesPage({
|
||||
title: 'Privacy',
|
||||
|
|
@ -200,13 +182,11 @@ export default class StrataPreferences extends ExtensionPreferences {
|
|||
description: 'Items copied while these apps have focus will not be stored in history. Enter a partial app name (case-insensitive).',
|
||||
});
|
||||
|
||||
// We use a StringList model bound to excluded-apps.
|
||||
const model = new Gtk.StringList();
|
||||
const currentApps = settings.get_strv('excluded-apps');
|
||||
for (const app of currentApps)
|
||||
model.append(app);
|
||||
|
||||
/** Sync the StringList back to GSettings. */
|
||||
const saveModel = () => {
|
||||
const apps = [];
|
||||
for (let i = 0; i < model.get_n_items(); i++) {
|
||||
|
|
@ -216,7 +196,6 @@ export default class StrataPreferences extends ExtensionPreferences {
|
|||
settings.set_strv('excluded-apps', apps);
|
||||
};
|
||||
|
||||
// Each item in the list: an EditableLabel + Remove button.
|
||||
const listBox = new Gtk.ListBox({
|
||||
selection_mode: Gtk.SelectionMode.NONE,
|
||||
css_classes: ['boxed-list'],
|
||||
|
|
@ -257,7 +236,6 @@ export default class StrataPreferences extends ExtensionPreferences {
|
|||
listBox.append(row);
|
||||
}
|
||||
|
||||
// Add-new row.
|
||||
const addRow = new Adw.ActionRow({ activatable: false });
|
||||
const addEntry = new Gtk.Entry({
|
||||
placeholder_text: 'App name…',
|
||||
|
|
@ -291,10 +269,6 @@ export default class StrataPreferences extends ExtensionPreferences {
|
|||
return page;
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Keyboard shortcut dialog
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
_showShortcutDialog(parent, settings) {
|
||||
const dialog = new Adw.MessageDialog({
|
||||
heading: 'Set Keyboard Shortcut',
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* Strata clipboard manager stylesheet.
|
||||
/* Strata dark theme (the default; loaded when the system color scheme is dark).
|
||||
*
|
||||
* Performance rule: NO `transition: all`, NO Clutter/CSS animations.
|
||||
* Only background-color transitions on hover (GPU-composited, zero JS).
|
||||
129
strata@edu4rdshl.dev/stylesheet-light.css
Normal file
|
|
@ -0,0 +1,129 @@
|
|||
/* Strata light theme.
|
||||
*
|
||||
* GNOME Shell loads this instead of stylesheet-dark.css when the system color
|
||||
* scheme is light. It imports the dark base and overrides the colors below, so
|
||||
* the overrides win by load order. Colors follow GNOME Adwaita (blue #3584e4,
|
||||
* link #1a5fb4, amber, red #e01b24), picked for contrast on a light panel.
|
||||
*/
|
||||
|
||||
@import url("stylesheet-dark.css");
|
||||
|
||||
.strata-panel {
|
||||
background-color: rgba(250, 250, 250, 0.98);
|
||||
border-color: rgba(0, 0, 0, 0.14);
|
||||
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.28);
|
||||
}
|
||||
|
||||
.strata-title {
|
||||
color: rgba(0, 0, 0, 0.87);
|
||||
}
|
||||
|
||||
.strata-clear-btn {
|
||||
border-color: rgba(0, 0, 0, 0.18);
|
||||
color: rgba(0, 0, 0, 0.55);
|
||||
}
|
||||
|
||||
.strata-clear-btn:hover {
|
||||
background-color: rgba(0, 0, 0, 0.07);
|
||||
color: rgba(0, 0, 0, 0.85);
|
||||
}
|
||||
|
||||
.strata-search {
|
||||
background-color: rgba(0, 0, 0, 0.05);
|
||||
border-color: rgba(0, 0, 0, 0.14);
|
||||
color: rgba(0, 0, 0, 0.87);
|
||||
caret-color: rgba(0, 0, 0, 0.8);
|
||||
}
|
||||
|
||||
.strata-search:focus {
|
||||
border-color: rgba(53, 132, 228, 0.8);
|
||||
background-color: rgba(0, 0, 0, 0.035);
|
||||
}
|
||||
|
||||
/* Placeholder ("Search...") text - legible dim gray on the light panel. */
|
||||
.strata-search-hint {
|
||||
color: rgba(0, 0, 0, 0.55);
|
||||
}
|
||||
|
||||
.strata-item:hover,
|
||||
.strata-item-hovered {
|
||||
background-color: rgba(53, 132, 228, 0.14);
|
||||
border-color: rgba(53, 132, 228, 0.45);
|
||||
}
|
||||
|
||||
.strata-item:focus,
|
||||
.strata-item-focused {
|
||||
background-color: rgba(53, 132, 228, 0.16);
|
||||
border-color: rgba(53, 132, 228, 0.65);
|
||||
}
|
||||
|
||||
.strata-item:hover:focus,
|
||||
.strata-item-focused.strata-item-hovered {
|
||||
background-color: rgba(53, 132, 228, 0.24);
|
||||
border-color: rgba(53, 132, 228, 0.78);
|
||||
}
|
||||
|
||||
.strata-item:focus .strata-item-text,
|
||||
.strata-item-focused .strata-item-text {
|
||||
color: rgba(0, 0, 0, 0.95);
|
||||
}
|
||||
|
||||
.strata-item-active {
|
||||
background-color: rgba(181, 131, 10, 0.16);
|
||||
border-color: rgba(181, 131, 10, 0.50);
|
||||
}
|
||||
|
||||
.strata-item-active .strata-item-text {
|
||||
color: rgba(120, 82, 0, 1.0);
|
||||
}
|
||||
|
||||
.strata-item-active.strata-item-hovered {
|
||||
background-color: rgba(181, 131, 10, 0.24);
|
||||
}
|
||||
|
||||
.strata-item-active.strata-item-focused,
|
||||
.strata-item-active:focus {
|
||||
background-color: rgba(53, 132, 228, 0.20);
|
||||
border-color: rgba(53, 132, 228, 0.65);
|
||||
}
|
||||
|
||||
.strata-item-active.strata-item-focused .strata-item-text,
|
||||
.strata-item-active:focus .strata-item-text {
|
||||
color: rgba(0, 0, 0, 0.95);
|
||||
}
|
||||
|
||||
.strata-item:active {
|
||||
background-color: rgba(0, 0, 0, 0.10);
|
||||
}
|
||||
|
||||
.strata-item-icon {
|
||||
color: rgba(0, 0, 0, 0.55);
|
||||
}
|
||||
|
||||
.strata-item-thumb {
|
||||
border-color: rgba(0, 0, 0, 0.15);
|
||||
}
|
||||
|
||||
.strata-item-text {
|
||||
color: rgba(0, 0, 0, 0.85);
|
||||
}
|
||||
|
||||
.strata-item-url {
|
||||
color: rgba(26, 95, 180, 1.0);
|
||||
}
|
||||
|
||||
.strata-item-subtext {
|
||||
color: rgba(0, 0, 0, 0.55);
|
||||
}
|
||||
|
||||
.strata-item:hover .strata-item-delete,
|
||||
.strata-item:focus .strata-item-delete,
|
||||
.strata-item-focused .strata-item-delete,
|
||||
.strata-item-hovered .strata-item-delete {
|
||||
color: rgba(224, 27, 36, 0.75);
|
||||
}
|
||||
|
||||
.strata-item-delete:hover {
|
||||
background-color: rgba(224, 27, 36, 0.13);
|
||||
color: rgba(224, 27, 36, 1.0);
|
||||
}
|
||||
|
|
@ -6,6 +6,8 @@ import St from 'gi://St';
|
|||
import Clutter from 'gi://Clutter';
|
||||
import Gio from 'gi://Gio';
|
||||
|
||||
import { logError } from '../util.js';
|
||||
|
||||
const TEXT_PREVIEW_LEN = 140;
|
||||
const THUMB_SIZE = 48;
|
||||
|
||||
|
|
@ -22,24 +24,23 @@ function iconForMime(mimeType) {
|
|||
return 'edit-copy-symbolic';
|
||||
}
|
||||
|
||||
/** Detect if a string looks like a URL. */
|
||||
function isUrl(text) {
|
||||
return /^https?:\/\/.+/i.test(text.trim());
|
||||
}
|
||||
|
||||
/** Detect if a string looks like a CSS/hex color. */
|
||||
function isColor(text) {
|
||||
return /^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/.test(text.trim());
|
||||
}
|
||||
|
||||
export const ClipboardItem = GObject.registerClass({
|
||||
GTypeName: 'StrataClipboardItem',
|
||||
Signals: {
|
||||
'activate': {},
|
||||
'delete': {},
|
||||
},
|
||||
}, class ClipboardItem extends St.Button {
|
||||
_init(id, mimeType, preview, opts = {}) {
|
||||
super._init({
|
||||
}, class extends St.Button {
|
||||
constructor(id, mimeType, preview, opts = {}) {
|
||||
super({
|
||||
style_class: 'strata-item',
|
||||
x_expand: true,
|
||||
can_focus: true,
|
||||
|
|
@ -48,26 +49,20 @@ export const ClipboardItem = GObject.registerClass({
|
|||
|
||||
this._id = id;
|
||||
this._mimeType = mimeType;
|
||||
/** D-Bus proxy used for lazy thumbnail fetch. */
|
||||
this._proxy = opts.proxy ?? null;
|
||||
/** Optional shared LRU cache (Map<id, string filePath>) - populated on first fetch. */
|
||||
this._thumbCache = opts.thumbCache ?? null;
|
||||
/** Stored on the actor so panel.js can filter by it. */
|
||||
this.actor = this;
|
||||
this._strataPreview = mimeType.startsWith('image/') ? '' : preview;
|
||||
|
||||
const row = new St.BoxLayout({
|
||||
style_class: 'strata-item-row',
|
||||
x_expand: true,
|
||||
});
|
||||
|
||||
// Left: icon or image thumbnail
|
||||
row.add_child(this._buildLeading(mimeType, preview));
|
||||
const isImage = mimeType.startsWith('image/');
|
||||
const urlLike = !isImage && isUrl(preview ?? '');
|
||||
const colorLike = !isImage && !urlLike && isColor(preview ?? '');
|
||||
row.add_child(this._buildLeading(mimeType, preview, isImage, colorLike));
|
||||
row.add_child(this._buildContent(preview, isImage, urlLike, colorLike));
|
||||
|
||||
// Center: text preview
|
||||
row.add_child(this._buildContent(mimeType, preview));
|
||||
|
||||
// Right: delete button
|
||||
const deleteBtn = new St.Button({
|
||||
style_class: 'strata-item-delete',
|
||||
icon_name: 'edit-delete-symbolic',
|
||||
|
|
@ -85,24 +80,22 @@ export const ClipboardItem = GObject.registerClass({
|
|||
// Make the item text bold when keyboard-focused so the selected item
|
||||
// is immediately obvious during arrow-key navigation.
|
||||
// We add/remove an explicit style class because CSS :focus pseudo-class
|
||||
// can be unreliable in GNOME Shell extensions.
|
||||
// can be unreliable in GNOME Shell extensions. The bold + focus text
|
||||
// color live in CSS (.strata-item-focused .strata-item-text) so each
|
||||
// theme (dark/light) can color them; we only toggle the class here.
|
||||
this.connect('key-focus-in', () => {
|
||||
this.add_style_class_name('strata-item-focused');
|
||||
if (this._mainLabel)
|
||||
this._mainLabel.style = 'font-weight: bold; color: rgba(255, 255, 255, 1.0);';
|
||||
});
|
||||
this.connect('key-focus-out', () => {
|
||||
this.remove_style_class_name('strata-item-focused');
|
||||
if (this._mainLabel)
|
||||
this._mainLabel.style = null;
|
||||
});
|
||||
}
|
||||
|
||||
_buildLeading(mimeType, preview) {
|
||||
if (mimeType.startsWith('image/')) {
|
||||
_buildLeading(mimeType, preview, isImage, colorLike) {
|
||||
if (isImage) {
|
||||
return this._buildThumbnail(this._id);
|
||||
}
|
||||
if (isColor(preview)) {
|
||||
if (colorLike) {
|
||||
return this._buildColorSwatch(preview);
|
||||
}
|
||||
const icon = new St.Icon({
|
||||
|
|
@ -114,10 +107,6 @@ export const ClipboardItem = GObject.registerClass({
|
|||
return icon;
|
||||
}
|
||||
|
||||
/** Build an image thumbnail container.
|
||||
* - If already in shared cache, apply immediately.
|
||||
* - Else fetch via GetThumbnailRemote, write to ~/.cache/strata/thumbnails/{id}.png,
|
||||
* then apply. The decode happens off-thread (CSS background-image loader). */
|
||||
_buildThumbnail(id) {
|
||||
const container = new St.Widget({
|
||||
width: THUMB_SIZE,
|
||||
|
|
@ -133,22 +122,19 @@ export const ClipboardItem = GObject.registerClass({
|
|||
const applyStyle = () => {
|
||||
try {
|
||||
container.style = `background-image: url("${fileUri}"); background-size: cover; background-repeat: no-repeat;`;
|
||||
} catch (_) { /* container was destroyed mid-flight */ }
|
||||
} catch { /* container was destroyed mid-flight */ }
|
||||
};
|
||||
|
||||
try {
|
||||
// Fast path: already cached this session.
|
||||
if (this._thumbCache?.has(id)) {
|
||||
applyStyle();
|
||||
return container;
|
||||
}
|
||||
// Second fast path: file exists on disk from a previous session.
|
||||
if (GLib.file_test(cachePath, GLib.FileTest.EXISTS)) {
|
||||
this._thumbCache?.set(id, cachePath);
|
||||
applyStyle();
|
||||
return container;
|
||||
}
|
||||
// Slow path: ask the daemon for the bytes, then write file async.
|
||||
GLib.mkdir_with_parents(cacheDir, 0o755);
|
||||
if (!this._proxy) {
|
||||
this._fallbackIcon(container);
|
||||
|
|
@ -174,18 +160,18 @@ export const ClipboardItem = GObject.registerClass({
|
|||
this._thumbCache?.set(id, cachePath);
|
||||
applyStyle();
|
||||
} catch (e) {
|
||||
console.error('[Strata] Thumbnail write error:', e);
|
||||
logError('Thumbnail write error', e);
|
||||
this._fallbackIcon(container);
|
||||
}
|
||||
}
|
||||
);
|
||||
} catch (e) {
|
||||
console.error('[Strata] Thumbnail fetch handler error:', e);
|
||||
logError('Thumbnail fetch handler error', e);
|
||||
this._fallbackIcon(container);
|
||||
}
|
||||
});
|
||||
} catch (e) {
|
||||
console.error('[Strata] Thumbnail render error:', e);
|
||||
logError('Thumbnail render error', e);
|
||||
this._fallbackIcon(container);
|
||||
}
|
||||
return container;
|
||||
|
|
@ -201,7 +187,7 @@ export const ClipboardItem = GObject.registerClass({
|
|||
x_align: Clutter.ActorAlign.CENTER,
|
||||
});
|
||||
container.add_child(icon);
|
||||
} catch (_) {}
|
||||
} catch { /* container destroyed before the icon was added */ }
|
||||
}
|
||||
|
||||
_buildColorSwatch(hex) {
|
||||
|
|
@ -214,7 +200,7 @@ export const ClipboardItem = GObject.registerClass({
|
|||
});
|
||||
}
|
||||
|
||||
_buildContent(mimeType, preview) {
|
||||
_buildContent(preview, isImage, urlLike, colorLike) {
|
||||
preview = preview ?? '';
|
||||
const box = new St.BoxLayout({
|
||||
vertical: true,
|
||||
|
|
@ -222,17 +208,20 @@ export const ClipboardItem = GObject.registerClass({
|
|||
style_class: 'strata-item-content',
|
||||
});
|
||||
|
||||
let mainText = '';
|
||||
let subText = '';
|
||||
let mainText;
|
||||
let subText = '';
|
||||
|
||||
if (mimeType.startsWith('image/')) {
|
||||
mainText = mimeType === 'image/png' ? 'PNG image' : 'Image';
|
||||
} else if (isUrl(preview)) {
|
||||
if (isImage) {
|
||||
// Generic label - the thumbnail identifies the image, and the
|
||||
// on-clipboard format (often PNG even for a copied GIF/WebP) is an
|
||||
// implementation detail that misleads more than it informs.
|
||||
mainText = 'Image';
|
||||
} else if (urlLike) {
|
||||
mainText = preview.trim();
|
||||
try {
|
||||
subText = new URL(preview.trim()).hostname;
|
||||
} catch (_) {}
|
||||
} else if (isColor(preview)) {
|
||||
subText = GLib.Uri.parse(preview.trim(), GLib.UriFlags.NONE).get_host() ?? '';
|
||||
} catch { /* not a parseable URI */ }
|
||||
} else if (colorLike) {
|
||||
mainText = preview.trim().toUpperCase();
|
||||
subText = 'Color';
|
||||
} else {
|
||||
|
|
@ -244,13 +233,12 @@ export const ClipboardItem = GObject.registerClass({
|
|||
|
||||
const labelMain = new St.Label({
|
||||
text: mainText || '(empty)',
|
||||
style_class: `strata-item-text${isUrl(preview) ? ' strata-item-url' : ''}`,
|
||||
style_class: `strata-item-text${urlLike ? ' strata-item-url' : ''}`,
|
||||
x_expand: true,
|
||||
y_align: Clutter.ActorAlign.CENTER,
|
||||
});
|
||||
labelMain.clutter_text.line_wrap = false;
|
||||
labelMain.clutter_text.ellipsize = 3; // PANGO_ELLIPSIZE_END
|
||||
this._mainLabel = labelMain; // held for key-focus bold styling
|
||||
box.add_child(labelMain);
|
||||
|
||||
if (subText) {
|
||||
|
|
|
|||
|
|
@ -8,19 +8,18 @@ import Shell from 'gi://Shell';
|
|||
|
||||
import * as Main from 'resource:///org/gnome/shell/ui/main.js';
|
||||
import { ClipboardItem } from './clipboardItem.js';
|
||||
import { logError } from '../util.js';
|
||||
|
||||
const SEARCH_LIMIT = 500;
|
||||
const SEARCH_DEBOUNCE_MS = 150;
|
||||
const LOAD_MORE_THRESHOLD = 200;
|
||||
|
||||
export class StrataPanel {
|
||||
constructor(proxy, settings, indicator = null) {
|
||||
constructor(proxy, settings) {
|
||||
this._proxy = proxy;
|
||||
this._settings = settings;
|
||||
this._indicator = indicator; // PanelMenu.Button - used to avoid toggle-reopen race
|
||||
this._pageSize = settings.get_int('page-size');
|
||||
this._pageSizeChangedId = settings.connect('changed::page-size',
|
||||
() => { this._pageSize = settings.get_int('page-size'); });
|
||||
settings.connectObject('changed::page-size',
|
||||
() => { this._pageSize = settings.get_int('page-size'); }, this);
|
||||
/** @type {{ id: string, mimeType: string, preview: string }[]} */
|
||||
this._items = [];
|
||||
/** @type {Map<string, ClipboardItem>} id → widget */
|
||||
|
|
@ -29,12 +28,15 @@ export class StrataPanel {
|
|||
this._thumbCache = new Map();
|
||||
/** Pagination state for the non-search view. */
|
||||
this._loadedOffset = 0; // how many items we've already pulled
|
||||
this._hasMore = true; // false once daemon returns < PAGE_SIZE
|
||||
this._hasMore = true; // false once daemon returns less than a full page
|
||||
this._loadingMore = false; // re-entrancy guard for scroll-driven loads
|
||||
/** Search state. */
|
||||
this._searchQuery = ''; // current search string ('' = no search)
|
||||
this._searchDebounceId = null; // pending GLib timeout for debounce
|
||||
this._searchEpoch = 0; // monotonic counter to discard stale search responses
|
||||
this._searchResults = []; // full match snapshot (metadata) for the active query
|
||||
this._searchRendered = 0; // how many of _searchResults have widgets so far
|
||||
this._resultsEpoch = -1; // epoch whose results currently fill _searchResults
|
||||
|
||||
this._visible = false;
|
||||
this._grab = null; // Clutter.Grab from Main.pushModal
|
||||
|
|
@ -42,6 +44,7 @@ export class StrataPanel {
|
|||
this._activeWidget = null; // most recently copied item
|
||||
|
||||
this._buildUI();
|
||||
|
||||
// Trigger the initial load as soon as the daemon owns its bus name.
|
||||
// At extension boot the daemon may still be starting (its D-Bus name
|
||||
// not yet owned); the proxy fires notify::g-name-owner when that
|
||||
|
|
@ -49,21 +52,21 @@ export class StrataPanel {
|
|||
// and only then issue GetHistory. If the daemon is already up, the
|
||||
// owner is already set and we load immediately.
|
||||
this._tryInitialLoad();
|
||||
this._nameOwnerId = this._proxy.connect('notify::g-name-owner',
|
||||
() => this._tryInitialLoad());
|
||||
this._proxy.connectObject('notify::g-name-owner',
|
||||
() => this._tryInitialLoad(), this);
|
||||
}
|
||||
|
||||
_tryInitialLoad() {
|
||||
if (this._initialLoaded) return;
|
||||
if (!this._proxy.g_name_owner) return;
|
||||
this._initialLoaded = true;
|
||||
this._loadHistory(0, this._pageSize).catch(e =>
|
||||
console.error('[Strata] initial _loadHistory failed:', e));
|
||||
this._loadHistory(0, this._pageSize).then(ok => {
|
||||
if (!ok) this._initialLoaded = false;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
_buildUI() {
|
||||
// Overlay container - sits above all windows.
|
||||
this._overlay = new St.Widget({
|
||||
layout_manager: new Clutter.FixedLayout(),
|
||||
visible: false,
|
||||
|
|
@ -112,14 +115,12 @@ export class StrataPanel {
|
|||
return Clutter.EVENT_PROPAGATE;
|
||||
});
|
||||
|
||||
// Panel box
|
||||
this._box = new St.BoxLayout({
|
||||
style_class: 'strata-panel',
|
||||
vertical: true,
|
||||
reactive: true,
|
||||
});
|
||||
|
||||
// Header row: title + clear button
|
||||
const header = new St.BoxLayout({
|
||||
style_class: 'strata-header',
|
||||
x_expand: true,
|
||||
|
|
@ -139,17 +140,19 @@ export class StrataPanel {
|
|||
header.add_child(title);
|
||||
header.add_child(clearBtn);
|
||||
|
||||
// Search box
|
||||
this._searchEntry = new St.Entry({
|
||||
hint_text: 'Search…',
|
||||
style_class: 'strata-search',
|
||||
x_expand: true,
|
||||
can_focus: true,
|
||||
});
|
||||
// Tag the placeholder label so the light theme can recolor it. By
|
||||
// default it inherits a light-on-dark Shell color that is illegible on
|
||||
// the light panel; dark mode is unaffected (no base rule).
|
||||
this._searchEntry.get_hint_actor()?.add_style_class_name('strata-search-hint');
|
||||
this._searchEntry.get_clutter_text().connect('text-changed', () => {
|
||||
this._scheduleSearch(this._searchEntry.get_text());
|
||||
});
|
||||
// Down arrow from search box moves focus to the first item.
|
||||
this._searchEntry.get_clutter_text().connect('key-press-event', (_actor, event) => {
|
||||
if (event.get_key_symbol() === Clutter.KEY_Down) {
|
||||
this._focusItem(0);
|
||||
|
|
@ -158,7 +161,6 @@ export class StrataPanel {
|
|||
return Clutter.EVENT_PROPAGATE;
|
||||
});
|
||||
|
||||
// Item list
|
||||
this._scrollView = new St.ScrollView({
|
||||
style_class: 'strata-scroll',
|
||||
x_expand: true,
|
||||
|
|
@ -172,21 +174,17 @@ export class StrataPanel {
|
|||
});
|
||||
this._scrollView.set_child(this._itemList);
|
||||
|
||||
// Load more items when scrolled near the bottom.
|
||||
const vadj = this._scrollView.get_vadjustment();
|
||||
if (vadj) {
|
||||
vadj.connect('notify::value', () => this._maybeLoadMore());
|
||||
// Also re-check when the list grows (a new page just appended).
|
||||
vadj.connect('notify::upper', () => this._maybeLoadMore());
|
||||
}
|
||||
|
||||
// Assemble
|
||||
this._box.add_child(header);
|
||||
this._box.add_child(this._searchEntry);
|
||||
this._box.add_child(this._scrollView);
|
||||
this._overlay.add_child(this._box);
|
||||
|
||||
// ESC to close
|
||||
this._overlay.connect('key-press-event', (_actor, event) => {
|
||||
if (event.get_key_symbol() === Clutter.KEY_Escape) {
|
||||
this.close();
|
||||
|
|
@ -225,7 +223,7 @@ export class StrataPanel {
|
|||
// retry now that the user is asking to see the list.
|
||||
if (this._items.length === 0 && this._loadedOffset === 0 && this._hasMore) {
|
||||
this._loadHistory(0, this._pageSize).catch(e =>
|
||||
console.error('[Strata] open: history reload failed:', e));
|
||||
logError('open: history reload failed', e));
|
||||
}
|
||||
global.stage.set_key_focus(this._searchEntry.get_clutter_text());
|
||||
}
|
||||
|
|
@ -233,7 +231,6 @@ export class StrataPanel {
|
|||
close() {
|
||||
if (!this._visible) return;
|
||||
this._visible = false;
|
||||
// Clear hover state since the panel is closing.
|
||||
this._hoveredWidget?.remove_style_class_name('strata-item-hovered');
|
||||
this._hoveredWidget = null;
|
||||
if (this._grab) {
|
||||
|
|
@ -255,17 +252,16 @@ export class StrataPanel {
|
|||
this._widgets.delete(id);
|
||||
}
|
||||
|
||||
// While searching, only render if the new item matches the active query.
|
||||
if (this._searchQuery && !this._matchesSearch(preview, mimeType)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const widget = this._makeItemWidget(id, mimeType, preview);
|
||||
this._widgets.set(id, widget);
|
||||
this._itemList.insert_child_at_index(widget.actor, 0);
|
||||
this._itemList.insert_child_at_index(widget, 0);
|
||||
this._setActiveWidget(widget);
|
||||
} catch (e) {
|
||||
console.error(`[Strata] prependItem failed for id=${id} mime=${mimeType}:`, e);
|
||||
logError(`prependItem failed for id=${id} mime=${mimeType}`, e);
|
||||
this._items = this._items.filter(i => i.id !== id);
|
||||
}
|
||||
}
|
||||
|
|
@ -282,6 +278,16 @@ export class StrataPanel {
|
|||
|
||||
removeItem(id) {
|
||||
this._items = this._items.filter(i => i.id !== id);
|
||||
this._thumbCache.delete(id);
|
||||
// Keep the search snapshot in sync so a deleted/pruned item sitting in
|
||||
// the not-yet-rendered tail can't be re-created as a phantom row when
|
||||
// scrolling appends the next page. Adjust _searchRendered if the removed
|
||||
// item was within the already-rendered range so the index stays aligned.
|
||||
const sIdx = this._searchResults.findIndex(r => r.id === id);
|
||||
if (sIdx !== -1) {
|
||||
this._searchResults.splice(sIdx, 1);
|
||||
if (sIdx < this._searchRendered) this._searchRendered--;
|
||||
}
|
||||
const widget = this._widgets.get(id);
|
||||
if (widget) {
|
||||
const wasActive = widget === this._activeWidget;
|
||||
|
|
@ -290,7 +296,6 @@ export class StrataPanel {
|
|||
if (wasHovered) this._hoveredWidget = null;
|
||||
widget.destroy();
|
||||
this._widgets.delete(id);
|
||||
// Re-assign active to the new first visible item.
|
||||
if (wasActive) {
|
||||
const first = this._getVisibleItems()[0];
|
||||
if (first) this._setActiveWidget(first);
|
||||
|
|
@ -300,25 +305,19 @@ export class StrataPanel {
|
|||
|
||||
clearItems() {
|
||||
this._items = [];
|
||||
this._searchResults = [];
|
||||
this._searchRendered = 0;
|
||||
this._resultsEpoch = -1; // invalidate the search snapshot so a scroll can't render stale rows
|
||||
this._hoveredWidget = null;
|
||||
this._activeWidget = null;
|
||||
this._widgets.clear();
|
||||
this._thumbCache.clear();
|
||||
this._itemList.destroy_all_children();
|
||||
}
|
||||
|
||||
destroy() {
|
||||
if (this._pageSizeChangedId) {
|
||||
this._settings.disconnect(this._pageSizeChangedId);
|
||||
this._pageSizeChangedId = 0;
|
||||
}
|
||||
if (this._nameOwnerId) {
|
||||
this._proxy.disconnect(this._nameOwnerId);
|
||||
this._nameOwnerId = 0;
|
||||
}
|
||||
if (this._initialLoadId) {
|
||||
GLib.Source.remove(this._initialLoadId);
|
||||
this._initialLoadId = null;
|
||||
}
|
||||
this._settings.disconnectObject(this);
|
||||
this._proxy.disconnectObject(this);
|
||||
if (this._searchDebounceId) {
|
||||
GLib.Source.remove(this._searchDebounceId);
|
||||
this._searchDebounceId = null;
|
||||
|
|
@ -332,22 +331,23 @@ export class StrataPanel {
|
|||
|
||||
|
||||
async _loadHistory(offset, limit) {
|
||||
if (!this._overlay) return 0;
|
||||
if (!this._overlay) return false;
|
||||
try {
|
||||
const [json] = await this._proxy.GetHistoryAsync(offset, limit);
|
||||
if (!this._overlay) return 0;
|
||||
if (!this._overlay) return false;
|
||||
const items = JSON.parse(json);
|
||||
const BATCH = 20;
|
||||
for (let i = 0; i < items.length; i += BATCH) {
|
||||
if (!this._overlay) return items.length;
|
||||
await new Promise(resolve =>
|
||||
if (!this._overlay) return false;
|
||||
// eslint-disable-next-line no-await-in-loop -- batches deliberately yield to the main loop
|
||||
await new Promise(resolve => {
|
||||
GLib.idle_add(GLib.PRIORITY_DEFAULT_IDLE, () => {
|
||||
const end = Math.min(i + BATCH, items.length);
|
||||
for (let j = i; j < end; j++) this._appendItemFromMeta(items[j]);
|
||||
resolve();
|
||||
return GLib.SOURCE_REMOVE;
|
||||
})
|
||||
);
|
||||
});
|
||||
});
|
||||
}
|
||||
this._loadedOffset = offset + items.length;
|
||||
this._hasMore = items.length >= limit;
|
||||
|
|
@ -355,10 +355,10 @@ export class StrataPanel {
|
|||
const firstWidget = this._widgets.get(items[0].id);
|
||||
if (firstWidget) this._setActiveWidget(firstWidget);
|
||||
}
|
||||
return items.length;
|
||||
return true;
|
||||
} catch (e) {
|
||||
console.error('[Strata] _loadHistory failed:', e);
|
||||
return 0;
|
||||
logError('GetHistory failed', e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -372,23 +372,77 @@ export class StrataPanel {
|
|||
this._items.push({ id, mimeType, preview });
|
||||
const widget = this._makeItemWidget(id, mimeType, preview);
|
||||
this._widgets.set(id, widget);
|
||||
this._itemList.add_child(widget.actor);
|
||||
this._itemList.add_child(widget);
|
||||
} catch (e) {
|
||||
console.error(`[Strata] _appendItemFromMeta failed for id=${meta?.id}:`, e);
|
||||
logError(`_appendItemFromMeta failed for id=${meta?.id}`, e);
|
||||
}
|
||||
}
|
||||
|
||||
_maybeLoadMore() {
|
||||
if (this._searchQuery) return;
|
||||
if (!this._hasMore || this._loadingMore) return;
|
||||
if (this._loadingMore) return;
|
||||
const adj = this._scrollView.get_vadjustment();
|
||||
if (!adj || adj.upper <= adj.page_size) return;
|
||||
const distanceToBottom = adj.upper - (adj.value + adj.page_size);
|
||||
if (distanceToBottom > LOAD_MORE_THRESHOLD) return;
|
||||
|
||||
if (this._searchQuery) {
|
||||
// Search mode: render the next page from the in-memory match
|
||||
// snapshot (no re-query, so a scroll cannot race the search).
|
||||
this._renderSearchPage(this._searchEpoch);
|
||||
} else {
|
||||
if (!this._hasMore) return;
|
||||
this._loadingMore = true;
|
||||
this._loadHistory(this._loadedOffset, this._pageSize)
|
||||
.finally(() => { this._loadingMore = false; });
|
||||
}
|
||||
}
|
||||
|
||||
/** Render the next page-size slice of `_searchResults` into the list.
|
||||
* Bounded per call so a broad query never builds every match at once;
|
||||
* scrolling calls this again until the snapshot is exhausted. */
|
||||
async _renderSearchPage(epoch) {
|
||||
if (epoch !== this._searchEpoch || !this._overlay) return;
|
||||
// The snapshot must belong to this epoch. During a new query's fetch the
|
||||
// epoch is already bumped while _searchResults still holds the previous
|
||||
// set; rendering then would paint stale rows (and race the real render).
|
||||
if (this._resultsEpoch !== epoch) return;
|
||||
if (this._loadingMore) return;
|
||||
const start = this._searchRendered;
|
||||
if (start >= this._searchResults.length) return;
|
||||
|
||||
this._loadingMore = true;
|
||||
this._loadHistory(this._loadedOffset, this._pageSize)
|
||||
.finally(() => { this._loadingMore = false; });
|
||||
try {
|
||||
const end = Math.min(start + this._pageSize, this._searchResults.length);
|
||||
const BATCH = 20;
|
||||
for (let i = start; i < end; i += BATCH) {
|
||||
if (epoch !== this._searchEpoch || !this._overlay) return;
|
||||
const renderChunk = () => {
|
||||
const e = Math.min(i + BATCH, end);
|
||||
for (let j = i; j < e; j++)
|
||||
this._appendItemFromMeta(this._searchResults[j]);
|
||||
};
|
||||
// First chunk runs synchronously so the list never paints empty
|
||||
// between clear and first append. Later chunks yield to idle.
|
||||
if (i === 0) {
|
||||
renderChunk();
|
||||
} else {
|
||||
// eslint-disable-next-line no-await-in-loop -- batches deliberately yield to the main loop
|
||||
await new Promise(resolve => {
|
||||
GLib.idle_add(GLib.PRIORITY_DEFAULT_IDLE, () => {
|
||||
renderChunk();
|
||||
resolve();
|
||||
return GLib.SOURCE_REMOVE;
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
this._searchRendered = end;
|
||||
} finally {
|
||||
// Only release the guard if we still own the current search. If a
|
||||
// newer search superseded us mid-render, it now owns the guard and
|
||||
// must not be cleared by this stale render.
|
||||
if (epoch === this._searchEpoch) this._loadingMore = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -435,20 +489,19 @@ export class StrataPanel {
|
|||
return widget;
|
||||
}
|
||||
|
||||
/** Focus the item at visible-list index `idx` (clamped). */
|
||||
_focusItem(idx) {
|
||||
const items = this._getVisibleItems();
|
||||
if (items.length === 0) return;
|
||||
global.stage.set_key_focus(items[Math.max(0, Math.min(idx, items.length - 1))]);
|
||||
}
|
||||
|
||||
/** All currently-visible item actors in order. */
|
||||
_getVisibleItems() {
|
||||
return this._itemList.get_children().filter(c => c.visible);
|
||||
}
|
||||
|
||||
_ensureVisible(widget) {
|
||||
GLib.idle_add(GLib.PRIORITY_DEFAULT_IDLE, () => {
|
||||
if (!this._overlay) return GLib.SOURCE_REMOVE; // panel destroyed before idle ran
|
||||
try {
|
||||
const adj = this._scrollView.get_vadjustment();
|
||||
if (!adj || adj.page_size === 0) return GLib.SOURCE_REMOVE;
|
||||
|
|
@ -463,7 +516,7 @@ export class StrataPanel {
|
|||
else if (box.y2 > cur + pageSize)
|
||||
adj.value = box.y2 - pageSize;
|
||||
} catch (e) {
|
||||
console.error('[Strata] ensureVisible error:', e);
|
||||
logError('ensureVisible error', e);
|
||||
}
|
||||
return GLib.SOURCE_REMOVE;
|
||||
});
|
||||
|
|
@ -474,7 +527,7 @@ export class StrataPanel {
|
|||
const [mimeType, content] = await this._proxy.GetItemContentAsync(id);
|
||||
this._writeToClipboard(mimeType, content);
|
||||
} catch (e) {
|
||||
console.error('[Strata] Paste error:', e);
|
||||
logError('GetItemContent failed', e);
|
||||
}
|
||||
this.close();
|
||||
}
|
||||
|
|
@ -495,7 +548,7 @@ export class StrataPanel {
|
|||
);
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('[Strata] Clipboard write error:', e);
|
||||
logError('Clipboard write error', e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -503,7 +556,7 @@ export class StrataPanel {
|
|||
try {
|
||||
await this._proxy.ClearHistoryAsync();
|
||||
} catch (e) {
|
||||
console.error('[Strata] ClearHistory error:', e);
|
||||
logError('ClearHistory failed', e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -518,7 +571,7 @@ export class StrataPanel {
|
|||
GLib.PRIORITY_DEFAULT, SEARCH_DEBOUNCE_MS, () => {
|
||||
this._searchDebounceId = null;
|
||||
this._runSearch(trimmed).catch(e =>
|
||||
console.error('[Strata] search failed:', e));
|
||||
logError('search failed', e));
|
||||
return GLib.SOURCE_REMOVE;
|
||||
});
|
||||
}
|
||||
|
|
@ -528,8 +581,16 @@ export class StrataPanel {
|
|||
* search cannot overwrite the results of a newer one. */
|
||||
async _runSearch(query) {
|
||||
const epoch = ++this._searchEpoch;
|
||||
// A new search (or reset) supersedes any in-flight page render. Release
|
||||
// the shared loading guard so this fresh render is never blocked by a
|
||||
// stale one; the stale render bails on its own epoch check and, per the
|
||||
// epoch-ownership check in _renderSearchPage, won't clear the guard out
|
||||
// from under us.
|
||||
this._loadingMore = false;
|
||||
if (!query) {
|
||||
this._searchQuery = '';
|
||||
this._searchResults = [];
|
||||
this._searchRendered = 0;
|
||||
this._clearListDom();
|
||||
this._items = [];
|
||||
this._loadedOffset = 0;
|
||||
|
|
@ -544,16 +605,19 @@ export class StrataPanel {
|
|||
this._clearListDom();
|
||||
this._items = [];
|
||||
}
|
||||
}).catch(e => console.error('[Strata] reset-history failed:', e));
|
||||
}).catch(e => logError('reset-history failed', e));
|
||||
return;
|
||||
}
|
||||
|
||||
this._searchQuery = query;
|
||||
// Fetch the full match set, bounded by the configured history size, so
|
||||
// search covers everything that is stored (not an arbitrary cap).
|
||||
const limit = this._settings.get_int('max-history');
|
||||
let json;
|
||||
try {
|
||||
[json] = await this._proxy.SearchHistoryAsync(query, SEARCH_LIMIT);
|
||||
[json] = await this._proxy.SearchHistoryAsync(query, limit);
|
||||
} catch (e) {
|
||||
console.error('[Strata] SearchHistory D-Bus error:', e);
|
||||
logError('SearchHistory failed', e);
|
||||
return;
|
||||
}
|
||||
if (epoch !== this._searchEpoch || !this._overlay) return; // stale or destroyed
|
||||
|
|
@ -562,28 +626,23 @@ export class StrataPanel {
|
|||
try {
|
||||
results = JSON.parse(json);
|
||||
} catch (e) {
|
||||
console.error('[Strata] SearchHistory: bad JSON:', e);
|
||||
logError('SearchHistory: bad JSON', e);
|
||||
return;
|
||||
}
|
||||
|
||||
this._clearListDom();
|
||||
this._items = [];
|
||||
// Disable pagination while searching - the search response is already
|
||||
// bounded by SEARCH_LIMIT, scrolling shouldn't pull more.
|
||||
// Snapshot the full match set and render it lazily, a page at a time,
|
||||
// so a broad query on a large history never builds thousands of row
|
||||
// widgets up front. Browse-mode pagination stays off; search paging is
|
||||
// driven by _renderSearchPage over this snapshot (see _maybeLoadMore).
|
||||
this._searchResults = results;
|
||||
this._searchRendered = 0;
|
||||
this._resultsEpoch = epoch;
|
||||
this._hasMore = false;
|
||||
this._loadedOffset = 0;
|
||||
|
||||
const BATCH = 20;
|
||||
for (let i = 0; i < results.length; i += BATCH) {
|
||||
if (epoch !== this._searchEpoch || !this._overlay) return;
|
||||
await new Promise(resolve =>
|
||||
GLib.idle_add(GLib.PRIORITY_DEFAULT_IDLE, () => {
|
||||
const end = Math.min(i + BATCH, results.length);
|
||||
for (let j = i; j < end; j++) this._appendItemFromMeta(results[j]);
|
||||
resolve();
|
||||
return GLib.SOURCE_REMOVE;
|
||||
}));
|
||||
}
|
||||
await this._renderSearchPage(epoch);
|
||||
}
|
||||
|
||||
/** Tear down all rendered item widgets (without touching the data model). */
|
||||
|
|
@ -602,13 +661,11 @@ export class StrataPanel {
|
|||
}
|
||||
|
||||
_moveItemToTop(id, widget) {
|
||||
// Move data model entry to front.
|
||||
const idx = this._items.findIndex(i => i.id === id);
|
||||
if (idx > 0) {
|
||||
const [entry] = this._items.splice(idx, 1);
|
||||
this._items.unshift(entry);
|
||||
}
|
||||
// Move actor to position 0 in the list.
|
||||
this._itemList.set_child_at_index(widget, 0);
|
||||
}
|
||||
|
||||
|
|
@ -635,7 +692,6 @@ export class StrataPanel {
|
|||
const MARGIN = 16; // px gap from screen edge
|
||||
|
||||
let x, y;
|
||||
// Horizontal
|
||||
if (position.endsWith('left'))
|
||||
x = monitor.x + MARGIN;
|
||||
else if (position.endsWith('right'))
|
||||
|
|
|
|||
11
strata@edu4rdshl.dev/util.js
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
/* util.js - shared helpers for the Strata extension. */
|
||||
|
||||
import GLib from 'gi://GLib';
|
||||
import Gio from 'gi://Gio';
|
||||
|
||||
export function logError(label, err) {
|
||||
if (err instanceof GLib.Error)
|
||||
Gio.DBusError.strip_remote_error(err);
|
||||
const tail = err !== undefined ? `: ${err?.message ?? err}` : '';
|
||||
console.error(`[Strata] ${label}${tail}`);
|
||||
}
|
||||