Skip to content

ScriptWidget for Linux: preview for Omarchy 4.5 - #77

Merged
everettjf merged 22 commits into
mainfrom
linux
Nov 18, 2026
Merged

everettjf merged 22 commits into
mainfrom
linux

Conversation

@everettjf

@everettjf everettjf commented Nov 18, 2026 •

Copy link
Copy Markdown
Owner

What this is

ScriptWidget for Linux, written in Rust, as a first preview for Omarchy 4.5: the same Package 2.0 widgets as on the other platforms, shown on the Omarchy desktop. No issue linked.

Widgets on the Omarchy desktop

  • Linux/crates/sw-quickjs: the vendored QuickJS-NG sources (unmodified) behind a safe wrapper.
  • Linux/crates/sw-core: the runtime, ported from Windows/src/ScriptWidget.Core: packages and archives, compiler, executor, Intl through the system ICU, native APIs, Data Source Plugins, timeline.
  • Linux/crates/sw-render: the painter on Skia.
  • Linux/crates/sw-host: the background service; it draws each placed widget to PNG files and serves the display over a user-only socket.
  • Linux/crates/sw-cli: scriptwidget, the command line, which also starts the service.
  • Linux/crates/sw-studio: the management window on GPUI and gpui-kit (behind the ui feature).
  • Linux/omarchy-plugin: the QML plugin of the Omarchy shell that shows the pictures and forwards clicks.
  • Linux/packaging, Linux/scripts/package.sh: the release archive with a per-user installer.
  • Workflows linux.yml (tests on x86_64 and aarch64) and linux-release.yml (x86_64 archive built on Arch Linux).
  • docs/linux: README, protocol, TODO, test record; a Linux column in docs/platform-support.md; the linux-v tag rule; AGENTS.md.

Outside Linux/ and docs/linux/ only documentation, .gitignore, AGENTS.md and the two new workflows change. The shared JavaScript and the other platforms are untouched.

Security and compatibility

  • No contract changes. $system.platform() returns "linux"; differences are listed in docs/linux/README.md.
  • Package files are opened with openat2 (RESOLVE_BENEATH, no symlinks) and must be regular files with one link; archives are checked whole before extraction and installed transactionally; a present but malformed manifest fails closed.
  • The network client resolves the host itself, refuses non-public addresses, connects only to the checked address, re-checks every redirect and drops Authorization and Cookie on another origin.
  • The service socket is user-only with a peer check; requests carry only names, ids, integers and fixed words. The plugin, which runs unsandboxed inside the Omarchy shell, shows only PNG files from the service's folder and sends back numbers.
  • The six display fonts of the other platforms are not shipped on Linux: the repository records no licence for them and the notice inside Unispace.ttf forbids redistribution. Text that asks for one is drawn with Inter. The same files ship in the other apps; that is not changed here.

What ran

Details and dates are in docs/linux/testing.md.

  • cargo test --locked --workspace in an aarch64 Omarchy 4.5 virtual machine: 512 passed, 0 failed, 1 ignored.
  • Parity with the JavaScriptCore reference trees: 127 of 127 identical.
  • CI on this branch: the Linux workflow on x86_64 and aarch64 (tests, AddressSanitizer run of the engine binding, clippy), and the release archive workflow on Arch Linux.
  • From the installed release archive on Omarchy 4.5: install, four widgets on the desktop, animated GIF, a tap on a button, click-through outside buttons, arrange and drag, resize, remove, Edit opening the management window, Add to desktop from the window, service restart, shell restart, service stop and start, uninstall and reinstall.
  • The plugin's own check script against a protocol stand-in: 64 of 64.

Not run, or not done

  • Everything a person can see ran in one virtual machine with a virtual GPU, one 1920×1080 display at scale 1, and a virtual pointer. No real computer, real GPU, scale above 1, several displays, light theme, input method, sleep and wake, or restart of the computer.
  • The x86_64 archive never showed widgets on a desktop; it is built and tested headless.
  • The programs link ICU 78 by its versioned name and will need a new build when the distribution moves on.
  • No pixel comparison with Windows or iPhone pictures. No request to a real Internet host in tests.
  • No AUR package, no Omarchy plugin catalog entry, no signature on the archive.
  • ./Scripts/release-readiness.sh was not run locally: it does not cover Linux. Android and Windows suites were not run: no shared source changed.
  • Remaining work is in docs/linux/TODO.md.

🤖 Generated with Claude Code

everettjf and others added 22 commits November 17, 2026 16:07
…ement window

Replaces the on-hold command-line plan. Records the Omarchy 4.5, RiftVM
and GPUI findings, the display protocol between the host and the Omarchy
plugin, and the phase 0 checks to run in the RiftVM guest.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Adds the start of the Linux runtime and the results of the feasibility
phase, run in an Omarchy (Arch Linux ARM, aarch64) virtual machine.

- Linux/crates/sw-quickjs: the vendored QuickJS-NG sources built with cc,
  unmodified, behind a safe Rust wrapper.
- Linux/crates/sw-core: shared scripts, package compiler, executor, Intl
  through the system ICU, $storage. The parity test compares the element
  tree of every bundled package that needs no live data with the
  JavaScriptCore reference: 127 of 127 identical on aarch64.
- Linux/scripts/build-shared-js.mjs generates the shared JavaScript and
  the parity corpus (not checked in).
- Linux/spikes: throwaway checks of skia-safe drawing, a Quickshell plugin
  that shows rendered pictures on the desktop layer and sends clicks and
  drags back, and a GPUI window with the gpui-kit code editor.
- docs/linux/testing.md records what ran and what did not: no real
  hardware, no input method, no real GPU, and the Omarchy update to 4.5
  ended with one failed migration.
- docs/linux/plan.md is updated with what the phase verified.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Port the package layer of the Windows runtime to Rust in sw-core:
path rules, package names, archive preflight, transactional import and
export of .swt archives, the package library, the read-only view the
runtime ($file, $import) reads through, and the XDG data directories.

Files inside a package are opened relative to the package directory
with openat2 (RESOLVE_BENEATH, RESOLVE_NO_SYMLINKS) and checked with
fstat before they are read: only a regular file with one link is a
package file. Where openat2 is missing the path is walked with one
openat and O_NOFOLLOW per component. Packages are published with
renameat2 and RENAME_NOREPLACE.

As on Android, the names only Win32 cannot store are ordinary names;
a colon in an archive entry is still refused, as on every platform.
The ZIP container is read through the preflight's own view of the
central directory, so no second parser can disagree with it; flate2
(pure Rust) only inflates and deflates.

Tests: the Windows package tests and JsonTests ported, and Linux
security tests in place of WindowsPackageSecurityTests (symbolic and
hard links, sockets and FIFOs, file modes, case and normalization
collisions, names that are not UTF-8, another filesystem for staging).

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…ons on Skia

Phase 1, part C of the Linux plan. The new crate ports
Windows/src/ScriptWidget.Core/Render (itself a port of Android's painter):
the shared web renderer lays the tree out in a QuickJS context of its own,
which only sees the tree as data, and the recorded elements are painted on a
CPU raster surface with skia-safe 0.157. No graphical session is needed.

- Output: premultiplied RGBA pixels, PNG, tap regions in points with the
  interaction the shared renderer recorded (button, toggle, link), and the
  animated GIFs with their frame delays. A request picks the moment of the
  GIF animation to draw; gif::decode returns all frames (at most 60, bounded
  canvas and total pixels).
- Text is measured and drawn by the same Skia paragraph. Two things differ
  from what Skia does alone: its line metrics count in UTF-16 units, and it
  starts a word that is wider than the box on the line before; lines are
  broken as CSS overflow-wrap: break-word breaks them. The rounding of the
  layout width is turned off: a line measured at 107.2 did not fit a box of
  107.5, which truncated text that fits.
- Fonts: Inter and the six display fonts are embedded at build time from
  Android/core/src/main/assets/fonts (no second copy). Every face a paragraph
  names is registered with the paragraph's own provider, system faces
  included, because looking a system family up by name through fontconfig
  did not return that family on the test machine. The CJK faces are ordered
  from the locale (Simplified Chinese first unless the locale is Traditional
  Chinese, Japanese or Korean). A character with the emoji variation selector
  is drawn with the emoji face even where Inter has a plain glyph.
- Untrusted input: image files over 16 MB and pictures over 40 million
  pixels are refused from their header; res: paths are normalized; the
  recorded tree is depth-limited.

Not ported: self-updating date, motion and scrolling-list slots (the Linux
host renders again instead), which the Windows and Android hosts use.

Shared files: the workspace gains the member, sw-core as a workspace
dependency and skia-safe; .gitignore gains the pictures the tests write.
sw-core and sw-quickjs are unchanged.

Tests (63: 49 in the crate, the corpus run and 13 renderer tests; all 127 corpus packages at
170x170, 329x170 and 329x345, scale 2) pass on the aarch64 Omarchy test
machine and on macOS.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…nner

Ports the Windows runtime's native side to sw-core, with its tests:

- fetch and $http (api/fetch.rs) over a small HTTP/1.1 client of our own
  (api/http.rs, std sockets + rustls). Every host is resolved here, refused
  when any address is private, loopback, link-local or otherwise not public,
  and the socket connects only to an address that was checked; TLS is
  verified against the host name with the system's certificate store.
  Redirects are followed by hand with the same checks at every hop, and a
  redirect to another origin does not carry Authorization, Cookie or
  Proxy-Authorization. No proxy, no cookies, one request per connection.
- $weather (MET Norway), the Runtime 1.6 system-service support it needs,
  $device and $system from /etc/os-release, /proc and /sys.
- $xml: a bounded parser without document types or entities; the executor
  now answers xml.parse.
- Data Source Plugin 1.0: strict JSON, manifest validation, the plugin
  store with .swplugin import and export, request building and
  $dataSource.
- The timeline planner over the shared prepare bundle.

executor.rs: xml.parse is wired; Completion::detached and
ExecutionSession::finish let hosts and tests call a module outside an
execution; and a heap exhaustion that the kernel caught as a null
exception is reported as resourceLimit like the one that escapes it.

New dependencies: rustls (ring), rustls-native-certs, httparse, flate2,
libc, icu_normalizer, unicode-segmentation. The reasoning for the HTTP
stack is in Linux/Cargo.toml.

Tests never reach the Internet: exchanges are answered in the process, and
the socket tests route fixture addresses to local listeners through the
dialer the host may replace, with the address checks left in force.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
# Conflicts:
#	Linux/Cargo.lock
#	Linux/Cargo.toml
#	Linux/crates/sw-core/Cargo.toml
#	Linux/crates/sw-core/src/lib.rs
# Conflicts:
#	Linux/Cargo.lock
#	Linux/Cargo.toml
A static library has to come before the libraries it refers to; unit tests
inside sw-core that reached Intl failed to link on Linux.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
- Linux/crates/sw-cli: the `scriptwidget` command line. new, check, run,
  render, timeline, pack, install, list, templates and doctor work without
  a background service and print one JSON report each; the commands that
  need the service exit with 69 until it exists.
- sw-core: WidgetRuntime (compile, cache, execute), Library (installed
  packages and bundled templates) and Resources, which finds the generated
  JavaScript and the templates in a data directory at run time instead of
  in the repository. sw-render: the painting half of the facade.
- Linux/scripts/stage-resources.sh assembles that data directory;
  Linux/scripts/asan-test.sh runs the engine binding tests with
  AddressSanitizer in QuickJS, which now links its runtime.
- .github/workflows/linux.yml builds and tests on x86_64 and aarch64. It
  has not run yet: it starts on a pull request or a push to main.
- docs/linux: README, TODO and the phase 1 test record (418 tests pass in
  the aarch64 Omarchy virtual machine; 116 bundled templates drawn with no
  graphical session). AGENTS.md describes the Linux folder and commands.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The repository records a licence for Inter only, and the notice inside
Unispace.ttf forbids redistribution, so a Linux release must not carry
them. Each is now an optional file in SCRIPTWIDGET_FONTS or
share/scriptwidget/fonts; without it the text is drawn with Inter.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Linux/omarchy-plugin shows the pictures the background service draws on the
desktop layer, sends taps, moves, menu choices, screens and the theme back,
and adds a bar entry. It programs against the display protocol of
docs/linux/plan.md section 4.8 and was checked against a stand-in for the
scriptwidget program (tests/), not yet against the real service.

Arrange mode uses one window per screen instead of the widget windows:
Hyprland stops sending pointer motion to a small layer surface once the
pointer leaves it when no window has the keyboard, so dragging the widget
windows themselves lost fast drags on an empty desktop.

tests/check.sh ran on the Omarchy 4.5.0 test machine (one monitor, scale 1):
64 checks passed; the output and screenshots are in tests/out.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
scriptwidget-studio, a native window on GPUI and gpui-kit (=0.10.0): My
widgets, Templates, the code editor with completion and a live preview,
and Settings. The window is behind the crate's `ui` feature so that
`cargo test --workspace` needs no graphical stack; build it with
`cargo build --locked --release -p sw-studio --features ui`.

- Package content is untrusted: it is shown as text and as the picture
  sw-render draws, and compiled and run only inside the engine, off the
  window's thread. A .swt file is inspected and shown before it is imported.
- Saving goes through the package store; exports are written beside the
  target and renamed.
- One window per user: a lock and a socket under
  $XDG_RUNTIME_DIR/scriptwidget, same user only. `--edit <widget>` and a
  .swt path are handed to the running window.
- "Add to desktop" runs `scriptwidget add` as a child process and says so
  when the service is not running (exit code 69).
- The interface follows the system language: Simplified Chinese for a
  simplified-Chinese locale, English for every other.
- Completion data is generated from Editor/editorfe/src/scriptWidgetAPI.js
  by Linux/scripts/build-shared-js.mjs and built into the program.
- Desktop file, MIME type for .swt and icons from the shared app icon in
  Linux/packaging. Screenshots in docs/linux/images.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
sw-host is the service: it runs each placed widget on a schedule, draws it
to PNG files under $XDG_RUNTIME_DIR/scriptwidget/frames and serves the
display protocol on a socket for the user alone. The scriptwidget program
is the service (scriptwidget host run) and its client: add, remove,
widgets, refresh, dev, peek, arrange, watch, tap, move, screen, theme,
menu and session. docs/linux/protocol.md writes the protocol out with the
decisions the plan left open.

sw-core gains PackageStore::delete_file for dev; sw-render gains a cache
of decoded GIF frames that is only used while the service draws a cycle.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
- Linux/scripts/package.sh builds scriptwidget-<version>-linux-<arch>.tar.gz:
  the two programs, the runtime files and templates, the systemd user unit,
  the desktop entry, and the Omarchy plugin, with install.sh and
  uninstall.sh that work for one user without root.
- The archive carries no display fonts; the script fails if it finds one.
- .github/workflows/linux-release.yml builds the x86_64 archive on Arch
  Linux and checks the unpacked result.
- The plugin waits longer before dropping widgets the service has not named
  again after a reconnect.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
README for users (install, use, limits), the phase 2 to 4 test record, the
known limits in TODO, the Linux column of the platform page, the linux-v
release tag rule, and the repository guidelines. The spikes are replaced by
the real service, plugin and window.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
On Arch Linux the system's Noto Sans sets the sample within half a pixel of
Inter, so the width comparison failed there.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@everettjf everettjf changed the title Linux: runtime, Skia painter and command line (phases 0 and 1) ScriptWidget for Linux: preview for Omarchy 4.5 Nov 18, 2026
@everettjf
everettjf merged commit e09f54b into main Nov 18, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant