Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Check plugin

on:
pull_request:
branches: [main]
push:
branches: [main]
workflow_dispatch:

permissions:
contents: read

concurrency:
group: check-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
check:
runs-on: ubuntu-latest
timeout-minutes: 10
env:
CHROME_BIN: google-chrome
steps:
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
with:
persist-credentials: false
- uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6
with:
node-version: "24"
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2
with:
bun-version: "1.4.4"
- run: bun install --frozen-lockfile --ignore-scripts
- run: bun run check
- run: git diff --exit-code -- dist/gui-experimental.cjs
- run: node --test .github/scripts/owner-approval.test.cjs
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Changelog

## 0.3.0

- Add muted, looping MP4 and WebM wallpapers, animated GIF and APNG uploads, and self-contained HTML wallpapers.
- Add Static and Live gallery filters, live indicators, and hover or keyboard-focus previews.
- Keep gallery thumbnails still until previewed. Support companion poster images for HTML and video wallpapers.
- Serve video and HTML from a token-protected loopback endpoint with video byte-range support. Images and HTML retain the 8 MiB limit; videos allow up to 256 MiB.
- Sandbox HTML scripts and block external asset loading and fetch requests. Only use trusted HTML; the sandbox is not a network firewall.
- Include live wallpapers in slideshow order. Video and HTML switch instantly; fades remain available between images.
- Add compatibility with OpenCode 2.4.x from 2.4.3.
- Preserve existing uploaded wallpapers, selections, and appearance preferences.
- Recover folder watching when a deleted folder reappears during a scan.

## 0.2.0

- Add wallpaper slideshows with configurable display time and image fades.
43 changes: 30 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,40 +1,52 @@
# OpenCode Backdrop

<p>Use your own wallpapers in OpenCode Desktop. Supports OpenCode 2.2.x from 2.2.6 and 2.3.x from 2.3.2 through the GUI plugin API.</p>
<p>Use your own wallpapers in OpenCode Desktop. Supports OpenCode 2.2.x from 2.2.6, 2.3.x from 2.3.2, and 2.4.x from 2.4.3 through the GUI plugin API.</p>
<img width="3020" height="1910" alt="image" src="https://github.com/user-attachments/assets/8d1626f2-7048-496c-8aa9-7745f19e1531" />

## Install

```sh
opencode plugin add 'github:viralcodex/opencode-backdrop#v0.2.0'
opencode plugin add 'github:viralcodex/opencode-backdrop#v0.3.0'
```

This installs the plugin globally. Alternatively, add it to your global `opencode.json` or `opencode.jsonc`, keeping any existing plugins. Do not add it to `cli.json`.

```jsonc
{
"$schema": "https://opencode.ai/config.json",
"plugins": ["github:viralcodex/opencode-backdrop#v0.2.0"],
"plugins": ["github:viralcodex/opencode-backdrop#v0.3.0"],
}
```

## Use

1. Open **Settings > Wallpapers**.
2. Choose **Change folder** to use a local folder, or **+** to upload an image.
3. Select an image and adjust tint, brightness and fit.
3. Select a wallpaper and adjust tint, brightness and fit.

Wallpaper starts off with an empty gallery. Images and preferences stay local, and images are not sent to models. Files must be non-empty and no larger than 8 MiB.
Wallpaper starts off with an empty gallery. Wallpapers and preferences stay local and are not sent to models. Images and HTML must be non-empty and no larger than 8 MiB; videos can be up to 256 MiB.

- Folder images support PNG, JPEG, WebP and SVG, including subfolders. Changes appear automatically.
- Uploads support PNG, JPEG and WebP.
- The gallery shows at most two rows, including the **+** tile. Use **Show more** to see all images, or **Show less** to collapse it.
- Folders support PNG, JPEG, WebP, SVG, GIF, APNG, MP4, WebM, and self-contained HTML, including subfolders. Changes appear automatically.
- Uploads support PNG, JPEG, WebP, GIF and APNG. Add video and HTML through the wallpaper folder.
- Videos play muted and loop continuously. MP4 with H.264 is recommended; other codecs depend on Desktop support. Animated images keep their original animation.
- HTML wallpapers run in a sandbox without access to the OpenCode interface or local storage. CSP blocks external scripts, styles, assets, and fetch requests. Embed everything in the HTML and use files from sources you trust. This is not a network firewall; a script can still navigate its own frame to another URL.
- Filter the gallery by **All wallpapers**, **Static**, or **Live**. Live tiles have a small play icon beside their name. Hover or keyboard-focus a live tile to preview it without changing your selected wallpaper.
- Videos and animated images show static thumbnail frames until previewed. For an HTML poster, put `Name.poster.png`, `.jpg`, `.jpeg`, or `.webp` beside `Name.html`. Poster files stay out of the gallery. Without a poster, HTML tiles show a live-wallpaper label until previewed.
- The gallery shows at most two rows, including the **+** tile. Use **Show more** to see all wallpapers, or **Show less** to collapse it.
- More tint improves text contrast. **Fill background** crops the image; **Show whole image** keeps it fully visible.
- Use `/wallpaper` in chat to switch images or turn wallpaper off. Escape cancels the picker.
- Turn **Show wallpaper** off to restore the app's backgrounds without losing your choices.
- Turn **Wallpaper slideshow** on to cycle through all gallery images in order. Choose **None** or **Fade** in the transition dropdown and set **Display time** in seconds, from 5 to 86400. The default is 60 seconds. Slideshow needs at least two images, and fades respect reduced-motion settings.
- Turn **Wallpaper slideshow** on to cycle through all wallpapers in gallery order, regardless of the gallery filter. Choose **None** or **Fade** and set **Display time** in seconds, from 5 to 86400. The default is 60 seconds. Slideshow needs at least two wallpapers. Fades apply between images and respect reduced-motion settings; video and HTML switch instantly. Live playback itself does not pause under reduced motion.

To remove an upload, hover or focus its tile and click **X**. Remove folder images by moving or deleting their source files.
To remove an upload, hover or focus its tile and click **X**. Remove folder wallpapers by moving or deleting their source files.

## Koi Pond example

[Koi Pond](https://github.com/Himanshu-Sangshetti/koipond) is a live WebGL wallpaper, not a video. Download `koipond-linux.tar.gz` from its [wallpaper release](https://github.com/Himanshu-Sangshetti/koipond/releases/tag/wallpaper-v0.2.0), extract `web/index.html`, and save it in your wallpaper folder as `Koi Pond.html`. No installer is needed. Select it in **Settings > Wallpapers**.

Save the repo's [poster image](https://raw.githubusercontent.com/Himanshu-Sangshetti/koipond/main/.github/assets/hero.webp) beside it as `Koi Pond.poster.webp` to show the pond before hovering.

Other HTML animations work the same way when bundled into one file. The wallpaper cannot intercept clicks or read the OpenCode interface. HTML fills the panel; the fit setting applies to images and videos.

## Optional folder configuration

Expand All @@ -45,7 +57,7 @@ You can set an initial folder with an absolute path instead of choosing one in S
"$schema": "https://opencode.ai/config.json",
"plugins": [
{
"package": "github:viralcodex/opencode-backdrop#v0.2.0",
"package": "github:viralcodex/opencode-backdrop#v0.3.0",
"options": { "folder": "/absolute/path/to/wallpapers" },
},
],
Expand All @@ -56,10 +68,15 @@ The folder chosen in Settings takes precedence over this option.

## Development

Use Bun 1.4.4, as pinned in `package.json`, so the generated bundle matches CI.

```sh
bun run check
bun run test:styles
bun run test:storage /path/to/opencode
```

`check` includes native Node filesystem-watcher tests and rebuilds the GUI bundle. `test:styles` runs that bundle's setup, wallpaper switching, stylesheet cleanup, and gallery-toggle checks in headless Chrome; set `CHROME_BIN` if Chrome is installed elsewhere. `test:storage` checks migration against an OpenCode checkout's actual persistence decoder. Pass the checkout path or set `OPENCODE_CHECKOUT`.
`check` rebuilds the GUI bundle and runs unit, native Node filesystem-watcher, headless Chrome, and package checks. Set `CHROME_BIN` to a Chrome or Chromium executable if it is installed elsewhere. The PR workflow runs these checks and rejects a stale committed bundle. `test:storage` checks migration against an OpenCode checkout's actual persistence decoder. Pass the checkout path or set `OPENCODE_CHECKOUT`.

## Release

See [CHANGELOG.md](CHANGELOG.md) for the 0.3.0 release notes. Before tagging `v0.3.0`, run `bun install --frozen-lockfile --ignore-scripts` and `bun run check`, then commit the rebuilt `dist/gui-experimental.cjs` with the source changes. Run the host-storage check against a supported OpenCode checkout and smoke-test the installed package in Desktop. Keep the local `showcase/` captures and artwork out of this PR.
2 changes: 1 addition & 1 deletion bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

44 changes: 31 additions & 13 deletions dist/gui-experimental.cjs

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "https://json.schemastore.org/package.json",
"name": "opencode-backdrop",
"version": "0.2.0",
"version": "0.3.0",
"description": "Use your own local wallpapers in OpenCode Desktop",
"type": "module",
"license": "MIT",
Expand All @@ -24,11 +24,12 @@
"index.ts",
"dist/gui-experimental.cjs",
"README.md",
"CHANGELOG.md",
"LICENSE"
],
"scripts": {
"build:gui": "bun --bun vite build",
"check": "bun run typecheck && bun run build:gui && bun run test && bun run test:node && bun run check:package",
"check": "bun run typecheck && bun run build:gui && bun run test && bun run test:node && bun run test:styles && bun run check:package",
"check:package": "bun script/check-package.ts",
"typecheck": "tsc --noEmit",
"test": "bun test --conditions=browser src",
Expand All @@ -37,7 +38,7 @@
"test:storage": "bun script/check-preferences.ts"
},
"peerDependencies": {
"@opencode/plugin": "~2.2.6 || ~2.3.2 || ^0.0.0-dev",
"@opencode/plugin": "~2.2.6 || ~2.3.2 || ~2.4.3 || ^0.0.0-dev",
"effect": "^4.1.0",
"solid-js": "^1.9.17"
},
Expand Down
2 changes: 1 addition & 1 deletion script/check-package.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const [packed] = JSON.parse(output) as { size: number; unpackedSize: number; fil
assert(packed, "npm pack returned no package")
const files = packed.files.map((file) => file.path).sort()
assert.deepEqual(files, [
"LICENSE", "README.md", "package.json",
"LICENSE", "README.md", "CHANGELOG.md", "package.json",
...new Set(Object.values(manifest.exports).map((file) => file.replace(/^\.\//, ""))),
].sort(), "Unexpected package contents. Keep local images, tests and build tools out of the release.")
assert(packed.unpackedSize < 256 * 1024, "Package exceeds the 256 KiB release budget")
Expand Down
Loading