wayBetter for X 1.0.2

This commit is contained in:
CRTkafa 2026-10-02 02:54:04 +07:00
parent 7e2515aa42
commit 467aea2e28
212 changed files with 10208 additions and 2345 deletions

View file

@ -1,5 +1,27 @@
# Changelog # Changelog
## 1.0.2
### New
- **Open with wayBetter.** Double-click a `.plugin.js`, `.strings.json`, `.icons.json` or theme `.json` (or use Open with) and it opens on the same install screen as a dropped file. Nothing installs without that screen, and wayBetter never becomes the default program for `.js` or `.json` files.
- **Icon packs in the Store**: Line, Classic, Aero and Pixel, plus two new retro packs drawn for wayBetter, Windows 98 and Windows XP, covering X's left rail, the action bar and the composer. The area plugins appear in the in-app Store as Built in, with their switch.
- **String packs can translate whole sentences with links and names in them** ("Replying to @…", "Followed by …"), using X's own links. Packs can apply to one language only.
- **"Tweet" wording is a built-in string pack.** It applies only while X is in English, and turning it off brings "Post" back.
- **Theme doctor report** in the Theme Builder: every finding with where it is, what is wrong and how to fix it, in your language.
### Better
- **Themes are one design everywhere.** Windows 98 is a real Windows 98: bevelled window, title bar, tabs and settings, a taskbar at the bottom, the compose box as a window. Every theme now draws its menus, hover cards, compose dialog, sidebar cards and chat in its own shape and corners, and the app's window follows the theme's corners and accent.
- **macOS has a real menu bar**: wayBetter, File, Edit, View (theme, icon pack, mode, zoom), Account, Plugins, Window (workspaces) and Help, in your language. The media panel moves to ⌘⇧M on macOS.
- **Windows 98 is a real taskbar at every width**: buttons share the bar and shrink to icons on narrow windows; X's Grok and chat buttons sit above it. Menus and the account switcher read cleanly in every theme.
- **A pane with its own theme keeps it**, also while the Theme Builder previews another theme.
- Composer icons keep the theme's colour (X's brightening filter turned Classic's blue cyan).
### Fixed
- **macOS: find in page highlights every match** and the current one.
- **macOS: closing the window keeps the app running** (it goes to the Dock; a Dock click brings it back, Cmd+Q quits).
- **macOS: a deck column no longer comes back empty** after the window was narrow and grew again.
- Older apps (1.0.0, 1.0.1) keep a working Store: the new item kinds live in a second signed catalog only 1.0.2 and later read.
## 1.0.1 ## 1.0.1
### Fixed ### Fixed

218
README.md
View file

@ -1,102 +1,118 @@
<p align="center"><img src="apps/desktop/src-tauri/icons/128x128@2x.png" width="112" alt="wayBetter for X"></p> <p align="center"><img src="assets/readme/hero.webp" width="880" alt="wayBetter for X: Windows 98 on the left pane, Night Ink on the right, two accounts in one window"></p>
<h1 align="center">wayBetter for X</h1> <h1 align="center">wayBetter for X</h1>
<p align="center">The real x.com in a light desktop app: tabs, split panes, several accounts side by side, <p align="center"><b>X, the way it should work.</b> The real x.com in a light desktop app: tabs, split panes,
themes, plugins, and fixes for some of X's own bugs.<br> every account side by side, themes, plugins, and fixes for the bugs X ships.<br>
Free and open source, GPL-3.0-or-later. No ads, no paid tier, no telemetry.</p> Free and open source (GPL-3.0-or-later). No ads, no paid tier, no telemetry.</p>
<p align="center"><a href="https://waybetter.fyi/x/">Website and download</a> · <p align="center"><a href="https://waybetter.fyi/x/"><b>Download</b></a> ·
<a href="https://waybetter.fyi/store/">Store</a> · <a href="https://waybetter.fyi/store/">Store</a> ·
<a href="docs/THEMES.md">Make a theme</a> · <a href="docs/THEMES.md">Make a theme</a> ·
<a href="docs/PLUGINS.md">Write a plugin</a> · <a href="docs/PLUGINS.md">Write a plugin</a> ·
<a href="https://git.crt.fyi/CRT/waybetter">The framework</a></p> <a href="https://git.crt.fyi/CRT/waybetter">The framework</a> ·
<a href="CHANGELOG.md">Changelog</a></p>
<p align="center"><img src="apps/web/public/demo/hero.jpg" width="880" alt="Two accounts side by side in split view"></p>
wayBetter for X is not a new X client. It opens X's own website in a small native window (Tauri 2, wayBetter for X is not a new X client. It opens X's own website in a small native window (Tauri 2,
one system WebView per tab) and changes it in place, in your window only, the way BetterDiscord one system WebView per tab) and changes it in place, in your window only, the way BetterDiscord
extends Discord. It is the first app built on [waybetter](https://git.crt.fyi/CRT/waybetter), a extends Discord. It runs on macOS, Windows and Linux, and it is the first app built on
framework for doing the same to other apps. [wayBetter](https://git.crt.fyi/CRT/waybetter), a framework for doing the same to other sites.
It is an independent project, not affiliated with, endorsed by or sponsored by X Corp.
It is an independent project and is not affiliated with, endorsed by or sponsored by X Corp. ## Why
## What it does ### It fixes what X won't
- **Tabs and split view.** Posts, profiles and searches open in tabs or side by side, each with an Click Like eight times, fast. The clicks cancel out, so the post should end up not liked. In a
address bar. Two panes of the same account share one navigation rail. browser X still shows a like; in wayBetter the heart, the count and the server agree. The same fix
- **Several accounts at once.** Each account signs in through X in its own profile and stays signed in. covers repost, bookmark and follow.
- **A deck.** The Deck (Ctrl+Shift+D) puts columns of X side by side (Home, Following,
Notifications, Mentions, Search, List, Profile, Bookmarks), each in the account you pick, with
unread counts and per-column filters. Every column is the real x.com. See
[docs/POWER-USER.md](docs/POWER-USER.md).
- **Fixes for X's bugs.** For example the like, repost, bookmark and follow race, where spam-clicking
leaves the heart, the count and the server disagreeing (before and after:
[apps/web/public/demo/fix-like.jpg](apps/web/public/demo/fix-like.jpg)).
- **Drafts.** What you type in X's composers is kept locally, with every revision, and can be
restored, compared and exported.
- **Backup, sync and workspaces.** Everything you set up exports to one `.waybetter` file (never
cookies or logins; drafts only if you tick it). Optional sync goes through a folder you already
sync, encrypted with your passphrase. Named workspaces save your tabs, splits and decks.
- **Command palette (Ctrl+K)**, find in page, per-tab zoom, link routing (open X links beside, in a
new tab or in your browser), keyword alerts as local notifications, a gallery and clipboard
history panel, and a safe mode (start with `--safe-mode`, or hold Shift) that runs X without
any of the above.
### Area plugins and modes <video src="/CRT/waybetter-for-x/media/branch/main/assets/readme/like-fix.mp4" poster="/CRT/waybetter-for-x/media/branch/main/assets/readme/like-fix.webp" autoplay loop muted playsinline width="860"></video>
The tweaks are organised into eight area plugins, each a card in wayBetter, Plugins with its own ### Unlimited accounts, all signed in
switch and settings:
| Plugin | Covers | Drag a tab to the edge to split. Each account lives in its own profile and stays signed in, so all of
| --- | --- | them sit side by side in one window. You log in on x.com itself, the normal way.
| Compose+ | The composer: posting-as chip, length meter, reply guard and similar |
| Reader+ | Reading: read marker, clean links, copy as Markdown, exact timestamps, reading time, thread reader, muted regex |
| Profile+ | Profiles: user notes, private labels, hover peek |
| Chat+ | Messages (only for what you explicitly do, e.g. starring a message; nothing is collected on its own) |
| Media+ | Media: video speed, alt-text reminder and more |
| Search+ | Search: operator chips, saved searches, advanced search |
| Notifications+ | Notifications |
| Navigation+ | Navigation: focus mode and more |
Around them are 14 core flags that belong to no plugin (branding, split-view navigation, the fixes). <video src="/CRT/waybetter-for-x/media/branch/main/assets/readme/split-accounts.mp4" poster="/CRT/waybetter-for-x/media/branch/main/assets/readme/split-accounts.webp" autoplay loop muted playsinline width="860"></video>
Three modes are presets: **Basic**, **Advanced** (the default) and **Power User**; a mode is a
starting point and never a lock. The full contract, and how to add a feature, is in
[docs/AREA-PLUGINS.md](docs/AREA-PLUGINS.md). Your own `*.plugin.js` files still work; see
[docs/PLUGINS.md](docs/PLUGINS.md). Plugins can declare `@permissions`; that is a guard rail, not a
sandbox (see [SECURITY.md](SECURITY.md)).
### Themes, packs and languages ### Every theme a different Twitter
- **14 built-in themes** on one colour model with contrast enforced: X default, Classic Twitter, Night Fourteen built-in themes, and not just colours: shapes, type, icons and layout. Windows 98 is a real
Ink, Terminal, Paper, Dracula, Nord, Tokyo Night, Solarized Light, Frutiger Aero, Windows 98, Windows 98. Contrast is enforced for every theme, built in or imported.
Vaporwave, High Contrast and Midnight OLED. A Theme Builder (palette from three colours, contrast
report, a font per role, Google Fonts you choose are downloaded on your machine after asking), <video src="/CRT/waybetter-for-x/media/branch/main/assets/readme/theme-burst.mp4" poster="/CRT/waybetter-for-x/media/branch/main/assets/readme/theme-burst.webp" autoplay loop muted playsinline width="860"></video>
per-account and per-pane themes, and custom CSS. A theme is a small JSON file
([docs/THEMES.md](docs/THEMES.md)); import and export it from Appearance. ### Star a message, jump back to it
- **String packs** replace X's own interface strings with data: a language X does not offer, a
fixed translation, a rewording. Drop a `.strings.json` on the window, open a link, or pick one in Chat+ keeps the messages you star, however far up the chat they go. Open one from your starred list
the Store under Languages; the install screen shows its language, its coverage of X's strings and and you are back at it, with X's own Reply ready. Starred messages stay on your computer; Chat+
a sample, and Languages turns packs on or off and orders them. Only known string keys can change never reads, types or sends anything on its own.
and a pack is never code. The Store lists one so far, Esperanto. `waybetter strings check` validates one; the format is described in
`docs/STRING-PACKS.md` of the framework repository. <video src="/CRT/waybetter-for-x/media/branch/main/assets/readme/chat-plus.mp4" poster="/CRT/waybetter-for-x/media/branch/main/assets/readme/chat-plus.webp" autoplay loop muted playsinline width="860"></video>
- **Icon packs**: Appearance, Icons follows the theme, keeps X's own icons or picks one of four
packs (Line, Classic, Aero, Pixel 98). A theme can suggest a pack. ### X in a language X doesn't have
- **51 languages** for the app itself (right-to-left included), following X, your system or your
pick. Most are machine drafts and marked as such; 17 languages (18 catalogs, English and British String packs re-word X with data, never code: a language X does not offer, a better translation,
English counted as one) are in the supported tier. Help fix yours: or your own wording. Here, Esperanto: Hejmo, Esplori, Sciigoj.
[docs/TRANSLATING.md](docs/TRANSLATING.md).
- **The wayBetter Store** lists themes and plugins in one signed catalog, in the app and at <video src="/CRT/waybetter-for-x/media/branch/main/assets/readme/string-pack.mp4" poster="/CRT/waybetter-for-x/media/branch/main/assets/readme/string-pack.webp" autoplay loop muted playsinline width="860"></video>
[waybetter.fyi/store](https://waybetter.fyi/store/). Every item shows its code and what it asks
for, and nothing installs until you confirm in the app. ### One menu for all of it
The wB button in every pane: new tabs and splits, language, theme, mode, zoom, Plugins, Store,
Workspaces, Drafts, and find in page with every match highlighted.
<video src="/CRT/waybetter-for-x/media/branch/main/assets/readme/app-menu.mp4" poster="/CRT/waybetter-for-x/media/branch/main/assets/readme/app-menu.webp" autoplay loop muted playsinline width="860"></video>
### Signed, and nothing installs behind your back
Themes, plugins, string packs and icon packs come from the signed Store, a `waybetter://` link or a
file dropped on the window. Every install shows a screen first: name, source, size, SHA-256,
permissions and the code. Nothing installs until you confirm.
<video src="/CRT/waybetter-for-x/media/branch/main/assets/readme/store.mp4" poster="/CRT/waybetter-for-x/media/branch/main/assets/readme/store.webp" autoplay loop muted playsinline width="860"></video>
## Install ## Install
Download the Windows installer from [waybetter.fyi/x](https://waybetter.fyi/x/). It installs per | | Download | First launch |
user (no admin), uses the system WebView2, and updates itself with signed updates. Sign in to X in | --- | --- | --- |
the app as usual. macOS and Linux builds are not offered yet. | **Windows** | [Installer (.exe)](https://waybetter.fyi/v1/download/windows/latest) | Installs per user, no admin. Not code-signed yet: SmartScreen says "unknown publisher"; choose More info, Run anyway. |
| **macOS** (universal) | [App (.app.tar.gz)](https://waybetter.fyi/v1/download/darwin/latest) | Unpack and move to Applications. Not notarized yet: the first time, allow it in System Settings, Privacy & Security, Open Anyway. |
| **Linux** x86-64 | [AppImage](https://waybetter.fyi/v1/download/linux/latest) | `chmod +x` the file and run it. |
The builds are not code-signed yet: Windows SmartScreen shows "unknown publisher" on first launch. All downloads, release notes and the Store are on [waybetter.fyi/x](https://waybetter.fyi/x/). The
app updates itself with signed updates. Sign in to X in the app as usual.
## Features
| Area | What you get |
| --- | --- |
| **Window** | Tabs and split panes with an address bar each, drag links to split, pinned tabs, restore on launch, per-tab zoom, find in page, command palette (Ctrl+K), link routing (beside, new tab, browser) |
| **Accounts** | Every account in its own profile, signed in at once; "open as" any account; per-account and per-pane themes |
| **Deck** | Columns of X (Ctrl+Shift+D): Home, Following, Notifications, Mentions, Search, List, Profile, Bookmarks, each in the account you pick, with unread counts and filters. Every column is the real x.com. See [docs/POWER-USER.md](docs/POWER-USER.md) |
| **Fixes** | The like, repost, bookmark and follow race; upload retry; timeline fixes. No plugin switch turns them off |
| **Area plugins** | Compose+, Reader+, Profile+, Chat+, Media+, Search+, Notifications+, Navigation+: one card each, a switch per feature. Modes Basic, Advanced and Power User are starting points, never locks. See [docs/AREA-PLUGINS.md](docs/AREA-PLUGINS.md) |
| **Drafts** | What you type in X's composers is kept locally with every revision, to restore, compare or export |
| **Look** | 14 themes, a Theme Builder with a doctor report and Google Fonts per role, icon packs (Line, Classic, Aero, Pixel, Windows 98, Windows XP), custom CSS. A theme is one JSON file: [docs/THEMES.md](docs/THEMES.md) |
| **Languages** | The app in 51 languages (17 supported, the rest community drafts); string packs for X itself, including the built-in "Tweet" wording |
| **Store** | One signed catalog of themes, plugins, string packs and icon packs, in the app and at [waybetter.fyi/store](https://waybetter.fyi/store/). Open With for `.plugin.js`, `.strings.json`, `.icons.json` and theme files |
| **Your setup** | Workspaces (tabs, splits, decks, accounts, pane themes) in one click; backup to one `.waybetter` file; encrypted sync through a folder you already sync; share your look as a link |
| **Make** | `*.plugin.js` plugins with declared `@permissions`, runnable examples and the UI kit in the app, developer mode with live reload. See [docs/PLUGINS.md](docs/PLUGINS.md) |
| **Safe mode** | Start with `--safe-mode` or hold Shift: X with none of the above, for that run only |
## Privacy
- The app never posts, likes, follows, unfollows or deletes anything by itself, never collects
direct messages and never reads your credentials. It works with the data X already loads for the
page and makes no requests of its own to X.
- Settings, drafts and plugins stay on your machine. Backups and sync snapshots never contain
cookies, WebView profiles, tokens or keys.
- The app contacts only the update server (signed updates), the Store (signed catalog and the files
you choose; only waybetter.fyi, cdn1.crt.fyi and git.crt.fyi) and, when you pick a Google Font,
Google's font hosts. There is no analytics of any kind.
- X can change its website at any time; a feature that depends on a part X changed pauses itself
and says so. Using a modified client is your decision; read X's terms.
## Build it from source ## Build it from source
@ -120,51 +136,23 @@ bun run desktop:build # an unsigned native build (no installer)
| `apps/desktop/src/inject` | The runtime injected into X tabs: features, themes, `window.wayBetter` plugin API | | `apps/desktop/src/inject` | The runtime injected into X tabs: features, themes, `window.wayBetter` plugin API |
| `apps/desktop/src/areas` | The eight area plugins and the one feature table they share | | `apps/desktop/src/areas` | The eight area plugins and the one feature table they share |
| `apps/desktop/src/fixes` | Fixes for X's own bugs (mutation gate, upload retry, timeline) | | `apps/desktop/src/fixes` | Fixes for X's own bugs (mutation gate, upload retry, timeline) |
| `apps/desktop/src/ui` | The app's panel sections: drafts, Make examples, theme preview |
| `apps/desktop/src-tauri` | Rust: X's site adapter, the drafts vault, IPC policy and the app's commands | | `apps/desktop/src-tauri` | Rust: X's site adapter, the drafts vault, IPC policy and the app's commands |
| `apps/web` | The website (waybetter.fyi) and the Store's pages | | `apps/web` | The website (waybetter.fyi) and the Store's pages |
| `apps/api` | The update and download API | | `apps/api` | The update and download API |
| `packages/contracts` | Schemas shared by the API and the app | | `store/` | The Store's items for X (themes, plugins, packs) |
| `store/` | The Store's items for X (themes and plugins) |
| `waybetter/` | The framework (git submodule; also on npm as [`waybetter`](https://www.npmjs.com/package/waybetter)) | | `waybetter/` | The framework (git submodule; also on npm as [`waybetter`](https://www.npmjs.com/package/waybetter)) |
The generic mechanisms (window, tabs, profiles, themes, install rules, backup and sync formats, Everything generic (window, tabs, profiles, themes, the Store and install rules, backup, sync,
updates, the panel and shell UI) live in the framework, and so do the native commands for the updates, the panel) lives in the framework; this repository configures it for X.
Store, media, Google Fonts, updates, workspaces, sync, developer mode and the settings backup.
What the app still carries that is not X-specific: its keyword-alert and theme command wrappers, a
popover webview host, its own drafts vault and the theme colour engine. Those are on the list to
move.
## Make your own theme, plugin or translation ## Contributing
- In the app, **wayBetter, Make** has runnable examples: four example plugins in an editor that
checks the header the way the Plugins list reads it, a gallery of the plugin UI kit (toast,
alert, confirm, prompt, dialog) in your current theme, and a live view of the theme API.
- The docs: [docs/THEMES.md](docs/THEMES.md), [docs/PLUGINS.md](docs/PLUGINS.md),
[docs/PLUGIN-IDEAS.md](docs/PLUGIN-IDEAS.md), [docs/TRANSLATING.md](docs/TRANSLATING.md).
- To publish a theme or plugin in the Store, add one folder under `store/` in a pull request. Steps
and rules: [CONTRIBUTING.md](CONTRIBUTING.md#add-a-theme-a-plugin-or-a-translation) and
[store/README.md](store/README.md).
- To make a plugin, a theme or a whole app for another site with the framework's scaffolder, see the
[waybetter](https://git.crt.fyi/CRT/waybetter) README.
## Privacy
- The app never posts, likes, follows, unfollows or deletes anything by itself, never collects
direct messages, and never reads your credentials. It works with the data X already loads for the
page and makes no requests of its own to X.
- Settings, drafts and plugins stay on your machine. Backups and sync snapshots never contain
cookies, WebView profiles, tokens or keys.
- The app itself contacts the update server (signed updates), the Store (signed catalog and the
files you choose to install; only from waybetter.fyi, cdn1.crt.fyi and git.crt.fyi) and, when you
pick a Google Font, Google's font hosts. There is no analytics of any kind.
- X can change its website at any time; some features may then need an update. Using a modified
client is your decision; read X's terms.
## Contributing and security
Bug reports, fixes, themes, plugins and translations are welcome: [CONTRIBUTING.md](CONTRIBUTING.md). Bug reports, fixes, themes, plugins and translations are welcome: [CONTRIBUTING.md](CONTRIBUTING.md).
Security issues: [SECURITY.md](SECURITY.md). Third-party licences: [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md). To put a theme or plugin in the Store, add one folder under `store/` in a pull request
Release notes: [CHANGELOG.md](CHANGELOG.md). ([store/README.md](store/README.md)). Translations: [docs/TRANSLATING.md](docs/TRANSLATING.md).
Security issues: [SECURITY.md](SECURITY.md). Third-party licences:
[THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md).
Made by [@CRTkafa](https://x.com/CRTkafa). Licensed under GPL-3.0-or-later. ## License
GPL-3.0-or-later. Made by [@CRTkafa](https://x.com/CRTkafa).

View file

@ -8,7 +8,7 @@ this project's own contract and re-verified against the live x.com DOM.
## 98.css ## 98.css
The bevelled borders of theme engine v2 (`bevel-out` / `bevel-in` in `waybetter/packages/runtime/src/themeComponents.ts`, the Windows 98 theme's raised column, the classic scrollbar in `themeDecor.ts`) follow the raised and sunken edges of 98.css (https://github.com/jdan/98.css): four inset box shadows, re-computed from each theme's colors. No stylesheet is copied. The bevelled borders of theme engine v2 (`bevel-out` / `bevel-in` in `waybetter/packages/runtime/src/themeComponents.ts`, the Windows 98 theme's raised column, the classic scrollbar in `themeDecor.ts`, and the bevelled window, menus and settings panel of `waybetter/packages/shell/src/frame/edges.css`) follow the raised and sunken edges of 98.css (https://github.com/jdan/98.css): four inset box shadows, re-computed from each theme's colors. No stylesheet is copied.
``` ```
Copyright 2020 Jordan Scales Copyright 2020 Jordan Scales

View file

@ -396,6 +396,22 @@
"x.capture.idle": "لم يُعثر على مربع كتابة مدعوم · الالتقاط خامل", "x.capture.idle": "لم يُعثر على مربع كتابة مدعوم · الالتقاط خامل",
"x.capture.saved": "تم الحفظ محليًا · المسودة محفوظة في wayBetter for X", "x.capture.saved": "تم الحفظ محليًا · المسودة محفوظة في wayBetter for X",
"x.capture.found": "تم العثور على مربع الكتابة · يبدأ الحفظ محليًا عند الكتابة", "x.capture.found": "تم العثور على مربع الكتابة · يبدأ الحفظ محليًا عند الكتابة",
"x.translate.bar": "وضع الترجمة",
"x.translate.hint": "انقر على كلمة لتغييرها.",
"x.translate.edits": "{count, plural, zero {لا تعديلات} one {تعديل واحد} two {تعديلان} few {# تعديلات} many {# تعديلًا} other {# تعديل}}",
"x.translate.exportPack": "نسخ ملف الحزمة",
"x.translate.copied": "تم نسخ ملف الحزمة",
"x.translate.exit": "خروج",
"x.translate.reload": "أعد التحميل لرؤيته",
"x.translate.key": "المفتاح",
"x.translate.original": "الآن",
"x.translate.parameters": "المعاملات",
"x.translate.plural": "صيغة الجمع",
"x.translate.save": "حفظ",
"x.translate.cancel": "إلغاء",
"x.translate.remove": "إزالة التعديل",
"x.translate.notTranslatable": "لا يمكن تغيير هذا النص بواسطة حزمة بعد.",
"x.translate.choose": "أيّها؟",
"popover.conversation": "هذه المحادثة", "popover.conversation": "هذه المحادثة",
"popover.matches": "النتائج المطابقة", "popover.matches": "النتائج المطابقة",
"popover.recent": "الأحدث", "popover.recent": "الأحدث",

View file

@ -395,6 +395,22 @@
"x.capture.idle": "Не е намерен поддържан редактор · записът е в покой", "x.capture.idle": "Не е намерен поддържан редактор · записът е в покой",
"x.capture.saved": "Запазено локално · черновата е пазена в wayBetter for X", "x.capture.saved": "Запазено локално · черновата е пазена в wayBetter for X",
"x.capture.found": "Намерен е редактор · локалният запис започва, когато пишеш", "x.capture.found": "Намерен е редактор · локалният запис започва, когато пишеш",
"x.translate.bar": "Режим на превод",
"x.translate.hint": "Щракнете върху дума, за да я промените.",
"x.translate.edits": "{count, plural, one {# промяна} other {# промени}}",
"x.translate.exportPack": "Копирай файла с преводи",
"x.translate.copied": "Файлът с преводи е копиран",
"x.translate.exit": "Изход",
"x.translate.reload": "Презаредете, за да го видите",
"x.translate.key": "Ключ",
"x.translate.original": "Сега",
"x.translate.parameters": "Параметри",
"x.translate.plural": "множествено число",
"x.translate.save": "Запази",
"x.translate.cancel": "Отказ",
"x.translate.remove": "Премахни промяната",
"x.translate.notTranslatable": "Този низ още не може да се променя от пакет.",
"x.translate.choose": "Кой?",
"popover.conversation": "Този разговор", "popover.conversation": "Този разговор",
"popover.matches": "Съвпадения", "popover.matches": "Съвпадения",
"popover.recent": "Скорошни", "popover.recent": "Скорошни",

View file

@ -395,6 +395,22 @@
"x.capture.idle": "সমর্থিত কম্পোজার পাওয়া যায়নি · ধরা নিষ্ক্রিয়", "x.capture.idle": "সমর্থিত কম্পোজার পাওয়া যায়নি · ধরা নিষ্ক্রিয়",
"x.capture.saved": "স্থানীয়ভাবে সংরক্ষিত · খসড়া wayBetter for X-এ রাখা হয়েছে", "x.capture.saved": "স্থানীয়ভাবে সংরক্ষিত · খসড়া wayBetter for X-এ রাখা হয়েছে",
"x.capture.found": "কম্পোজার পাওয়া গেছে · লিখলে স্থানীয় সংরক্ষণ শুরু হবে", "x.capture.found": "কম্পোজার পাওয়া গেছে · লিখলে স্থানীয় সংরক্ষণ শুরু হবে",
"x.translate.bar": "অনুবাদ মোড",
"x.translate.hint": "পরিবর্তন করতে একটি শব্দে ক্লিক করুন।",
"x.translate.edits": "{count, plural, one {# পরিবর্তন} other {# পরিবর্তন}}",
"x.translate.exportPack": "প্যাক ফাইল কপি করুন",
"x.translate.copied": "প্যাক ফাইল কপি হয়েছে",
"x.translate.exit": "বেরিয়ে যান",
"x.translate.reload": "দেখতে রিলোড করুন",
"x.translate.key": "কী",
"x.translate.original": "এখন",
"x.translate.parameters": "প্যারামিটার",
"x.translate.plural": "বহুবচন",
"x.translate.save": "সংরক্ষণ",
"x.translate.cancel": "বাতিল",
"x.translate.remove": "পরিবর্তন সরান",
"x.translate.notTranslatable": "এই স্ট্রিং এখনও প্যাক দিয়ে পরিবর্তন করা যায় না।",
"x.translate.choose": "কোনটি?",
"popover.conversation": "এই কথোপকথন", "popover.conversation": "এই কথোপকথন",
"popover.matches": "মিল", "popover.matches": "মিল",
"popover.recent": "সাম্প্রতিক", "popover.recent": "সাম্প্রতিক",

View file

@ -395,6 +395,22 @@
"x.capture.idle": "No s’ha trobat cap editor compatible · captura inactiva", "x.capture.idle": "No s’ha trobat cap editor compatible · captura inactiva",
"x.capture.saved": "Desat en local · esborrany conservat a wayBetter for X", "x.capture.saved": "Desat en local · esborrany conservat a wayBetter for X",
"x.capture.found": "Editor trobat · el desat local comença quan escrius", "x.capture.found": "Editor trobat · el desat local comença quan escrius",
"x.translate.bar": "Mode de traducció",
"x.translate.hint": "Fes clic en una paraula per canviar-la.",
"x.translate.edits": "{count, plural, one {# edició} other {# edicions}}",
"x.translate.exportPack": "Copia el fitxer de paquet",
"x.translate.copied": "Fitxer de paquet copiat",
"x.translate.exit": "Surt",
"x.translate.reload": "Recarrega per veure-ho",
"x.translate.key": "Clau",
"x.translate.original": "Ara",
"x.translate.parameters": "Paràmetres",
"x.translate.plural": "plural",
"x.translate.save": "Desa",
"x.translate.cancel": "Cancel·la",
"x.translate.remove": "Elimina l'edició",
"x.translate.notTranslatable": "Aquest text encara no es pot canviar amb un paquet.",
"x.translate.choose": "Quin?",
"popover.conversation": "Aquesta conversa", "popover.conversation": "Aquesta conversa",
"popover.matches": "Coincidències", "popover.matches": "Coincidències",
"popover.recent": "Recents", "popover.recent": "Recents",

View file

@ -395,6 +395,22 @@
"x.capture.idle": "Nenalezeno žádné podporované pole pro psaní · zachycení nečinné", "x.capture.idle": "Nenalezeno žádné podporované pole pro psaní · zachycení nečinné",
"x.capture.saved": "Uloženo místně · koncept je ve wayBetter for X", "x.capture.saved": "Uloženo místně · koncept je ve wayBetter for X",
"x.capture.found": "Pole pro psaní nalezeno · místní ukládání začne při psaní", "x.capture.found": "Pole pro psaní nalezeno · místní ukládání začne při psaní",
"x.translate.bar": "Režim překladu",
"x.translate.hint": "Kliknutím na slovo ho změníte.",
"x.translate.edits": "{count, plural, one {# úprava} few {# úpravy} many {# úpravy} other {# úprav}}",
"x.translate.exportPack": "Kopírovat soubor balíčku",
"x.translate.copied": "Soubor balíčku zkopírován",
"x.translate.exit": "Opustit",
"x.translate.reload": "Načtěte znovu a uvidíte to",
"x.translate.key": "Klíč",
"x.translate.original": "Nyní",
"x.translate.parameters": "Parametry",
"x.translate.plural": "množné číslo",
"x.translate.save": "Uložit",
"x.translate.cancel": "Zrušit",
"x.translate.remove": "Odebrat úpravu",
"x.translate.notTranslatable": "Tento řetězec zatím nelze balíčkem změnit.",
"x.translate.choose": "Který?",
"popover.conversation": "Tato konverzace", "popover.conversation": "Tato konverzace",
"popover.matches": "Shody", "popover.matches": "Shody",
"popover.recent": "Nedávné", "popover.recent": "Nedávné",

View file

@ -395,6 +395,22 @@
"x.capture.idle": "Intet understøttet skrivefelt fundet · fangst i hvile", "x.capture.idle": "Intet understøttet skrivefelt fundet · fangst i hvile",
"x.capture.saved": "Gemt lokalt · kladden er bevaret i wayBetter for X", "x.capture.saved": "Gemt lokalt · kladden er bevaret i wayBetter for X",
"x.capture.found": "Skrivefelt fundet · lokal lagring starter, når du skriver", "x.capture.found": "Skrivefelt fundet · lokal lagring starter, når du skriver",
"x.translate.bar": "Oversættelsestilstand",
"x.translate.hint": "Klik på et ord for at ændre det.",
"x.translate.edits": "{count, plural, one {# ændring} other {# ændringer}}",
"x.translate.exportPack": "Kopiér pakkefil",
"x.translate.copied": "Pakkefil kopieret",
"x.translate.exit": "Forlad",
"x.translate.reload": "Genindlæs for at se det",
"x.translate.key": "Nøgle",
"x.translate.original": "Nu",
"x.translate.parameters": "Parametre",
"x.translate.plural": "flertal",
"x.translate.save": "Gem",
"x.translate.cancel": "Annuller",
"x.translate.remove": "Fjern ændring",
"x.translate.notTranslatable": "Denne streng kan endnu ikke ændres af en pakke.",
"x.translate.choose": "Hvilken?",
"popover.conversation": "Denne samtale", "popover.conversation": "Denne samtale",
"popover.matches": "Match", "popover.matches": "Match",
"popover.recent": "Seneste", "popover.recent": "Seneste",

View file

@ -395,6 +395,22 @@
"x.capture.idle": "Kein unterstütztes Eingabefeld gefunden · Erfassung im Leerlauf", "x.capture.idle": "Kein unterstütztes Eingabefeld gefunden · Erfassung im Leerlauf",
"x.capture.saved": "Lokal gespeichert · Entwurf in wayBetter for X behalten", "x.capture.saved": "Lokal gespeichert · Entwurf in wayBetter for X behalten",
"x.capture.found": "Eingabefeld gefunden · lokales Speichern startet, sobald du tippst", "x.capture.found": "Eingabefeld gefunden · lokales Speichern startet, sobald du tippst",
"x.translate.bar": "Übersetzungsmodus",
"x.translate.hint": "Klicke auf ein Wort, um es zu ändern.",
"x.translate.edits": "{count, plural, one {# Änderung} other {# Änderungen}}",
"x.translate.exportPack": "Paketdatei kopieren",
"x.translate.copied": "Paketdatei kopiert",
"x.translate.exit": "Beenden",
"x.translate.reload": "Neu laden, um es zu sehen",
"x.translate.key": "Schlüssel",
"x.translate.original": "Aktuell",
"x.translate.parameters": "Parameter",
"x.translate.plural": "Plural",
"x.translate.save": "Speichern",
"x.translate.cancel": "Abbrechen",
"x.translate.remove": "Änderung entfernen",
"x.translate.notTranslatable": "Dieser Text kann noch nicht per Paket geändert werden.",
"x.translate.choose": "Welcher?",
"popover.conversation": "Diese Unterhaltung", "popover.conversation": "Diese Unterhaltung",
"popover.matches": "Treffer", "popover.matches": "Treffer",
"popover.recent": "Zuletzt", "popover.recent": "Zuletzt",

View file

@ -395,6 +395,22 @@
"x.capture.idle": "Δεν βρέθηκε υποστηριζόμενο πλαίσιο σύνταξης · η καταγραφή είναι σε αδράνεια", "x.capture.idle": "Δεν βρέθηκε υποστηριζόμενο πλαίσιο σύνταξης · η καταγραφή είναι σε αδράνεια",
"x.capture.saved": "Αποθηκεύτηκε τοπικά · το πρόχειρο διατηρείται στο wayBetter for X", "x.capture.saved": "Αποθηκεύτηκε τοπικά · το πρόχειρο διατηρείται στο wayBetter for X",
"x.capture.found": "Βρέθηκε πλαίσιο σύνταξης · η τοπική αποθήκευση ξεκινά όταν πληκτρολογείτε", "x.capture.found": "Βρέθηκε πλαίσιο σύνταξης · η τοπική αποθήκευση ξεκινά όταν πληκτρολογείτε",
"x.translate.bar": "Λειτουργία μετάφρασης",
"x.translate.hint": "Κάντε κλικ σε μια λέξη για να την αλλάξετε.",
"x.translate.edits": "{count, plural, one {# επεξεργασία} other {# επεξεργασίες}}",
"x.translate.exportPack": "Αντιγραφή αρχείου πακέτου",
"x.translate.copied": "Το αρχείο πακέτου αντιγράφηκε",
"x.translate.exit": "Έξοδος",
"x.translate.reload": "Επαναφόρτωση για προβολή",
"x.translate.key": "Κλειδί",
"x.translate.original": "Τώρα",
"x.translate.parameters": "Παράμετροι",
"x.translate.plural": "πληθυντικός",
"x.translate.save": "Αποθήκευση",
"x.translate.cancel": "Ακύρωση",
"x.translate.remove": "Αφαίρεση επεξεργασίας",
"x.translate.notTranslatable": "Αυτό το κείμενο δεν μπορεί ακόμη να αλλάξει από πακέτο.",
"x.translate.choose": "Ποιο;",
"popover.conversation": "Αυτή η συζήτηση", "popover.conversation": "Αυτή η συζήτηση",
"popover.matches": "Αντιστοιχίες", "popover.matches": "Αντιστοιχίες",
"popover.recent": "Πρόσφατα", "popover.recent": "Πρόσφατα",

View file

@ -394,6 +394,22 @@
"x.capture.idle": "No supported composer found · capture idle", "x.capture.idle": "No supported composer found · capture idle",
"x.capture.saved": "Saved locally · draft kept in wayBetter for X", "x.capture.saved": "Saved locally · draft kept in wayBetter for X",
"x.capture.found": "Composer found · local save starts when you type", "x.capture.found": "Composer found · local save starts when you type",
"x.translate.bar": "Translate mode",
"x.translate.hint": "Click a word to change it.",
"x.translate.edits": "{count, plural, one {# edit} other {# edits}}",
"x.translate.exportPack": "Copy pack file",
"x.translate.copied": "Pack file copied",
"x.translate.exit": "Leave",
"x.translate.reload": "Reload to see it",
"x.translate.key": "Key",
"x.translate.original": "Now",
"x.translate.parameters": "Parameters",
"x.translate.plural": "plural",
"x.translate.save": "Save",
"x.translate.cancel": "Cancel",
"x.translate.remove": "Remove edit",
"x.translate.notTranslatable": "This string cannot be changed by a pack yet.",
"x.translate.choose": "Which one?",
"popover.conversation": "This conversation", "popover.conversation": "This conversation",
"popover.matches": "Matches", "popover.matches": "Matches",
"popover.recent": "Recent", "popover.recent": "Recent",

View file

@ -395,6 +395,22 @@
"x.capture.idle": "No se encontró ningún editor compatible · captura en reposo", "x.capture.idle": "No se encontró ningún editor compatible · captura en reposo",
"x.capture.saved": "Guardado en local · borrador conservado en wayBetter for X", "x.capture.saved": "Guardado en local · borrador conservado en wayBetter for X",
"x.capture.found": "Editor encontrado · el guardado local empieza cuando escribas", "x.capture.found": "Editor encontrado · el guardado local empieza cuando escribas",
"x.translate.bar": "Modo traducción",
"x.translate.hint": "Haz clic en una palabra para cambiarla.",
"x.translate.edits": "{count, plural, one {# edición} other {# ediciones}}",
"x.translate.exportPack": "Copiar archivo del paquete",
"x.translate.copied": "Archivo del paquete copiado",
"x.translate.exit": "Salir",
"x.translate.reload": "Recarga para verlo",
"x.translate.key": "Clave",
"x.translate.original": "Ahora",
"x.translate.parameters": "Parámetros",
"x.translate.plural": "plural",
"x.translate.save": "Guardar",
"x.translate.cancel": "Cancelar",
"x.translate.remove": "Quitar edición",
"x.translate.notTranslatable": "Un paquete todavía no puede cambiar este texto.",
"x.translate.choose": "¿Cuál?",
"popover.conversation": "Esta conversación", "popover.conversation": "Esta conversación",
"popover.matches": "Coincidencias", "popover.matches": "Coincidencias",
"popover.recent": "Recientes", "popover.recent": "Recientes",

View file

@ -395,6 +395,22 @@
"x.capture.idle": "Ez da onartzen den editorerik aurkitu · jasoketa geldirik", "x.capture.idle": "Ez da onartzen den editorerik aurkitu · jasoketa geldirik",
"x.capture.saved": "Lokalean gordeta · zirriborroa wayBetter for X-en mantentzen da", "x.capture.saved": "Lokalean gordeta · zirriborroa wayBetter for X-en mantentzen da",
"x.capture.found": "Editorea aurkitu da · gordetze lokala idazten hasten zarenean hasten da", "x.capture.found": "Editorea aurkitu da · gordetze lokala idazten hasten zarenean hasten da",
"x.translate.bar": "Itzulpen modua",
"x.translate.hint": "Egin klik hitz batean aldatzeko.",
"x.translate.edits": "{count, plural, one {# aldaketa} other {# aldaketa}}",
"x.translate.exportPack": "Kopiatu pakete-fitxategia",
"x.translate.copied": "Pakete-fitxategia kopiatu da",
"x.translate.exit": "Irten",
"x.translate.reload": "Birkargatu ikusteko",
"x.translate.key": "Gakoa",
"x.translate.original": "Orain",
"x.translate.parameters": "Parametroak",
"x.translate.plural": "plurala",
"x.translate.save": "Gorde",
"x.translate.cancel": "Utzi",
"x.translate.remove": "Kendu aldaketa",
"x.translate.notTranslatable": "Testu hau ezin da oraindik pakete batekin aldatu.",
"x.translate.choose": "Zein?",
"popover.conversation": "Elkarrizketa hau", "popover.conversation": "Elkarrizketa hau",
"popover.matches": "Bat-etortzeak", "popover.matches": "Bat-etortzeak",
"popover.recent": "Berriak", "popover.recent": "Berriak",

View file

@ -396,6 +396,22 @@
"x.capture.idle": "جعبه نگارش پشتیبانی‌شده‌ای پیدا نشد · ثبت بیکار است", "x.capture.idle": "جعبه نگارش پشتیبانی‌شده‌ای پیدا نشد · ثبت بیکار است",
"x.capture.saved": "محلی ذخیره شد · پیش‌نویس در wayBetter for X نگه داشته شد", "x.capture.saved": "محلی ذخیره شد · پیش‌نویس در wayBetter for X نگه داشته شد",
"x.capture.found": "جعبه نگارش پیدا شد · ذخیره محلی با تایپ شما شروع می‌شود", "x.capture.found": "جعبه نگارش پیدا شد · ذخیره محلی با تایپ شما شروع می‌شود",
"x.translate.bar": "حالت ترجمه",
"x.translate.hint": "برای تغییر، روی یک کلمه کلیک کنید.",
"x.translate.edits": "{count, plural, one {# ویرایش} other {# ویرایش}}",
"x.translate.exportPack": "کپی فایل بسته",
"x.translate.copied": "فایل بسته کپی شد",
"x.translate.exit": "خروج",
"x.translate.reload": "برای دیدن، بارگذاری مجدد کنید",
"x.translate.key": "کلید",
"x.translate.original": "اکنون",
"x.translate.parameters": "پارامترها",
"x.translate.plural": "جمع",
"x.translate.save": "ذخیره",
"x.translate.cancel": "لغو",
"x.translate.remove": "حذف ویرایش",
"x.translate.notTranslatable": "این متن هنوز با بسته قابل تغییر نیست.",
"x.translate.choose": "کدام؟",
"popover.conversation": "این گفتگو", "popover.conversation": "این گفتگو",
"popover.matches": "موارد مطابق", "popover.matches": "موارد مطابق",
"popover.recent": "اخیر", "popover.recent": "اخیر",

View file

@ -395,6 +395,22 @@
"x.capture.idle": "Tuettua kirjoituskenttää ei löytynyt · tallennus lepotilassa", "x.capture.idle": "Tuettua kirjoituskenttää ei löytynyt · tallennus lepotilassa",
"x.capture.saved": "Tallennettu paikallisesti · luonnos säilytetään wayBetter for X:ssä", "x.capture.saved": "Tallennettu paikallisesti · luonnos säilytetään wayBetter for X:ssä",
"x.capture.found": "Kirjoituskenttä löytyi · paikallinen tallennus alkaa, kun kirjoitat", "x.capture.found": "Kirjoituskenttä löytyi · paikallinen tallennus alkaa, kun kirjoitat",
"x.translate.bar": "Käännöstila",
"x.translate.hint": "Muuta sanaa napsauttamalla sitä.",
"x.translate.edits": "{count, plural, one {# muutos} other {# muutosta}}",
"x.translate.exportPack": "Kopioi pakettitiedosto",
"x.translate.copied": "Pakettitiedosto kopioitu",
"x.translate.exit": "Poistu",
"x.translate.reload": "Lataa uudelleen nähdäksesi",
"x.translate.key": "Avain",
"x.translate.original": "Nyt",
"x.translate.parameters": "Parametrit",
"x.translate.plural": "monikko",
"x.translate.save": "Tallenna",
"x.translate.cancel": "Peruuta",
"x.translate.remove": "Poista muutos",
"x.translate.notTranslatable": "Pakettia ei voi vielä käyttää tämän merkkijonon muuttamiseen.",
"x.translate.choose": "Mikä?",
"popover.conversation": "Tämä keskustelu", "popover.conversation": "Tämä keskustelu",
"popover.matches": "Osumat", "popover.matches": "Osumat",
"popover.recent": "Viimeisimmät", "popover.recent": "Viimeisimmät",

View file

@ -395,6 +395,22 @@
"x.capture.idle": "Walang nakitang suportadong composer · naka-idle ang pagkuha", "x.capture.idle": "Walang nakitang suportadong composer · naka-idle ang pagkuha",
"x.capture.saved": "Lokal na nai-save · itinatago ang draft sa wayBetter for X", "x.capture.saved": "Lokal na nai-save · itinatago ang draft sa wayBetter for X",
"x.capture.found": "May nakitang composer · magsisimula ang lokal na pag-save kapag nag-type ka", "x.capture.found": "May nakitang composer · magsisimula ang lokal na pag-save kapag nag-type ka",
"x.translate.bar": "Translate mode",
"x.translate.hint": "I-click ang isang salita para baguhin ito.",
"x.translate.edits": "{count, plural, one {# pag-edit} other {# pag-edit}}",
"x.translate.exportPack": "Kopyahin ang pack file",
"x.translate.copied": "Nakopya ang pack file",
"x.translate.exit": "Umalis",
"x.translate.reload": "I-reload para makita",
"x.translate.key": "Key",
"x.translate.original": "Ngayon",
"x.translate.parameters": "Mga parameter",
"x.translate.plural": "plural",
"x.translate.save": "I-save",
"x.translate.cancel": "Kanselahin",
"x.translate.remove": "Alisin ang pag-edit",
"x.translate.notTranslatable": "Hindi pa mababago ng pack ang string na ito.",
"x.translate.choose": "Alin?",
"popover.conversation": "Usapang ito", "popover.conversation": "Usapang ito",
"popover.matches": "Mga tugma", "popover.matches": "Mga tugma",
"popover.recent": "Kamakailan", "popover.recent": "Kamakailan",

View file

@ -395,6 +395,22 @@
"x.capture.idle": "Aucun champ de rédaction pris en charge trouvé · capture inactive", "x.capture.idle": "Aucun champ de rédaction pris en charge trouvé · capture inactive",
"x.capture.saved": "Enregistré localement · brouillon conservé dans wayBetter for X", "x.capture.saved": "Enregistré localement · brouillon conservé dans wayBetter for X",
"x.capture.found": "Champ de rédaction trouvé · l’enregistrement local démarre dès que vous écrivez", "x.capture.found": "Champ de rédaction trouvé · l’enregistrement local démarre dès que vous écrivez",
"x.translate.bar": "Mode traduction",
"x.translate.hint": "Cliquez sur un mot pour le modifier.",
"x.translate.edits": "{count, plural, one {# modification} other {# modifications}}",
"x.translate.exportPack": "Copier le fichier du pack",
"x.translate.copied": "Fichier du pack copié",
"x.translate.exit": "Quitter",
"x.translate.reload": "Rechargez pour le voir",
"x.translate.key": "Clé",
"x.translate.original": "Actuel",
"x.translate.parameters": "Paramètres",
"x.translate.plural": "pluriel",
"x.translate.save": "Enregistrer",
"x.translate.cancel": "Annuler",
"x.translate.remove": "Retirer la modification",
"x.translate.notTranslatable": "Ce texte ne peut pas encore être modifié par un pack.",
"x.translate.choose": "Lequel ?",
"popover.conversation": "Cette conversation", "popover.conversation": "Cette conversation",
"popover.matches": "Résultats", "popover.matches": "Résultats",
"popover.recent": "Récents", "popover.recent": "Récents",

View file

@ -395,6 +395,22 @@
"x.capture.idle": "Níor aimsíodh eagarthóir le tacaíocht · gabháil díomhaoin", "x.capture.idle": "Níor aimsíodh eagarthóir le tacaíocht · gabháil díomhaoin",
"x.capture.saved": "Sábháilte go háitiúil · dréacht coinnithe i wayBetter for X", "x.capture.saved": "Sábháilte go háitiúil · dréacht coinnithe i wayBetter for X",
"x.capture.found": "Aimsíodh eagarthóir · tosaíonn an sábháil áitiúil nuair a chlóscríobhann tú", "x.capture.found": "Aimsíodh eagarthóir · tosaíonn an sábháil áitiúil nuair a chlóscríobhann tú",
"x.translate.bar": "Mód aistriúcháin",
"x.translate.hint": "Cliceáil ar fhocal chun é a athrú.",
"x.translate.edits": "{count, plural, one {# athrú} two {# athrú} few {# athrú} many {# athrú} other {# athrú}}",
"x.translate.exportPack": "Cóipeáil comhad an phacáiste",
"x.translate.copied": "Cóipeáladh comhad an phacáiste",
"x.translate.exit": "Fág",
"x.translate.reload": "Athlódáil chun é a fheiceáil",
"x.translate.key": "Eochair",
"x.translate.original": "Anois",
"x.translate.parameters": "Paraiméadair",
"x.translate.plural": "iolra",
"x.translate.save": "Sábháil",
"x.translate.cancel": "Cealaigh",
"x.translate.remove": "Bain an t-athrú",
"x.translate.notTranslatable": "Ní féidir an teaghrán seo a athrú le pacáiste go fóill.",
"x.translate.choose": "Cé acu?",
"popover.conversation": "An comhrá seo", "popover.conversation": "An comhrá seo",
"popover.matches": "Meaitseálacha", "popover.matches": "Meaitseálacha",
"popover.recent": "Le déanaí", "popover.recent": "Le déanaí",

View file

@ -395,6 +395,22 @@
"x.capture.idle": "Non se atopou ningún editor compatible · captura en espera", "x.capture.idle": "Non se atopou ningún editor compatible · captura en espera",
"x.capture.saved": "Gardado en local · borrador conservado en wayBetter for X", "x.capture.saved": "Gardado en local · borrador conservado en wayBetter for X",
"x.capture.found": "Editor atopado · o gardado local comeza cando escribas", "x.capture.found": "Editor atopado · o gardado local comeza cando escribas",
"x.translate.bar": "Modo de tradución",
"x.translate.hint": "Fai clic nunha palabra para cambiala.",
"x.translate.edits": "{count, plural, one {# edición} other {# edicións}}",
"x.translate.exportPack": "Copiar o ficheiro do paquete",
"x.translate.copied": "Ficheiro do paquete copiado",
"x.translate.exit": "Saír",
"x.translate.reload": "Recarga para velo",
"x.translate.key": "Clave",
"x.translate.original": "Agora",
"x.translate.parameters": "Parámetros",
"x.translate.plural": "plural",
"x.translate.save": "Gardar",
"x.translate.cancel": "Cancelar",
"x.translate.remove": "Eliminar a edición",
"x.translate.notTranslatable": "Este texto aínda non se pode cambiar cun paquete.",
"x.translate.choose": "Cal?",
"popover.conversation": "Esta conversa", "popover.conversation": "Esta conversa",
"popover.matches": "Coincidencias", "popover.matches": "Coincidencias",
"popover.recent": "Recentes", "popover.recent": "Recentes",

View file

@ -395,6 +395,22 @@
"x.capture.idle": "કોઈ સમર્થિત કમ્પોઝર મળ્યું નથી · કૅપ્ચર નિષ્ક્રિય", "x.capture.idle": "કોઈ સમર્થિત કમ્પોઝર મળ્યું નથી · કૅપ્ચર નિષ્ક્રિય",
"x.capture.saved": "લોકલ રીતે સચવાયું · ડ્રાફ્ટ wayBetter for X માં રાખ્યો", "x.capture.saved": "લોકલ રીતે સચવાયું · ડ્રાફ્ટ wayBetter for X માં રાખ્યો",
"x.capture.found": "કમ્પોઝર મળ્યું · તમે લખો ત્યારે લોકલ સેવ શરૂ થાય છે", "x.capture.found": "કમ્પોઝર મળ્યું · તમે લખો ત્યારે લોકલ સેવ શરૂ થાય છે",
"x.translate.bar": "અનુવાદ મોડ",
"x.translate.hint": "બદલવા માટે શબ્દ પર ક્લિક કરો.",
"x.translate.edits": "{count, plural, one {# ફેરફાર} other {# ફેરફાર}}",
"x.translate.exportPack": "પૅક ફાઇલ કૉપિ કરો",
"x.translate.copied": "પૅક ફાઇલ કૉપિ થઈ",
"x.translate.exit": "બહાર નીકળો",
"x.translate.reload": "જોવા માટે રીલોડ કરો",
"x.translate.key": "કી",
"x.translate.original": "હમણાં",
"x.translate.parameters": "પેરામીટર",
"x.translate.plural": "બહુવચન",
"x.translate.save": "સાચવો",
"x.translate.cancel": "રદ કરો",
"x.translate.remove": "ફેરફાર દૂર કરો",
"x.translate.notTranslatable": "આ સ્ટ્રિંગ હજુ પૅક દ્વારા બદલી શકાતી નથી.",
"x.translate.choose": "કયું?",
"popover.conversation": "આ વાતચીત", "popover.conversation": "આ વાતચીત",
"popover.matches": "મેળ", "popover.matches": "મેળ",
"popover.recent": "તાજેતરના", "popover.recent": "તાજેતરના",

View file

@ -395,6 +395,22 @@
"x.capture.idle": "Ba a sami akwatin rubutu da ake tallafawa ba · kamawa yana hutawa", "x.capture.idle": "Ba a sami akwatin rubutu da ake tallafawa ba · kamawa yana hutawa",
"x.capture.saved": "An adana a gida · an riƙe daftari a wayBetter for X", "x.capture.saved": "An adana a gida · an riƙe daftari a wayBetter for X",
"x.capture.found": "An sami akwatin rubutu · adanawa a gida tana farawa idan ka rubuta", "x.capture.found": "An sami akwatin rubutu · adanawa a gida tana farawa idan ka rubuta",
"x.translate.bar": "Yanayin fassara",
"x.translate.hint": "Danna kalma don canza ta.",
"x.translate.edits": "{count, plural, one {gyara #} other {gyare-gyare #}}",
"x.translate.exportPack": "Kwafa fayil ɗin fakiti",
"x.translate.copied": "An kwafa fayil ɗin fakiti",
"x.translate.exit": "Fita",
"x.translate.reload": "Sake lodawa don gani",
"x.translate.key": "Maɓalli",
"x.translate.original": "Yanzu",
"x.translate.parameters": "Sigogi",
"x.translate.plural": "jam'i",
"x.translate.save": "Adana",
"x.translate.cancel": "Soke",
"x.translate.remove": "Cire gyara",
"x.translate.notTranslatable": "Fakiti ba zai iya canza wannan rubutu ba tukuna.",
"x.translate.choose": "Wanne?",
"popover.conversation": "Wannan tattaunawa", "popover.conversation": "Wannan tattaunawa",
"popover.matches": "Masu dacewa", "popover.matches": "Masu dacewa",
"popover.recent": "Na kwanan nan", "popover.recent": "Na kwanan nan",

View file

@ -396,6 +396,22 @@
"x.capture.idle": "לא נמצא כלי כתיבה נתמך · הלכידה במצב המתנה", "x.capture.idle": "לא נמצא כלי כתיבה נתמך · הלכידה במצב המתנה",
"x.capture.saved": "נשמר מקומית · הטיוטה נשמרה ב-wayBetter for X", "x.capture.saved": "נשמר מקומית · הטיוטה נשמרה ב-wayBetter for X",
"x.capture.found": "כלי כתיבה נמצא · השמירה המקומית מתחילה כשתקלידו", "x.capture.found": "כלי כתיבה נמצא · השמירה המקומית מתחילה כשתקלידו",
"x.translate.bar": "מצב תרגום",
"x.translate.hint": "לחצו על מילה כדי לשנות אותה.",
"x.translate.edits": "{count, plural, one {עריכה #} two {# עריכות} other {# עריכות}}",
"x.translate.exportPack": "העתקת קובץ החבילה",
"x.translate.copied": "קובץ החבילה הועתק",
"x.translate.exit": "יציאה",
"x.translate.reload": "רעננו כדי לראות",
"x.translate.key": "מפתח",
"x.translate.original": "עכשיו",
"x.translate.parameters": "פרמטרים",
"x.translate.plural": "רבים",
"x.translate.save": "שמירה",
"x.translate.cancel": "ביטול",
"x.translate.remove": "הסרת עריכה",
"x.translate.notTranslatable": "עדיין אי אפשר לשנות מחרוזת זו באמצעות חבילה.",
"x.translate.choose": "איזה?",
"popover.conversation": "השיחה הזו", "popover.conversation": "השיחה הזו",
"popover.matches": "התאמות", "popover.matches": "התאמות",
"popover.recent": "אחרונות", "popover.recent": "אחרונות",

View file

@ -395,6 +395,22 @@
"x.capture.idle": "कोई समर्थित कंपोज़र नहीं मिला · कैप्चर निष्क्रिय", "x.capture.idle": "कोई समर्थित कंपोज़र नहीं मिला · कैप्चर निष्क्रिय",
"x.capture.saved": "स्थानीय रूप से सेव हुआ · ड्राफ़्ट wayBetter for X में रखा है", "x.capture.saved": "स्थानीय रूप से सेव हुआ · ड्राफ़्ट wayBetter for X में रखा है",
"x.capture.found": "कंपोज़र मिल गया · लिखते ही स्थानीय सेव शुरू होगा", "x.capture.found": "कंपोज़र मिल गया · लिखते ही स्थानीय सेव शुरू होगा",
"x.translate.bar": "अनुवाद मोड",
"x.translate.hint": "बदलने के लिए किसी शब्द पर क्लिक करें।",
"x.translate.edits": "{count, plural, one {# संपादन} other {# संपादन}}",
"x.translate.exportPack": "पैक फ़ाइल कॉपी करें",
"x.translate.copied": "पैक फ़ाइल कॉपी हो गई",
"x.translate.exit": "बाहर निकलें",
"x.translate.reload": "देखने के लिए रीलोड करें",
"x.translate.key": "कुंजी",
"x.translate.original": "अभी",
"x.translate.parameters": "पैरामीटर",
"x.translate.plural": "बहुवचन",
"x.translate.save": "सहेजें",
"x.translate.cancel": "रद्द करें",
"x.translate.remove": "संपादन हटाएँ",
"x.translate.notTranslatable": "इस स्ट्रिंग को अभी कोई पैक नहीं बदल सकता।",
"x.translate.choose": "कौन सा?",
"popover.conversation": "यह बातचीत", "popover.conversation": "यह बातचीत",
"popover.matches": "मेल खाते", "popover.matches": "मेल खाते",
"popover.recent": "हाल के", "popover.recent": "हाल के",

View file

@ -395,6 +395,22 @@
"x.capture.idle": "Nije pronađen podržani okvir za pisanje · bilježenje miruje", "x.capture.idle": "Nije pronađen podržani okvir za pisanje · bilježenje miruje",
"x.capture.saved": "Lokalno spremljeno · skica čuvana u wayBetter for X", "x.capture.saved": "Lokalno spremljeno · skica čuvana u wayBetter for X",
"x.capture.found": "Okvir za pisanje pronađen · lokalno spremanje počinje kad tipkaš", "x.capture.found": "Okvir za pisanje pronađen · lokalno spremanje počinje kad tipkaš",
"x.translate.bar": "Način prevođenja",
"x.translate.hint": "Kliknite riječ da je promijenite.",
"x.translate.edits": "{count, plural, one {# izmjena} few {# izmjene} many {# izmjena} other {# izmjena}}",
"x.translate.exportPack": "Kopiraj datoteku paketa",
"x.translate.copied": "Datoteka paketa kopirana",
"x.translate.exit": "Izađi",
"x.translate.reload": "Ponovno učitajte da to vidite",
"x.translate.key": "Ključ",
"x.translate.original": "Sada",
"x.translate.parameters": "Parametri",
"x.translate.plural": "množina",
"x.translate.save": "Spremi",
"x.translate.cancel": "Odustani",
"x.translate.remove": "Ukloni izmjenu",
"x.translate.notTranslatable": "Ovaj niz još se ne može promijeniti paketom.",
"x.translate.choose": "Koji?",
"popover.conversation": "Ovaj razgovor", "popover.conversation": "Ovaj razgovor",
"popover.matches": "Podudaranja", "popover.matches": "Podudaranja",
"popover.recent": "Nedavno", "popover.recent": "Nedavno",

View file

@ -395,6 +395,22 @@
"x.capture.idle": "Nem található támogatott szerkesztő · a rögzítés tétlen", "x.capture.idle": "Nem található támogatott szerkesztő · a rögzítés tétlen",
"x.capture.saved": "Helyben mentve · a piszkozat megmaradt a wayBetter for X-ben", "x.capture.saved": "Helyben mentve · a piszkozat megmaradt a wayBetter for X-ben",
"x.capture.found": "Szerkesztő megtalálva · a helyi mentés gépeléskor indul", "x.capture.found": "Szerkesztő megtalálva · a helyi mentés gépeléskor indul",
"x.translate.bar": "Fordítási mód",
"x.translate.hint": "Kattints egy szóra a módosításhoz.",
"x.translate.edits": "{count, plural, one {# módosítás} other {# módosítás}}",
"x.translate.exportPack": "Csomagfájl másolása",
"x.translate.copied": "Csomagfájl átmásolva",
"x.translate.exit": "Kilépés",
"x.translate.reload": "Töltsd újra a megtekintéshez",
"x.translate.key": "Kulcs",
"x.translate.original": "Jelenleg",
"x.translate.parameters": "Paraméterek",
"x.translate.plural": "többes szám",
"x.translate.save": "Mentés",
"x.translate.cancel": "Mégse",
"x.translate.remove": "Módosítás törlése",
"x.translate.notTranslatable": "Ezt a szöveget egy csomag még nem tudja módosítani.",
"x.translate.choose": "Melyik?",
"popover.conversation": "Ez a beszélgetés", "popover.conversation": "Ez a beszélgetés",
"popover.matches": "Találatok", "popover.matches": "Találatok",
"popover.recent": "Legutóbbiak", "popover.recent": "Legutóbbiak",

View file

@ -395,6 +395,22 @@
"x.capture.idle": "Tidak ada kotak tulis yang didukung · penangkapan siaga", "x.capture.idle": "Tidak ada kotak tulis yang didukung · penangkapan siaga",
"x.capture.saved": "Tersimpan secara lokal · draf disimpan di wayBetter for X", "x.capture.saved": "Tersimpan secara lokal · draf disimpan di wayBetter for X",
"x.capture.found": "Kotak tulis ditemukan · penyimpanan lokal dimulai saat kamu mengetik", "x.capture.found": "Kotak tulis ditemukan · penyimpanan lokal dimulai saat kamu mengetik",
"x.translate.bar": "Mode terjemahan",
"x.translate.hint": "Klik kata untuk mengubahnya.",
"x.translate.edits": "{count, plural, other {# suntingan}}",
"x.translate.exportPack": "Salin berkas paket",
"x.translate.copied": "Berkas paket disalin",
"x.translate.exit": "Keluar",
"x.translate.reload": "Muat ulang untuk melihatnya",
"x.translate.key": "Kunci",
"x.translate.original": "Sekarang",
"x.translate.parameters": "Parameter",
"x.translate.plural": "jamak",
"x.translate.save": "Simpan",
"x.translate.cancel": "Batal",
"x.translate.remove": "Hapus suntingan",
"x.translate.notTranslatable": "String ini belum bisa diubah oleh paket.",
"x.translate.choose": "Yang mana?",
"popover.conversation": "Percakapan ini", "popover.conversation": "Percakapan ini",
"popover.matches": "Cocok", "popover.matches": "Cocok",
"popover.recent": "Terbaru", "popover.recent": "Terbaru",

View file

@ -395,6 +395,22 @@
"x.capture.idle": "Ahụghị ebe e dere a kwadoro · ijide anaghị arụ ọrụ", "x.capture.idle": "Ahụghị ebe e dere a kwadoro · ijide anaghị arụ ọrụ",
"x.capture.saved": "Echekwara n’ime · ederede ezughị ezu debere n’wayBetter for X", "x.capture.saved": "Echekwara n’ime · ederede ezughị ezu debere n’wayBetter for X",
"x.capture.found": "Achọtara ebe e dere · nchekwa n’ime na-amalite mgbe ị na-ede", "x.capture.found": "Achọtara ebe e dere · nchekwa n’ime na-amalite mgbe ị na-ede",
"x.translate.bar": "Ọnọdụ ntụgharị",
"x.translate.hint": "Pịa okwu iji gbanwee ya.",
"x.translate.edits": "{count, plural, other {mgbanwe #}}",
"x.translate.exportPack": "Detuo faịlụ ngwugwu",
"x.translate.copied": "Edetuola faịlụ ngwugwu",
"x.translate.exit": "Pụọ",
"x.translate.reload": "Megharịa ka ị hụ ya",
"x.translate.key": "Igodo",
"x.translate.original": "Ugbu a",
"x.translate.parameters": "Paramita",
"x.translate.plural": "ọtụtụ",
"x.translate.save": "Chekwaa",
"x.translate.cancel": "Kagbuo",
"x.translate.remove": "Wepụ mgbanwe",
"x.translate.notTranslatable": "Ngwugwu enweghị ike ịgbanwe eriri okwu a ugbu a.",
"x.translate.choose": "Kedu nke?",
"popover.conversation": "Mkparịta ụka a", "popover.conversation": "Mkparịta ụka a",
"popover.matches": "Ndị kwekọrọ", "popover.matches": "Ndị kwekọrọ",
"popover.recent": "N’oge na-adịbeghị anya", "popover.recent": "N’oge na-adịbeghị anya",

View file

@ -395,6 +395,22 @@
"x.capture.idle": "Nessun compositore supportato trovato · salvataggio inattivo", "x.capture.idle": "Nessun compositore supportato trovato · salvataggio inattivo",
"x.capture.saved": "Salvato in locale · bozza conservata in wayBetter for X", "x.capture.saved": "Salvato in locale · bozza conservata in wayBetter for X",
"x.capture.found": "Compositore trovato · il salvataggio locale parte quando scrivi", "x.capture.found": "Compositore trovato · il salvataggio locale parte quando scrivi",
"x.translate.bar": "Modalità traduzione",
"x.translate.hint": "Clicca su una parola per modificarla.",
"x.translate.edits": "{count, plural, one {# modifica} other {# modifiche}}",
"x.translate.exportPack": "Copia il file del pacchetto",
"x.translate.copied": "File del pacchetto copiato",
"x.translate.exit": "Esci",
"x.translate.reload": "Ricarica per vederlo",
"x.translate.key": "Chiave",
"x.translate.original": "Ora",
"x.translate.parameters": "Parametri",
"x.translate.plural": "plurale",
"x.translate.save": "Salva",
"x.translate.cancel": "Annulla",
"x.translate.remove": "Rimuovi modifica",
"x.translate.notTranslatable": "Questo testo non può ancora essere modificato da un pacchetto.",
"x.translate.choose": "Quale?",
"popover.conversation": "Questa conversazione", "popover.conversation": "Questa conversazione",
"popover.matches": "Corrispondenze", "popover.matches": "Corrispondenze",
"popover.recent": "Recenti", "popover.recent": "Recenti",

View file

@ -395,6 +395,22 @@
"x.capture.idle": "対応する投稿作成欄が見つかりません · キャプチャは待機中です", "x.capture.idle": "対応する投稿作成欄が見つかりません · キャプチャは待機中です",
"x.capture.saved": "ローカルに保存しました · 下書きはwayBetter for Xに保管されています", "x.capture.saved": "ローカルに保存しました · 下書きはwayBetter for Xに保管されています",
"x.capture.found": "投稿作成欄を検出しました · 入力するとローカル保存が始まります", "x.capture.found": "投稿作成欄を検出しました · 入力するとローカル保存が始まります",
"x.translate.bar": "翻訳モード",
"x.translate.hint": "単語をクリックして変更します。",
"x.translate.edits": "{count, plural, other {# 件の編集}}",
"x.translate.exportPack": "パックファイルをコピー",
"x.translate.copied": "パックファイルをコピーしました",
"x.translate.exit": "終了",
"x.translate.reload": "再読み込みして反映",
"x.translate.key": "キー",
"x.translate.original": "現在",
"x.translate.parameters": "パラメーター",
"x.translate.plural": "複数形",
"x.translate.save": "保存",
"x.translate.cancel": "キャンセル",
"x.translate.remove": "編集を削除",
"x.translate.notTranslatable": "この文字列はまだパックでは変更できません。",
"x.translate.choose": "どれですか?",
"popover.conversation": "この会話", "popover.conversation": "この会話",
"popover.matches": "一致", "popover.matches": "一致",
"popover.recent": "最近", "popover.recent": "最近",

View file

@ -395,6 +395,22 @@
"x.capture.idle": "ಬೆಂಬಲಿತ ಕಂಪೋಸರ್ ಸಿಗಲಿಲ್ಲ · ಸೆರೆಹಿಡಿಯುವಿಕೆ ನಿಷ್ಕ್ರಿಯ", "x.capture.idle": "ಬೆಂಬಲಿತ ಕಂಪೋಸರ್ ಸಿಗಲಿಲ್ಲ · ಸೆರೆಹಿಡಿಯುವಿಕೆ ನಿಷ್ಕ್ರಿಯ",
"x.capture.saved": "ಸ್ಥಳೀಯವಾಗಿ ಉಳಿಸಲಾಗಿದೆ · ಡ್ರಾಫ್ಟ್ wayBetter for X ನಲ್ಲಿ ಇದೆ", "x.capture.saved": "ಸ್ಥಳೀಯವಾಗಿ ಉಳಿಸಲಾಗಿದೆ · ಡ್ರಾಫ್ಟ್ wayBetter for X ನಲ್ಲಿ ಇದೆ",
"x.capture.found": "ಕಂಪೋಸರ್ ಸಿಕ್ಕಿತು · ನೀವು ಟೈಪ್ ಮಾಡಿದಾಗ ಸ್ಥಳೀಯ ಉಳಿಕೆ ಶುರುವಾಗುತ್ತದೆ", "x.capture.found": "ಕಂಪೋಸರ್ ಸಿಕ್ಕಿತು · ನೀವು ಟೈಪ್ ಮಾಡಿದಾಗ ಸ್ಥಳೀಯ ಉಳಿಕೆ ಶುರುವಾಗುತ್ತದೆ",
"x.translate.bar": "ಅನುವಾದ ಮೋಡ್",
"x.translate.hint": "ಬದಲಾಯಿಸಲು ಪದವನ್ನು ಕ್ಲಿಕ್ ಮಾಡಿ.",
"x.translate.edits": "{count, plural, one {# ಬದಲಾವಣೆ} other {# ಬದಲಾವಣೆಗಳು}}",
"x.translate.exportPack": "ಪ್ಯಾಕ್ ಫೈಲ್ ನಕಲಿಸಿ",
"x.translate.copied": "ಪ್ಯಾಕ್ ಫೈಲ್ ನಕಲಿಸಲಾಗಿದೆ",
"x.translate.exit": "ನಿರ್ಗಮಿಸಿ",
"x.translate.reload": "ನೋಡಲು ಮರುಲೋಡ್ ಮಾಡಿ",
"x.translate.key": "ಕೀ",
"x.translate.original": "ಈಗ",
"x.translate.parameters": "ಪ್ಯಾರಾಮೀಟರ್‌ಗಳು",
"x.translate.plural": "ಬಹುವಚನ",
"x.translate.save": "ಉಳಿಸಿ",
"x.translate.cancel": "ರದ್ದುಮಾಡಿ",
"x.translate.remove": "ಬದಲಾವಣೆ ತೆಗೆದುಹಾಕಿ",
"x.translate.notTranslatable": "ಈ ಪಠ್ಯವನ್ನು ಪ್ಯಾಕ್ ಮೂಲಕ ಇನ್ನೂ ಬದಲಾಯಿಸಲಾಗುವುದಿಲ್ಲ.",
"x.translate.choose": "ಯಾವುದು?",
"popover.conversation": "ಈ ಸಂಭಾಷಣೆ", "popover.conversation": "ಈ ಸಂಭಾಷಣೆ",
"popover.matches": "ಹೊಂದಾಣಿಕೆಗಳು", "popover.matches": "ಹೊಂದಾಣಿಕೆಗಳು",
"popover.recent": "ಇತ್ತೀಚಿನವು", "popover.recent": "ಇತ್ತೀಚಿನವು",

View file

@ -395,6 +395,22 @@
"x.capture.idle": "지원되는 작성 창을 찾을 수 없음 · 캡처 대기 중", "x.capture.idle": "지원되는 작성 창을 찾을 수 없음 · 캡처 대기 중",
"x.capture.saved": "로컬에 저장됨 · wayBetter for X에 임시 보관글이 보관됨", "x.capture.saved": "로컬에 저장됨 · wayBetter for X에 임시 보관글이 보관됨",
"x.capture.found": "작성 창을 찾음 · 입력하면 로컬 저장이 시작돼요", "x.capture.found": "작성 창을 찾음 · 입력하면 로컬 저장이 시작돼요",
"x.translate.bar": "번역 모드",
"x.translate.hint": "단어를 클릭해서 바꾸세요.",
"x.translate.edits": "{count, plural, other {#개 수정}}",
"x.translate.exportPack": "팩 파일 복사",
"x.translate.copied": "팩 파일을 복사했어요",
"x.translate.exit": "나가기",
"x.translate.reload": "다시 불러와서 확인",
"x.translate.key": "키",
"x.translate.original": "현재",
"x.translate.parameters": "매개변수",
"x.translate.plural": "복수형",
"x.translate.save": "저장",
"x.translate.cancel": "취소",
"x.translate.remove": "수정 삭제",
"x.translate.notTranslatable": "이 문자열은 아직 팩으로 변경할 수 없어요.",
"x.translate.choose": "어느 것인가요?",
"popover.conversation": "이 대화", "popover.conversation": "이 대화",
"popover.matches": "일치하는 항목", "popover.matches": "일치하는 항목",
"popover.recent": "최근", "popover.recent": "최근",

View file

@ -395,6 +395,22 @@
"x.capture.idle": "समर्थित कंपोझर सापडला नाही · कॅप्चर निष्क्रिय", "x.capture.idle": "समर्थित कंपोझर सापडला नाही · कॅप्चर निष्क्रिय",
"x.capture.saved": "स्थानिकरीत्या सेव्ह केले · ड्राफ्ट wayBetter for X मध्ये ठेवला", "x.capture.saved": "स्थानिकरीत्या सेव्ह केले · ड्राफ्ट wayBetter for X मध्ये ठेवला",
"x.capture.found": "कंपोझर सापडला · तुम्ही टाइप केल्यावर स्थानिक सेव्ह सुरू होते", "x.capture.found": "कंपोझर सापडला · तुम्ही टाइप केल्यावर स्थानिक सेव्ह सुरू होते",
"x.translate.bar": "भाषांतर मोड",
"x.translate.hint": "बदलण्यासाठी शब्दावर क्लिक करा.",
"x.translate.edits": "{count, plural, one {# बदल} other {# बदल}}",
"x.translate.exportPack": "पॅक फाइल कॉपी करा",
"x.translate.copied": "पॅक फाइल कॉपी केली",
"x.translate.exit": "बाहेर पडा",
"x.translate.reload": "पाहण्यासाठी रीलोड करा",
"x.translate.key": "की",
"x.translate.original": "सध्याचे",
"x.translate.parameters": "पॅरामीटर्स",
"x.translate.plural": "अनेकवचन",
"x.translate.save": "जतन करा",
"x.translate.cancel": "रद्द करा",
"x.translate.remove": "बदल काढून टाका",
"x.translate.notTranslatable": "हा मजकूर पॅकद्वारे अजून बदलता येत नाही.",
"x.translate.choose": "कोणता?",
"popover.conversation": "हे संभाषण", "popover.conversation": "हे संभाषण",
"popover.matches": "जुळणारे", "popover.matches": "जुळणारे",
"popover.recent": "अलीकडील", "popover.recent": "अलीकडील",

View file

@ -395,6 +395,22 @@
"x.capture.idle": "Tiada pengarang disokong ditemui · penangkapan melahu", "x.capture.idle": "Tiada pengarang disokong ditemui · penangkapan melahu",
"x.capture.saved": "Disimpan setempat · draf disimpan dalam wayBetter for X", "x.capture.saved": "Disimpan setempat · draf disimpan dalam wayBetter for X",
"x.capture.found": "Pengarang ditemui · simpanan setempat bermula apabila anda menaip", "x.capture.found": "Pengarang ditemui · simpanan setempat bermula apabila anda menaip",
"x.translate.bar": "Mod terjemahan",
"x.translate.hint": "Klik perkataan untuk mengubahnya.",
"x.translate.edits": "{count, plural, other {# suntingan}}",
"x.translate.exportPack": "Salin fail pek",
"x.translate.copied": "Fail pek disalin",
"x.translate.exit": "Keluar",
"x.translate.reload": "Muat semula untuk melihatnya",
"x.translate.key": "Kunci",
"x.translate.original": "Sekarang",
"x.translate.parameters": "Parameter",
"x.translate.plural": "jamak",
"x.translate.save": "Simpan",
"x.translate.cancel": "Batal",
"x.translate.remove": "Buang suntingan",
"x.translate.notTranslatable": "Rentetan ini belum boleh diubah oleh pek.",
"x.translate.choose": "Yang mana?",
"popover.conversation": "Perbualan ini", "popover.conversation": "Perbualan ini",
"popover.matches": "Padanan", "popover.matches": "Padanan",
"popover.recent": "Terkini", "popover.recent": "Terkini",

View file

@ -395,6 +395,22 @@
"x.capture.idle": "Fant ikke noe støttet skrivefelt · fangst i hvile", "x.capture.idle": "Fant ikke noe støttet skrivefelt · fangst i hvile",
"x.capture.saved": "Lagret lokalt · utkastet er beholdt i wayBetter for X", "x.capture.saved": "Lagret lokalt · utkastet er beholdt i wayBetter for X",
"x.capture.found": "Skrivefelt funnet · lokal lagring starter når du skriver", "x.capture.found": "Skrivefelt funnet · lokal lagring starter når du skriver",
"x.translate.bar": "Oversettelsesmodus",
"x.translate.hint": "Klikk på et ord for å endre det.",
"x.translate.edits": "{count, plural, one {# endring} other {# endringer}}",
"x.translate.exportPack": "Kopier pakkefil",
"x.translate.copied": "Pakkefil kopiert",
"x.translate.exit": "Avslutt",
"x.translate.reload": "Last inn på nytt for å se det",
"x.translate.key": "Nøkkel",
"x.translate.original": "Nå",
"x.translate.parameters": "Parametere",
"x.translate.plural": "flertall",
"x.translate.save": "Lagre",
"x.translate.cancel": "Avbryt",
"x.translate.remove": "Fjern endring",
"x.translate.notTranslatable": "Denne strengen kan ikke endres av en pakke ennå.",
"x.translate.choose": "Hvilken?",
"popover.conversation": "Denne samtalen", "popover.conversation": "Denne samtalen",
"popover.matches": "Treff", "popover.matches": "Treff",
"popover.recent": "Nylige", "popover.recent": "Nylige",

View file

@ -395,6 +395,22 @@
"x.capture.idle": "Geen ondersteunde editor gevonden · opslag inactief", "x.capture.idle": "Geen ondersteunde editor gevonden · opslag inactief",
"x.capture.saved": "Lokaal opgeslagen · concept bewaard in wayBetter for X", "x.capture.saved": "Lokaal opgeslagen · concept bewaard in wayBetter for X",
"x.capture.found": "Editor gevonden · lokaal opslaan begint zodra je typt", "x.capture.found": "Editor gevonden · lokaal opslaan begint zodra je typt",
"x.translate.bar": "Vertaalmodus",
"x.translate.hint": "Klik op een woord om het te wijzigen.",
"x.translate.edits": "{count, plural, one {# bewerking} other {# bewerkingen}}",
"x.translate.exportPack": "Pakketbestand kopiëren",
"x.translate.copied": "Pakketbestand gekopieerd",
"x.translate.exit": "Verlaten",
"x.translate.reload": "Herlaad om het te zien",
"x.translate.key": "Sleutel",
"x.translate.original": "Nu",
"x.translate.parameters": "Parameters",
"x.translate.plural": "meervoud",
"x.translate.save": "Opslaan",
"x.translate.cancel": "Annuleren",
"x.translate.remove": "Bewerking verwijderen",
"x.translate.notTranslatable": "Deze tekst kan nog niet door een pakket worden gewijzigd.",
"x.translate.choose": "Welke?",
"popover.conversation": "Dit gesprek", "popover.conversation": "Dit gesprek",
"popover.matches": "Overeenkomsten", "popover.matches": "Overeenkomsten",
"popover.recent": "Recent", "popover.recent": "Recent",

View file

@ -395,6 +395,22 @@
"x.capture.idle": "Nie znaleziono obsługiwanego edytora · przechwytywanie w bezczynności", "x.capture.idle": "Nie znaleziono obsługiwanego edytora · przechwytywanie w bezczynności",
"x.capture.saved": "Zapisano lokalnie · szkic zachowany w wayBetter for X", "x.capture.saved": "Zapisano lokalnie · szkic zachowany w wayBetter for X",
"x.capture.found": "Znaleziono edytor · zapis lokalny zacznie się podczas pisania", "x.capture.found": "Znaleziono edytor · zapis lokalny zacznie się podczas pisania",
"x.translate.bar": "Tryb tłumaczenia",
"x.translate.hint": "Kliknij słowo, aby je zmienić.",
"x.translate.edits": "{count, plural, one {# zmiana} few {# zmiany} many {# zmian} other {# zmiany}}",
"x.translate.exportPack": "Kopiuj plik pakietu",
"x.translate.copied": "Skopiowano plik pakietu",
"x.translate.exit": "Wyjdź",
"x.translate.reload": "Wczytaj ponownie, aby zobaczyć",
"x.translate.key": "Klucz",
"x.translate.original": "Teraz",
"x.translate.parameters": "Parametry",
"x.translate.plural": "liczba mnoga",
"x.translate.save": "Zapisz",
"x.translate.cancel": "Anuluj",
"x.translate.remove": "Usuń zmianę",
"x.translate.notTranslatable": "Ten tekst nie może jeszcze zostać zmieniony przez pakiet.",
"x.translate.choose": "Który?",
"popover.conversation": "Ta rozmowa", "popover.conversation": "Ta rozmowa",
"popover.matches": "Dopasowania", "popover.matches": "Dopasowania",
"popover.recent": "Ostatnie", "popover.recent": "Ostatnie",

View file

@ -395,6 +395,22 @@
"x.capture.idle": "Nenhum editor compatível encontrado · captura inativa", "x.capture.idle": "Nenhum editor compatível encontrado · captura inativa",
"x.capture.saved": "Salvo localmente · rascunho guardado no wayBetter for X", "x.capture.saved": "Salvo localmente · rascunho guardado no wayBetter for X",
"x.capture.found": "Editor encontrado · o salvamento local começa quando você digita", "x.capture.found": "Editor encontrado · o salvamento local começa quando você digita",
"x.translate.bar": "Modo de tradução",
"x.translate.hint": "Clique em uma palavra para alterá-la.",
"x.translate.edits": "{count, plural, one {# edição} other {# edições}}",
"x.translate.exportPack": "Copiar arquivo do pacote",
"x.translate.copied": "Arquivo do pacote copiado",
"x.translate.exit": "Sair",
"x.translate.reload": "Recarregue para ver",
"x.translate.key": "Chave",
"x.translate.original": "Agora",
"x.translate.parameters": "Parâmetros",
"x.translate.plural": "plural",
"x.translate.save": "Salvar",
"x.translate.cancel": "Cancelar",
"x.translate.remove": "Remover edição",
"x.translate.notTranslatable": "Este texto ainda não pode ser alterado por um pacote.",
"x.translate.choose": "Qual?",
"popover.conversation": "Esta conversa", "popover.conversation": "Esta conversa",
"popover.matches": "Resultados", "popover.matches": "Resultados",
"popover.recent": "Recentes", "popover.recent": "Recentes",

View file

@ -395,6 +395,22 @@
"x.capture.idle": "Niciun compozitor acceptat găsit · captare inactivă", "x.capture.idle": "Niciun compozitor acceptat găsit · captare inactivă",
"x.capture.saved": "Salvat local · ciorna este păstrată în wayBetter for X", "x.capture.saved": "Salvat local · ciorna este păstrată în wayBetter for X",
"x.capture.found": "Compozitor găsit · salvarea locală începe când tastezi", "x.capture.found": "Compozitor găsit · salvarea locală începe când tastezi",
"x.translate.bar": "Mod traducere",
"x.translate.hint": "Fă clic pe un cuvânt pentru a-l modifica.",
"x.translate.edits": "{count, plural, one {# modificare} few {# modificări} other {# de modificări}}",
"x.translate.exportPack": "Copiază fișierul pachet",
"x.translate.copied": "Fișier pachet copiat",
"x.translate.exit": "Ieși",
"x.translate.reload": "Reîncarcă pentru a vedea",
"x.translate.key": "Cheie",
"x.translate.original": "Acum",
"x.translate.parameters": "Parametri",
"x.translate.plural": "plural",
"x.translate.save": "Salvează",
"x.translate.cancel": "Anulează",
"x.translate.remove": "Elimină modificarea",
"x.translate.notTranslatable": "Acest text nu poate fi modificat încă de un pachet.",
"x.translate.choose": "Care?",
"popover.conversation": "Această conversație", "popover.conversation": "Această conversație",
"popover.matches": "Potriviri", "popover.matches": "Potriviri",
"popover.recent": "Recente", "popover.recent": "Recente",

View file

@ -395,6 +395,22 @@
"x.capture.idle": "Поддерживаемое окно поста не найдено · захват в ожидании", "x.capture.idle": "Поддерживаемое окно поста не найдено · захват в ожидании",
"x.capture.saved": "Сохранено на устройстве · черновик хранится в wayBetter for X", "x.capture.saved": "Сохранено на устройстве · черновик хранится в wayBetter for X",
"x.capture.found": "Окно поста найдено · сохранение начнётся, когда вы начнёте печатать", "x.capture.found": "Окно поста найдено · сохранение начнётся, когда вы начнёте печатать",
"x.translate.bar": "Режим перевода",
"x.translate.hint": "Щёлкните слово, чтобы изменить его.",
"x.translate.edits": "{count, plural, one {# правка} few {# правки} many {# правок} other {# правки}}",
"x.translate.exportPack": "Копировать файл пакета",
"x.translate.copied": "Файл пакета скопирован",
"x.translate.exit": "Выйти",
"x.translate.reload": "Перезагрузите, чтобы увидеть",
"x.translate.key": "Ключ",
"x.translate.original": "Сейчас",
"x.translate.parameters": "Параметры",
"x.translate.plural": "множественное число",
"x.translate.save": "Сохранить",
"x.translate.cancel": "Отмена",
"x.translate.remove": "Удалить правку",
"x.translate.notTranslatable": "Этот текст пока нельзя изменить пакетом.",
"x.translate.choose": "Какой?",
"popover.conversation": "Этот разговор", "popover.conversation": "Этот разговор",
"popover.matches": "Совпадения", "popover.matches": "Совпадения",
"popover.recent": "Недавние", "popover.recent": "Недавние",

View file

@ -395,6 +395,22 @@
"x.capture.idle": "Nenašiel sa podporovaný editor · zachytávanie nečinné", "x.capture.idle": "Nenašiel sa podporovaný editor · zachytávanie nečinné",
"x.capture.saved": "Uložené lokálne · koncept ponechaný vo wayBetter for X", "x.capture.saved": "Uložené lokálne · koncept ponechaný vo wayBetter for X",
"x.capture.found": "Editor nájdený · lokálne ukladanie sa spustí, keď začnete písať", "x.capture.found": "Editor nájdený · lokálne ukladanie sa spustí, keď začnete písať",
"x.translate.bar": "Režim prekladu",
"x.translate.hint": "Kliknutím na slovo ho zmeníte.",
"x.translate.edits": "{count, plural, one {# úprava} few {# úpravy} many {# úpravy} other {# úprav}}",
"x.translate.exportPack": "Kopírovať súbor balíka",
"x.translate.copied": "Súbor balíka skopírovaný",
"x.translate.exit": "Ukončiť",
"x.translate.reload": "Načítajte znova, aby ste to videli",
"x.translate.key": "Kľúč",
"x.translate.original": "Teraz",
"x.translate.parameters": "Parametre",
"x.translate.plural": "množné číslo",
"x.translate.save": "Uložiť",
"x.translate.cancel": "Zrušiť",
"x.translate.remove": "Odstrániť úpravu",
"x.translate.notTranslatable": "Tento reťazec zatiaľ nemožno zmeniť balíkom.",
"x.translate.choose": "Ktorý?",
"popover.conversation": "Táto konverzácia", "popover.conversation": "Táto konverzácia",
"popover.matches": "Zhody", "popover.matches": "Zhody",
"popover.recent": "Nedávne", "popover.recent": "Nedávne",

View file

@ -395,6 +395,22 @@
"x.capture.idle": "Нема подржаног уређивача · хватање мирује", "x.capture.idle": "Нема подржаног уређивача · хватање мирује",
"x.capture.saved": "Сачувано локално · нацрт је задржан у wayBetter for X", "x.capture.saved": "Сачувано локално · нацрт је задржан у wayBetter for X",
"x.capture.found": "Уређивач пронађен · локално чување почиње када куцате", "x.capture.found": "Уређивач пронађен · локално чување почиње када куцате",
"x.translate.bar": "Режим превођења",
"x.translate.hint": "Кликните на реч да је измените.",
"x.translate.edits": "{count, plural, one {# измена} few {# измене} many {# измена} other {# измена}}",
"x.translate.exportPack": "Копирај датотеку пакета",
"x.translate.copied": "Датотека пакета копирана",
"x.translate.exit": "Изађи",
"x.translate.reload": "Поново учитајте да бисте видели",
"x.translate.key": "Кључ",
"x.translate.original": "Тренутно",
"x.translate.parameters": "Параметри",
"x.translate.plural": "множина",
"x.translate.save": "Сачувај",
"x.translate.cancel": "Откажи",
"x.translate.remove": "Уклони измену",
"x.translate.notTranslatable": "Овај текст пакет још не може да измени.",
"x.translate.choose": "Који?",
"popover.conversation": "Ова конверзација", "popover.conversation": "Ова конверзација",
"popover.matches": "Подударања", "popover.matches": "Подударања",
"popover.recent": "Недавно", "popover.recent": "Недавно",

View file

@ -395,6 +395,22 @@
"x.capture.idle": "Ingen inläggsruta som stöds hittades · infångning är inaktiv", "x.capture.idle": "Ingen inläggsruta som stöds hittades · infångning är inaktiv",
"x.capture.saved": "Sparat lokalt · utkastet finns kvar i wayBetter for X", "x.capture.saved": "Sparat lokalt · utkastet finns kvar i wayBetter for X",
"x.capture.found": "Inläggsruta hittad · lokal sparning startar när du skriver", "x.capture.found": "Inläggsruta hittad · lokal sparning startar när du skriver",
"x.translate.bar": "Översättningsläge",
"x.translate.hint": "Klicka på ett ord för att ändra det.",
"x.translate.edits": "{count, plural, one {# ändring} other {# ändringar}}",
"x.translate.exportPack": "Kopiera paketfil",
"x.translate.copied": "Paketfil kopierad",
"x.translate.exit": "Avsluta",
"x.translate.reload": "Ladda om för att se det",
"x.translate.key": "Nyckel",
"x.translate.original": "Nu",
"x.translate.parameters": "Parametrar",
"x.translate.plural": "plural",
"x.translate.save": "Spara",
"x.translate.cancel": "Avbryt",
"x.translate.remove": "Ta bort ändring",
"x.translate.notTranslatable": "Den här strängen kan inte ändras av ett paket ännu.",
"x.translate.choose": "Vilken?",
"popover.conversation": "Den här konversationen", "popover.conversation": "Den här konversationen",
"popover.matches": "Träffar", "popover.matches": "Träffar",
"popover.recent": "Senaste", "popover.recent": "Senaste",

View file

@ -395,6 +395,22 @@
"x.capture.idle": "ஆதரிக்கப்படும் எழுதுபெட்டி காணப்படவில்லை · பதிவு செயலற்றது", "x.capture.idle": "ஆதரிக்கப்படும் எழுதுபெட்டி காணப்படவில்லை · பதிவு செயலற்றது",
"x.capture.saved": "உள்ளூரில் சேமிக்கப்பட்டது · வரைவு wayBetter for X இல் வைக்கப்பட்டுள்ளது", "x.capture.saved": "உள்ளூரில் சேமிக்கப்பட்டது · வரைவு wayBetter for X இல் வைக்கப்பட்டுள்ளது",
"x.capture.found": "எழுதுபெட்டி கண்டறியப்பட்டது · நீங்கள் தட்டச்சு செய்யும்போது உள்ளூர் சேமிப்பு தொடங்கும்", "x.capture.found": "எழுதுபெட்டி கண்டறியப்பட்டது · நீங்கள் தட்டச்சு செய்யும்போது உள்ளூர் சேமிப்பு தொடங்கும்",
"x.translate.bar": "மொழிபெயர்ப்பு முறை",
"x.translate.hint": "மாற்ற ஒரு சொல்லைக் கிளிக் செய்யவும்.",
"x.translate.edits": "{count, plural, one {# திருத்தம்} other {# திருத்தங்கள்}}",
"x.translate.exportPack": "தொகுப்பு கோப்பை நகலெடு",
"x.translate.copied": "தொகுப்பு கோப்பு நகலெடுக்கப்பட்டது",
"x.translate.exit": "வெளியேறு",
"x.translate.reload": "பார்க்க மீண்டும் ஏற்றவும்",
"x.translate.key": "விசை",
"x.translate.original": "தற்போது",
"x.translate.parameters": "அளவுருக்கள்",
"x.translate.plural": "பன்மை",
"x.translate.save": "சேமி",
"x.translate.cancel": "ரத்துசெய்",
"x.translate.remove": "திருத்தத்தை நீக்கு",
"x.translate.notTranslatable": "இந்த உரையை தொகுப்பால் இன்னும் மாற்ற முடியாது.",
"x.translate.choose": "எது?",
"popover.conversation": "இந்த உரையாடல்", "popover.conversation": "இந்த உரையாடல்",
"popover.matches": "பொருத்தங்கள்", "popover.matches": "பொருத்தங்கள்",
"popover.recent": "சமீபத்தியவை", "popover.recent": "சமீபத்தியவை",

View file

@ -395,6 +395,22 @@
"x.capture.idle": "ไม่พบช่องเขียนที่รองรับ · การเก็บว่างอยู่", "x.capture.idle": "ไม่พบช่องเขียนที่รองรับ · การเก็บว่างอยู่",
"x.capture.saved": "บันทึกในเครื่องแล้ว · เก็บแบบร่างไว้ใน wayBetter for X", "x.capture.saved": "บันทึกในเครื่องแล้ว · เก็บแบบร่างไว้ใน wayBetter for X",
"x.capture.found": "พบช่องเขียน · เริ่มบันทึกในเครื่องเมื่อคุณพิมพ์", "x.capture.found": "พบช่องเขียน · เริ่มบันทึกในเครื่องเมื่อคุณพิมพ์",
"x.translate.bar": "โหมดแปล",
"x.translate.hint": "คลิกคำเพื่อเปลี่ยน",
"x.translate.edits": "{count, plural, other {# การแก้ไข}}",
"x.translate.exportPack": "คัดลอกไฟล์แพ็ก",
"x.translate.copied": "คัดลอกไฟล์แพ็กแล้ว",
"x.translate.exit": "ออก",
"x.translate.reload": "โหลดใหม่เพื่อดู",
"x.translate.key": "คีย์",
"x.translate.original": "ตอนนี้",
"x.translate.parameters": "พารามิเตอร์",
"x.translate.plural": "พหูพจน์",
"x.translate.save": "บันทึก",
"x.translate.cancel": "ยกเลิก",
"x.translate.remove": "ลบการแก้ไข",
"x.translate.notTranslatable": "แพ็กยังเปลี่ยนข้อความนี้ไม่ได้",
"x.translate.choose": "อันไหน?",
"popover.conversation": "การสนทนานี้", "popover.conversation": "การสนทนานี้",
"popover.matches": "ที่ตรงกัน", "popover.matches": "ที่ตรงกัน",
"popover.recent": "ล่าสุด", "popover.recent": "ล่าสุด",

View file

@ -395,6 +395,22 @@
"x.capture.idle": "Desteklenen gönderi kutusu bulunamadı · kayıt beklemede", "x.capture.idle": "Desteklenen gönderi kutusu bulunamadı · kayıt beklemede",
"x.capture.saved": "Yerel olarak kaydedildi · taslak wayBetter for X’te saklanıyor", "x.capture.saved": "Yerel olarak kaydedildi · taslak wayBetter for X’te saklanıyor",
"x.capture.found": "Gönderi kutusu bulundu · yazmaya başlayınca yerel kayıt başlar", "x.capture.found": "Gönderi kutusu bulundu · yazmaya başlayınca yerel kayıt başlar",
"x.translate.bar": "Çeviri modu",
"x.translate.hint": "Değiştirmek için bir kelimeye tıkla.",
"x.translate.edits": "{count, plural, one {# düzenleme} other {# düzenleme}}",
"x.translate.exportPack": "Paket dosyasını kopyala",
"x.translate.copied": "Paket dosyası kopyalandı",
"x.translate.exit": "Çık",
"x.translate.reload": "Görmek için yeniden yükle",
"x.translate.key": "Anahtar",
"x.translate.original": "Şimdi",
"x.translate.parameters": "Parametreler",
"x.translate.plural": "çoğul",
"x.translate.save": "Kaydet",
"x.translate.cancel": "İptal",
"x.translate.remove": "Düzenlemeyi kaldır",
"x.translate.notTranslatable": "Bu metin henüz bir paketle değiştirilemiyor.",
"x.translate.choose": "Hangisi?",
"popover.conversation": "Bu konuşma", "popover.conversation": "Bu konuşma",
"popover.matches": "Eşleşenler", "popover.matches": "Eşleşenler",
"popover.recent": "Son", "popover.recent": "Son",

View file

@ -395,6 +395,22 @@
"x.capture.idle": "Підтримуваного редактора не знайдено · збереження неактивне", "x.capture.idle": "Підтримуваного редактора не знайдено · збереження неактивне",
"x.capture.saved": "Збережено локально · чернетку зберігає wayBetter for X", "x.capture.saved": "Збережено локально · чернетку зберігає wayBetter for X",
"x.capture.found": "Редактор знайдено · локальне збереження почнеться, коли ви почнете вводити текст", "x.capture.found": "Редактор знайдено · локальне збереження почнеться, коли ви почнете вводити текст",
"x.translate.bar": "Режим перекладу",
"x.translate.hint": "Натисніть слово, щоб змінити його.",
"x.translate.edits": "{count, plural, one {# зміна} few {# зміни} many {# змін} other {# зміни}}",
"x.translate.exportPack": "Копіювати файл пакета",
"x.translate.copied": "Файл пакета скопійовано",
"x.translate.exit": "Вийти",
"x.translate.reload": "Перезавантажте, щоб побачити",
"x.translate.key": "Ключ",
"x.translate.original": "Зараз",
"x.translate.parameters": "Параметри",
"x.translate.plural": "множина",
"x.translate.save": "Зберегти",
"x.translate.cancel": "Скасувати",
"x.translate.remove": "Видалити зміну",
"x.translate.notTranslatable": "Цей рядок поки що не можна змінити пакетом.",
"x.translate.choose": "Який?",
"popover.conversation": "Ця розмова", "popover.conversation": "Ця розмова",
"popover.matches": "Збіги", "popover.matches": "Збіги",
"popover.recent": "Нещодавні", "popover.recent": "Нещодавні",

View file

@ -396,6 +396,22 @@
"x.capture.idle": "کوئی تعاون یافتہ کمپوزر نہیں ملا · کیپچر غیر فعال", "x.capture.idle": "کوئی تعاون یافتہ کمپوزر نہیں ملا · کیپچر غیر فعال",
"x.capture.saved": "مقامی طور پر محفوظ · ڈرافٹ wayBetter for X میں رکھا گیا", "x.capture.saved": "مقامی طور پر محفوظ · ڈرافٹ wayBetter for X میں رکھا گیا",
"x.capture.found": "کمپوزر مل گیا · ٹائپ کرنے پر مقامی محفوظ کاری شروع ہوگی", "x.capture.found": "کمپوزر مل گیا · ٹائپ کرنے پر مقامی محفوظ کاری شروع ہوگی",
"x.translate.bar": "ترجمہ موڈ",
"x.translate.hint": "بدلنے کے لیے کسی لفظ پر کلک کریں۔",
"x.translate.edits": "{count, plural, one {# ترمیم} other {# ترامیم}}",
"x.translate.exportPack": "پیک فائل کاپی کریں",
"x.translate.copied": "پیک فائل کاپی ہو گئی",
"x.translate.exit": "باہر نکلیں",
"x.translate.reload": "دیکھنے کے لیے دوبارہ لوڈ کریں",
"x.translate.key": "کلید",
"x.translate.original": "اب",
"x.translate.parameters": "پیرامیٹرز",
"x.translate.plural": "جمع",
"x.translate.save": "محفوظ کریں",
"x.translate.cancel": "منسوخ کریں",
"x.translate.remove": "ترمیم ہٹائیں",
"x.translate.notTranslatable": "یہ متن ابھی کسی پیک کے ذریعے تبدیل نہیں کیا جا سکتا۔",
"x.translate.choose": "کون سا؟",
"popover.conversation": "یہ گفتگو", "popover.conversation": "یہ گفتگو",
"popover.matches": "مماثلتیں", "popover.matches": "مماثلتیں",
"popover.recent": "حالیہ", "popover.recent": "حالیہ",

View file

@ -395,6 +395,22 @@
"x.capture.idle": "Không tìm thấy khung soạn được hỗ trợ · ghi lại đang chờ", "x.capture.idle": "Không tìm thấy khung soạn được hỗ trợ · ghi lại đang chờ",
"x.capture.saved": "Đã lưu cục bộ · bản nháp được giữ trong wayBetter for X", "x.capture.saved": "Đã lưu cục bộ · bản nháp được giữ trong wayBetter for X",
"x.capture.found": "Đã tìm thấy khung soạn · lưu cục bộ bắt đầu khi bạn gõ", "x.capture.found": "Đã tìm thấy khung soạn · lưu cục bộ bắt đầu khi bạn gõ",
"x.translate.bar": "Chế độ dịch",
"x.translate.hint": "Nhấp vào một từ để thay đổi.",
"x.translate.edits": "{count, plural, other {# chỉnh sửa}}",
"x.translate.exportPack": "Sao chép tệp gói",
"x.translate.copied": "Đã sao chép tệp gói",
"x.translate.exit": "Thoát",
"x.translate.reload": "Tải lại để xem",
"x.translate.key": "Khóa",
"x.translate.original": "Hiện tại",
"x.translate.parameters": "Tham số",
"x.translate.plural": "số nhiều",
"x.translate.save": "Lưu",
"x.translate.cancel": "Hủy",
"x.translate.remove": "Xóa chỉnh sửa",
"x.translate.notTranslatable": "Gói chưa thể thay đổi chuỗi này.",
"x.translate.choose": "Cái nào?",
"popover.conversation": "Cuộc trò chuyện này", "popover.conversation": "Cuộc trò chuyện này",
"popover.matches": "Khớp", "popover.matches": "Khớp",
"popover.recent": "Gần đây", "popover.recent": "Gần đây",

View file

@ -395,6 +395,22 @@
"x.capture.idle": "A kò rí ibi ìkọ̀wé tí a ṣàtìlẹ́yìn · gbígba ń sinmi", "x.capture.idle": "A kò rí ibi ìkọ̀wé tí a ṣàtìlẹ́yìn · gbígba ń sinmi",
"x.capture.saved": "A ti fi pamọ́ sórí ẹ̀rọ · a pa àkọsílẹ̀ àkọ́kọ́ mọ́ nínú wayBetter for X", "x.capture.saved": "A ti fi pamọ́ sórí ẹ̀rọ · a pa àkọsílẹ̀ àkọ́kọ́ mọ́ nínú wayBetter for X",
"x.capture.found": "A rí ibi ìkọ̀wé · fífi pamọ́ sórí ẹ̀rọ bẹ̀rẹ̀ nígbà tí o bá tẹ̀wé", "x.capture.found": "A rí ibi ìkọ̀wé · fífi pamọ́ sórí ẹ̀rọ bẹ̀rẹ̀ nígbà tí o bá tẹ̀wé",
"x.translate.bar": "Ipo ìtumọ̀",
"x.translate.hint": "Tẹ ọ̀rọ̀ kan láti yí i padà.",
"x.translate.edits": "{count, plural, other {àtúnṣe #}}",
"x.translate.exportPack": "Àdàkọ fáìlì àpò",
"x.translate.copied": "A ti dà fáìlì àpò kọ",
"x.translate.exit": "Jáde",
"x.translate.reload": "Tún ṣe ìgbàsílẹ̀ láti rí i",
"x.translate.key": "Kọ́kọ́rọ́",
"x.translate.original": "Báyìí",
"x.translate.parameters": "Àwọn pàrámítà",
"x.translate.plural": "púpọ̀",
"x.translate.save": "Fipamọ́",
"x.translate.cancel": "Fagilé",
"x.translate.remove": "Yọ àtúnṣe kúrò",
"x.translate.notTranslatable": "Àpò kò tíì lè yí ọ̀rọ̀ yìí padà.",
"x.translate.choose": "Èwo?",
"popover.conversation": "Ìjíròrò yìí", "popover.conversation": "Ìjíròrò yìí",
"popover.matches": "Àwọn tó bá a mu", "popover.matches": "Àwọn tó bá a mu",
"popover.recent": "Láìpẹ́", "popover.recent": "Láìpẹ́",

View file

@ -395,6 +395,22 @@
"x.capture.idle": "未找到受支持的发帖框 · 捕获空闲", "x.capture.idle": "未找到受支持的发帖框 · 捕获空闲",
"x.capture.saved": "已本地保存 · 草稿保留在 wayBetter for X 中", "x.capture.saved": "已本地保存 · 草稿保留在 wayBetter for X 中",
"x.capture.found": "已找到发帖框 · 开始输入后将进行本地保存", "x.capture.found": "已找到发帖框 · 开始输入后将进行本地保存",
"x.translate.bar": "翻译模式",
"x.translate.hint": "点击单词即可修改。",
"x.translate.edits": "{count, plural, other {# 处修改}}",
"x.translate.exportPack": "复制包文件",
"x.translate.copied": "已复制包文件",
"x.translate.exit": "退出",
"x.translate.reload": "重新加载以查看",
"x.translate.key": "键",
"x.translate.original": "当前",
"x.translate.parameters": "参数",
"x.translate.plural": "复数",
"x.translate.save": "保存",
"x.translate.cancel": "取消",
"x.translate.remove": "移除修改",
"x.translate.notTranslatable": "此字符串暂时无法通过包修改。",
"x.translate.choose": "哪一个?",
"popover.conversation": "此对话", "popover.conversation": "此对话",
"popover.matches": "匹配项", "popover.matches": "匹配项",
"popover.recent": "最近", "popover.recent": "最近",

View file

@ -395,6 +395,22 @@
"x.capture.idle": "找不到支援的發文框 · 擷取閒置中", "x.capture.idle": "找不到支援的發文框 · 擷取閒置中",
"x.capture.saved": "已儲存到本機 · 草稿保存在 wayBetter for X", "x.capture.saved": "已儲存到本機 · 草稿保存在 wayBetter for X",
"x.capture.found": "已找到發文框 · 開始輸入時會開始本機儲存", "x.capture.found": "已找到發文框 · 開始輸入時會開始本機儲存",
"x.translate.bar": "翻譯模式",
"x.translate.hint": "點擊文字即可修改。",
"x.translate.edits": "{count, plural, other {# 項編輯}}",
"x.translate.exportPack": "複製套件檔案",
"x.translate.copied": "已複製套件檔案",
"x.translate.exit": "離開",
"x.translate.reload": "重新載入以查看",
"x.translate.key": "鍵",
"x.translate.original": "目前",
"x.translate.parameters": "參數",
"x.translate.plural": "複數",
"x.translate.save": "儲存",
"x.translate.cancel": "取消",
"x.translate.remove": "移除編輯",
"x.translate.notTranslatable": "此字串目前還無法由套件更改。",
"x.translate.choose": "是哪一個?",
"popover.conversation": "此對話", "popover.conversation": "此對話",
"popover.matches": "符合項目", "popover.matches": "符合項目",
"popover.recent": "最近", "popover.recent": "最近",

View file

@ -1,6 +1,6 @@
{ {
"name": "@better-twttr/desktop", "name": "@better-twttr/desktop",
"version": "1.0.1", "version": "1.0.2",
"private": true, "private": true,
"license": "GPL-3.0-or-later", "license": "GPL-3.0-or-later",
"type": "module", "type": "module",

View file

@ -9,10 +9,10 @@ const shell=targets.find(t=>t.type==='page'&&t.url.startsWith('http://tauri.loca
if(!x||!shell) throw new Error('isolated app is not ready'); if(!x||!shell) throw new Error('isolated app is not ready');
function session(t){const ws=new WebSocket(t.webSocketDebuggerUrl);let id=0;const p=new Map();ws.onmessage=e=>{const m=JSON.parse(e.data);p.get(m.id)?.(m);p.delete(m.id)};const ready=new Promise(r=>ws.onopen=r);const send=async(method,params={})=>{await ready;return new Promise((resolve,reject)=>{const n=++id;p.set(n,m=>m.error?reject(new Error(m.error.message)):resolve(m.result));ws.send(JSON.stringify({id:n,method,params}))})};const ev=async expression=>{const r=await send('Runtime.evaluate',{expression,awaitPromise:true,returnByValue:true});if(r.exceptionDetails)throw new Error(r.exceptionDetails.exception?.description??r.exceptionDetails.text);return r.result.value};return{send,ev,close:()=>ws.close()}} function session(t){const ws=new WebSocket(t.webSocketDebuggerUrl);let id=0;const p=new Map();ws.onmessage=e=>{const m=JSON.parse(e.data);p.get(m.id)?.(m);p.delete(m.id)};const ready=new Promise(r=>ws.onopen=r);const send=async(method,params={})=>{await ready;return new Promise((resolve,reject)=>{const n=++id;p.set(n,m=>m.error?reject(new Error(m.error.message)):resolve(m.result));ws.send(JSON.stringify({id:n,method,params}))})};const ev=async expression=>{const r=await send('Runtime.evaluate',{expression,awaitPromise:true,returnByValue:true});if(r.exceptionDetails)throw new Error(r.exceptionDetails.exception?.description??r.exceptionDetails.text);return r.result.value};return{send,ev,close:()=>ws.close()}}
const X=session(x),S=session(shell);const invoke=(c,a={})=>S.ev(`window.__TAURI_INTERNALS__.invoke(${JSON.stringify(c)},${JSON.stringify(a)})`); const X=session(x),S=session(shell);const invoke=(c,a={})=>S.ev(`window.__TAURI_INTERNALS__.invoke(${JSON.stringify(c)},${JSON.stringify(a)})`);
const original=await invoke('x_theme_get');const results=[];const wait=ms=>new Promise(r=>setTimeout(r,ms)); const original=await invoke('theme_get');const results=[];const wait=ms=>new Promise(r=>setTimeout(r,ms));
try{ try{
for(const preset of ['x','night-ink','classic']){ for(const preset of ['x','night-ink','classic']){
await invoke('x_set_theme',{theme:{...original,preset,accent:null}});await wait(1200); await invoke('theme_set',{theme:{...original,preset,accent:null}});await wait(1200);
const dom=await X.ev(`(() => { const dom=await X.ev(`(() => {
const path=e=>{const a=[];for(let n=e;n&&n!==document.body;n=n.parentElement){a.push(n.tagName.toLowerCase()+(n.className&&typeof n.className==='string'?'.'+n.className.trim().split(/\\s+/).slice(0,5).join('.'):'')+(n.id?'#'+n.id:''));if(n.matches('button,[role="button"]'))break}return a.join(' < ')}; const path=e=>{const a=[];for(let n=e;n&&n!==document.body;n=n.parentElement){a.push(n.tagName.toLowerCase()+(n.className&&typeof n.className==='string'?'.'+n.className.trim().split(/\\s+/).slice(0,5).join('.'):'')+(n.id?'#'+n.id:''));if(n.matches('button,[role="button"]'))break}return a.join(' < ')};
const paint=e=>{const s=getComputedStyle(e),r=e.getBoundingClientRect();return{tag:e.tagName,classes:typeof e.className==='string'?e.className.slice(0,160):'',path:path(e),rect:[r.x,r.y,r.width,r.height].map(x=>+x.toFixed(1)),color:s.color,bg:s.backgroundColor,fill:s.fill,stroke:s.stroke,textFill:s.webkitTextFillColor,opacity:s.opacity,filter:s.filter,mix:s.mixBlendMode,visibility:s.visibility,display:s.display,clip:s.clipPath,mask:s.maskImage}}; const paint=e=>{const s=getComputedStyle(e),r=e.getBoundingClientRect();return{tag:e.tagName,classes:typeof e.className==='string'?e.className.slice(0,160):'',path:path(e),rect:[r.x,r.y,r.width,r.height].map(x=>+x.toFixed(1)),color:s.color,bg:s.backgroundColor,fill:s.fill,stroke:s.stroke,textFill:s.webkitTextFillColor,opacity:s.opacity,filter:s.filter,mix:s.mixBlendMode,visibility:s.visibility,display:s.display,clip:s.clipPath,mask:s.maskImage}};
@ -24,6 +24,6 @@ try{
})()`); })()`);
const shot=await X.send('Page.captureScreenshot',{format:'png',captureBeyondViewport:false});await writeFile(join(out,`${preset}.png`),Buffer.from(shot.data,'base64'));results.push({preset,...dom}); const shot=await X.send('Page.captureScreenshot',{format:'png',captureBeyondViewport:false});await writeFile(join(out,`${preset}.png`),Buffer.from(shot.data,'base64'));results.push({preset,...dom});
} }
}finally{await invoke('x_set_theme',{theme:original}).catch(()=>{});X.close();S.close()} }finally{await invoke('theme_set',{theme:original}).catch(()=>{});X.close();S.close()}
await writeFile(join(out,'dom.json'),JSON.stringify({original,results},null,2)); await writeFile(join(out,'dom.json'),JSON.stringify({original,results},null,2));
console.log(JSON.stringify(results.map(r=>({preset:r.preset,nodes:r.nodes.map(n=>({text:n.text,paint:n.chain.slice(0,4).map(c=>({tag:c.tag,path:c.path.slice(0,85),color:c.color,bg:c.bg,textFill:c.textFill,rect:c.rect}))})),iframe:r.iframe.map(f=>({atText:f.atText?.path,chain:f.chain.slice(0,4).map(c=>({tag:c.tag,bg:c.bg,filter:c.filter,opacity:c.opacity,mix:c.mix}))}))})),null,2)); console.log(JSON.stringify(results.map(r=>({preset:r.preset,nodes:r.nodes.map(n=>({text:n.text,paint:n.chain.slice(0,4).map(c=>({tag:c.tag,path:c.path.slice(0,85),color:c.color,bg:c.bg,textFill:c.textFill,rect:c.rect}))})),iframe:r.iframe.map(f=>({atText:f.atText?.path,chain:f.chain.slice(0,4).map(c=>({tag:c.tag,bg:c.bg,filter:c.filter,opacity:c.opacity,mix:c.mix}))}))})),null,2));

View file

@ -41,12 +41,12 @@ function connect(target) {
const shell = connect(shellTarget), x = connect(xTarget), google = googleTarget ? connect(googleTarget) : null; const shell = connect(shellTarget), x = connect(xTarget), google = googleTarget ? connect(googleTarget) : null;
const wait = ms => new Promise(resolve => setTimeout(resolve, ms)); const wait = ms => new Promise(resolve => setTimeout(resolve, ms));
const invoke = (command, args = {}) => shell.evalJs(`window.__TAURI_INTERNALS__.invoke(${JSON.stringify(command)},${JSON.stringify(args)})`); const invoke = (command, args = {}) => shell.evalJs(`window.__TAURI_INTERNALS__.invoke(${JSON.stringify(command)},${JSON.stringify(args)})`);
const original = await invoke('x_theme_get'); const original = await invoke('theme_get');
const rows = []; const rows = [];
try { try {
for (const preset of ['original', 'x', 'classic', 'solarized-light', 'night-ink', 'terminal', 'paper', 'high-contrast']) { for (const preset of ['original', 'x', 'classic', 'solarized-light', 'night-ink', 'terminal', 'paper', 'high-contrast']) {
if (preset !== 'original') { if (preset !== 'original') {
await invoke('x_set_theme', { theme: { ...original, preset, accent: null } }); await invoke('theme_set', { theme: { ...original, preset, accent: null } });
await wait(1800); await wait(1800);
} }
const dom = await x.evalJs(`(() => { const dom = await x.evalJs(`(() => {
@ -72,7 +72,7 @@ try {
rows.push({ preset, ...dom, googleDom }); rows.push({ preset, ...dom, googleDom });
} }
} finally { } finally {
await invoke('x_set_theme', { theme: original }).catch(() => {}); await invoke('theme_set', { theme: original }).catch(() => {});
x.close(); shell.close(); google?.close(); x.close(); shell.close(); google?.close();
} }
await writeFile(join(out, 'results.json'), JSON.stringify({ original, rows }, null, 2)); await writeFile(join(out, 'results.json'), JSON.stringify({ original, rows }, null, 2));

View file

@ -22,11 +22,11 @@ function session(t) {
} }
const X = session(page), S = session(shell); const X = session(page), S = session(shell);
const invoke = (name, args = {}) => S.evalJs(`window.__TAURI_INTERNALS__.invoke(${JSON.stringify(name)},${JSON.stringify(args)})`); const invoke = (name, args = {}) => S.evalJs(`window.__TAURI_INTERNALS__.invoke(${JSON.stringify(name)},${JSON.stringify(args)})`);
const original = await invoke('x_theme_get'); const original = await invoke('theme_get');
const results = []; const results = [];
try { try {
for (const preset of ['x', 'night-ink', 'classic', 'paper', 'terminal', 'high-contrast', 'solarized-light']) { for (const preset of ['x', 'night-ink', 'classic', 'paper', 'terminal', 'high-contrast', 'solarized-light']) {
await invoke('x_set_theme', { theme: { ...original, preset, accent: null } }); await invoke('theme_set', { theme: { ...original, preset, accent: null } });
await new Promise(resolve => setTimeout(resolve, 1700)); await new Promise(resolve => setTimeout(resolve, 1700));
const state = await X.evalJs(`(() => { const state = await X.evalJs(`(() => {
const rgb = s => (s.match(/[\\d.]+/g) || []).slice(0,3).map(Number); const rgb = s => (s.match(/[\\d.]+/g) || []).slice(0,3).map(Number);
@ -40,6 +40,6 @@ try {
await writeFile(join(out, `${preset}.png`), Buffer.from(shot.data, 'base64')); await writeFile(join(out, `${preset}.png`), Buffer.from(shot.data, 'base64'));
results.push({ preset, ...state }); results.push({ preset, ...state });
} }
} finally { await invoke('x_set_theme', { theme: original }).catch(() => {}); X.close(); S.close(); } } finally { await invoke('theme_set', { theme: original }).catch(() => {}); X.close(); S.close(); }
await writeFile(join(out, 'results.json'), JSON.stringify(results, null, 2)); await writeFile(join(out, 'results.json'), JSON.stringify(results, null, 2));
console.log(JSON.stringify(results.map(({preset,controls,back}) => ({preset,controls,back:back&&{bg:back.bg,color:back.color}})))); console.log(JSON.stringify(results.map(({preset,controls,back}) => ({preset,controls,back:back&&{bg:back.bg,color:back.color}}))));

View file

@ -10,15 +10,15 @@ const shell=targets.find(t=>t.type==='page'&&t.url.startsWith('http://tauri.loca
if(!x||!shell) throw new Error('isolated app is not ready'); if(!x||!shell) throw new Error('isolated app is not ready');
function session(t){const ws=new WebSocket(t.webSocketDebuggerUrl);let id=0;const p=new Map();ws.onmessage=e=>{const m=JSON.parse(e.data);p.get(m.id)?.(m);p.delete(m.id)};const ready=new Promise(r=>ws.onopen=r);const send=async(method,params={})=>{await ready;return new Promise((resolve,reject)=>{const n=++id;p.set(n,m=>m.error?reject(new Error(m.error.message)):resolve(m.result));ws.send(JSON.stringify({id:n,method,params}))})};const ev=async expression=>{const r=await send('Runtime.evaluate',{expression,awaitPromise:true,returnByValue:true});if(r.exceptionDetails)throw new Error(r.exceptionDetails.exception?.description??r.exceptionDetails.text);return r.result.value};return{send,ev,close:()=>ws.close()}} function session(t){const ws=new WebSocket(t.webSocketDebuggerUrl);let id=0;const p=new Map();ws.onmessage=e=>{const m=JSON.parse(e.data);p.get(m.id)?.(m);p.delete(m.id)};const ready=new Promise(r=>ws.onopen=r);const send=async(method,params={})=>{await ready;return new Promise((resolve,reject)=>{const n=++id;p.set(n,m=>m.error?reject(new Error(m.error.message)):resolve(m.result));ws.send(JSON.stringify({id:n,method,params}))})};const ev=async expression=>{const r=await send('Runtime.evaluate',{expression,awaitPromise:true,returnByValue:true});if(r.exceptionDetails)throw new Error(r.exceptionDetails.exception?.description??r.exceptionDetails.text);return r.result.value};return{send,ev,close:()=>ws.close()}}
const X=session(x),S=session(shell);const invoke=(c,a={})=>S.ev(`window.__TAURI_INTERNALS__.invoke(${JSON.stringify(c)},${JSON.stringify(a)})`); const X=session(x),S=session(shell);const invoke=(c,a={})=>S.ev(`window.__TAURI_INTERNALS__.invoke(${JSON.stringify(c)},${JSON.stringify(a)})`);
const original=await invoke('x_theme_get'); const original=await invoke('theme_get');
const results=[];const wait=ms=>new Promise(r=>setTimeout(r,ms)); const results=[];const wait=ms=>new Promise(r=>setTimeout(r,ms));
try{ try{
for(const preset of ['night-ink','classic','paper','terminal','high-contrast']){ for(const preset of ['night-ink','classic','paper','terminal','high-contrast']){
await invoke('x_set_theme',{theme:{...original,preset,accent:null}});await wait(2200); await invoke('theme_set',{theme:{...original,preset,accent:null}});await wait(2200);
const state=await X.ev(`(() => {let st=document.getElementById('qa-signedout-probe');if(!st){st=document.createElement('style');st.id='qa-signedout-probe';document.head.append(st)}const root='body:not(:has(main[role="main"])):not(#bt-unused-id):not(#bt-unused-id2):not(#bt-unused-id3):not(#bt-unused-id4):not(#bt-unused-id5)';st.textContent=root+' button:has(.text-text > p.jf-element) > .jf-element.flex, '+root+' .jf-gsi-face {background-color:#f8fafc !important} '+root+' button > .jf-element.flex .text-text > p.jf-element, '+root+' .jf-gsi-face > span.jf-element {color:#0f1419 !important;-webkit-text-fill-color:#0f1419 !important}';const names=['phone','Apple','Google'];return {theme:window.wayBetter.api.theme.current().id,controls:names.map(n=>{const e=n==='Google'?document.querySelector('.jf-gsi-face'):([...document.querySelectorAll('button')].find(b=>b.textContent?.includes('Continue with '+n))) ;const wrap=n==='Google'?e:e?.querySelector(':scope > div.jf-element.flex');const label=n==='Google'?e?.querySelector(':scope > span.jf-element'):e?.querySelector('.text-text > p.jf-element');return {name:n,bg:wrap&&getComputedStyle(wrap).backgroundColor,style:wrap?.getAttribute("style"),match:wrap?.matches(st.sheet.cssRules[0].selectorText.split(",")[0]),color:label&&getComputedStyle(label).color,fill:label&&getComputedStyle(label).webkitTextFillColor,text:label?.textContent}}),styleRules:st.sheet?.cssRules.length??-1}})()`); const state=await X.ev(`(() => {let st=document.getElementById('qa-signedout-probe');if(!st){st=document.createElement('style');st.id='qa-signedout-probe';document.head.append(st)}const root='body:not(:has(main[role="main"])):not(#bt-unused-id):not(#bt-unused-id2):not(#bt-unused-id3):not(#bt-unused-id4):not(#bt-unused-id5)';st.textContent=root+' button:has(.text-text > p.jf-element) > .jf-element.flex, '+root+' .jf-gsi-face {background-color:#f8fafc !important} '+root+' button > .jf-element.flex .text-text > p.jf-element, '+root+' .jf-gsi-face > span.jf-element {color:#0f1419 !important;-webkit-text-fill-color:#0f1419 !important}';const names=['phone','Apple','Google'];return {theme:window.wayBetter.api.theme.current().id,controls:names.map(n=>{const e=n==='Google'?document.querySelector('.jf-gsi-face'):([...document.querySelectorAll('button')].find(b=>b.textContent?.includes('Continue with '+n))) ;const wrap=n==='Google'?e:e?.querySelector(':scope > div.jf-element.flex');const label=n==='Google'?e?.querySelector(':scope > span.jf-element'):e?.querySelector('.text-text > p.jf-element');return {name:n,bg:wrap&&getComputedStyle(wrap).backgroundColor,style:wrap?.getAttribute("style"),match:wrap?.matches(st.sheet.cssRules[0].selectorText.split(",")[0]),color:label&&getComputedStyle(label).color,fill:label&&getComputedStyle(label).webkitTextFillColor,text:label?.textContent}}),styleRules:st.sheet?.cssRules.length??-1}})()`);
const shot=await X.send('Page.captureScreenshot',{format:'png',captureBeyondViewport:false}); const shot=await X.send('Page.captureScreenshot',{format:'png',captureBeyondViewport:false});
await writeFile(join(out,`${preset}.png`),Buffer.from(shot.data,'base64')); await writeFile(join(out,`${preset}.png`),Buffer.from(shot.data,'base64'));
results.push({preset,...state}); results.push({preset,...state});
} }
}finally{await invoke('x_set_theme',{theme:original}).catch(()=>{});await X.ev(`document.getElementById('qa-signedout-probe')?.remove()`).catch(()=>{});X.close();S.close()} }finally{await invoke('theme_set',{theme:original}).catch(()=>{});await X.ev(`document.getElementById('qa-signedout-probe')?.remove()`).catch(()=>{});X.close();S.close()}
console.log(JSON.stringify(results)); console.log(JSON.stringify(results));

View file

@ -6,7 +6,7 @@
// node scripts/resize-perf.mjs <port> <case...> cases: theme, drag, switch, window // node scripts/resize-perf.mjs <port> <case...> cases: theme, drag, switch, window
// THEME_PRESET=nord node scripts/resize-perf.mjs 9333 theme // THEME_PRESET=nord node scripts/resize-perf.mjs 9333 theme
process.env.SITE_ORIGIN ??= 'https://x.com'; process.env.SITE_ORIGIN ??= 'https://x.com';
process.env.THEME_GET ??= 'x_theme_get'; process.env.THEME_GET ??= 'theme_get';
process.env.THEME_SET ??= 'x_set_theme'; process.env.THEME_SET ??= 'theme_set';
process.env.SKIP_PATH ??= '/compose'; process.env.SKIP_PATH ??= '/compose';
await import('../../../waybetter/dev-tools/resize-perf.mjs'); await import('../../../waybetter/dev-tools/resize-perf.mjs');

View file

@ -154,7 +154,10 @@ export function extractCatalog(source, { group = 'main' } = {}) {
const pieces = returned?.type === 'ArrayExpression' const pieces = returned?.type === 'ArrayExpression'
? returned.elements.map((element, index) => (element?.type === 'Literal' ? String(element.value) : `{${index}}`)).join('') ? returned.elements.map((element, index) => (element?.type === 'Literal' ? String(element.value) : `{${index}}`)).join('')
: `rich:${member.end - member.start}`; : `rich:${member.end - member.start}`;
add(member.key.name, { kind: 'rich', hash: hashText(pieces), group: 'rich' }); // Piece n is followed by the caller's element n: one element position per piece (the one after the
// last piece is not always used, so a pack may leave the last slot out).
const slots = returned?.type === 'ArrayExpression' ? { slots: returned.elements.length } : {};
add(member.key.name, { kind: 'rich', ...slots, hash: hashText(pieces), group: 'rich' });
} }
} }
} }

View file

@ -55,7 +55,7 @@ const xState = x => x.evaluate(`(() => ({
nameFont: getComputedStyle(document.querySelector('[data-testid="User-Name"] > div:first-child span') ?? document.body).fontFamily.slice(0, 36), nameFont: getComputedStyle(document.querySelector('[data-testid="User-Name"] > div:first-child span') ?? document.body).fontFamily.slice(0, 36),
}))()`); }))()`);
const original = { theme: await invoke('x_theme_get'), scopes: await invoke('theme_scopes_get'), fonts: await invoke('gfonts_installed') }; const original = { theme: await invoke('theme_get'), scopes: await invoke('theme_scopes_get'), fonts: await invoke('gfonts_installed') };
log.push(`original: preset ${original.theme.preset}, scopes ${JSON.stringify(original.scopes)}, fonts ${original.fonts.map(f => f.family).join(',') || 'none'}`); log.push(`original: preset ${original.theme.preset}, scopes ${JSON.stringify(original.scopes)}, fonts ${original.fonts.map(f => f.family).join(',') || 'none'}`);
try { try {
// 1. A real native Google Fonts download into app data. // 1. A real native Google Fonts download into app data.
@ -100,9 +100,9 @@ try {
for (const x of xs) log.push(`pane ${tabId}=paper ${JSON.stringify(await xState(x))}`); for (const x of xs) log.push(`pane ${tabId}=paper ${JSON.stringify(await xState(x))}`);
snap('app-03-pane-theme'); snap('app-03-pane-theme');
} finally { } finally {
await invoke('x_preview_theme', { theme: null }).catch(() => {}); await invoke('theme_preview', { theme: null }).catch(() => {});
await invoke('theme_scopes_set', { scopes: original.scopes }).catch(error => log.push(`restore scopes failed ${error}`)); await invoke('theme_scopes_set', { scopes: original.scopes }).catch(error => log.push(`restore scopes failed ${error}`));
await invoke('x_set_theme', { theme: original.theme }).catch(error => log.push(`restore theme failed ${error}`)); await invoke('theme_set', { theme: original.theme }).catch(error => log.push(`restore theme failed ${error}`));
if (!original.fonts.some(font => font.family === 'Space Grotesk')) await invoke('gfonts_remove', { family: 'Space Grotesk' }).catch(() => {}); if (!original.fonts.some(font => font.family === 'Space Grotesk')) await invoke('gfonts_remove', { family: 'Space Grotesk' }).catch(() => {});
await wait(2000); await wait(2000);
for (const x of xs) log.push(`restored ${JSON.stringify(await xState(x))}`); for (const x of xs) log.push(`restored ${JSON.stringify(await xState(x))}`);

View file

@ -175,8 +175,14 @@ function inspect() {
if (hit?.closest('#layers')) continue; if (hit?.closest('#layers')) continue;
if (!hit || !item.contains(hit)) navMiss.push({ name: item.getAttribute('data-testid') || item.getAttribute('aria-label') || item.tagName, over: hit ? (hit.getAttribute('data-testid') || hit.tagName + (hit.id ? '#' + hit.id : '') + '.' + String(hit.className).slice(0, 40)) : 'outside the window' }); if (!hit || !item.contains(hit)) navMiss.push({ name: item.getAttribute('data-testid') || item.getAttribute('aria-label') || item.tagName, over: hit ? (hit.getAttribute('data-testid') || hit.tagName + (hit.id ? '#' + hit.id : '') + '.' + String(hit.className).slice(0, 40)) : 'outside the window' });
} }
// Every rail item keeps a visible icon (a bar's icons-only rule once hid X's icon-only items whole).
const navNoIcon = [...document.querySelectorAll('header[role="banner"] nav[role="navigation"] > :is(a,button)')].filter(item => {
const r = item.getBoundingClientRect(); if (r.width < 2 || dimmed(item)) return false;
const icon = item.querySelector('svg'); const b = icon?.getBoundingClientRect();
return !b || b.width < 8 || b.height < 8 || getComputedStyle(icon).visibility === 'hidden';
}).map(item => item.getAttribute('data-testid') || item.getAttribute('aria-label'));
return { return {
navMiss, chat, short: texts.filter(t => t.need && t.ratio < t.need).slice(0, 4), navMiss, navNoIcon, chat, short: texts.filter(t => t.need && t.ratio < t.need).slice(0, 4),
iconCount: icons.length, faintIcons: icons.filter(i => i.ratio < 3).length, worstIcon: icons[0] ?? null, iconCount: icons.length, faintIcons: icons.filter(i => i.ratio < 3).length, worstIcon: icons[0] ?? null,
layers, layers,
texts: texts.slice(0, 6), low: texts.filter(t => t.ratio < 4.5).length, lowLinks: texts.filter(t => t.tag === 'A' && t.ratio < 4.5).length, fail: texts.filter(t => t.ratio < 3).length, textCount: texts.length, texts: texts.slice(0, 6), low: texts.filter(t => t.ratio < 4.5).length, lowLinks: texts.filter(t => t.tag === 'A' && t.ratio < 4.5).length, fail: texts.filter(t => t.ratio < 3).length, textCount: texts.length,
@ -254,6 +260,7 @@ try {
if (baseline && check.contentWidth < Math.min(baseline.contentWidth * 0.85, baseline.contentWidth - 90)) problems.push(`content squeezed to ${check.contentWidth}px (X: ${baseline.contentWidth}px)`); if (baseline && check.contentWidth < Math.min(baseline.contentWidth * 0.85, baseline.contentWidth - 90)) problems.push(`content squeezed to ${check.contentWidth}px (X: ${baseline.contentWidth}px)`);
if (check.overflow > 1) problems.push(`page overflows the pane by ${check.overflow}px`); if (check.overflow > 1) problems.push(`page overflows the pane by ${check.overflow}px`);
if (check.restyle !== undefined && check.restyle > RESTYLE_BUDGET) problems.push(`each DOM insertion restyles ${check.restyle} elements (budget ${RESTYLE_BUDGET}; X: ${baseline?.restyle ?? '?'}): a page-wide selector such as :has() over the page`); if (check.restyle !== undefined && check.restyle > RESTYLE_BUDGET) problems.push(`each DOM insertion restyles ${check.restyle} elements (budget ${RESTYLE_BUDGET}; X: ${baseline?.restyle ?? '?'}): a page-wide selector such as :has() over the page`);
if (check.navNoIcon?.length) problems.push(`${check.navNoIcon.length} rail item(s) without a visible icon (${check.navNoIcon.slice(0, 3).join(', ')})`);
if (check.navMiss.length) problems.push(`${check.navMiss.length} rail item(s) not clickable (${check.navMiss.slice(0, 3).map(m => m.name + ' under ' + m.over).join(', ')})`); if (check.navMiss.length) problems.push(`${check.navMiss.length} rail item(s) not clickable (${check.navMiss.slice(0, 3).map(m => m.name + ' under ' + m.over).join(', ')})`);
if (check.chat) { if (check.chat) {
const c = check.chat, x = baseline?.chat; const c = check.chat, x = baseline?.chat;

View file

@ -85,6 +85,9 @@ export const CHAT_CSS = `
.scrollbar-thin-custom { scrollbar-width: thin; scrollbar-color: rgba(156, 163, 175, 0.5) transparent; } .scrollbar-thin-custom { scrollbar-width: thin; scrollbar-color: rgba(156, 163, 175, 0.5) transparent; }
.backdrop-blur-md { backdrop-filter: blur(var(--blur-md)); } .backdrop-blur-md { backdrop-filter: blur(var(--blur-md)); }
.rounded-chat { border-radius: 16px; } .rounded-full { border-radius: 9999px; } .rounded-chat { border-radius: 16px; } .rounded-full { border-radius: 9999px; }
/* Read live 2026-10-01: the rounded utilities carry their own radius scale (and a squircle corner). */
:is(.rounded-xxs, .rounded-legacy, .rounded-xs, .rounded-sm, .rounded, .rounded-md, .rounded-lg, .rounded-xl) { --x-radius-m: 1.8; } .rounded-md { border-radius: calc(16px * var(--x-radius-m)); }
:root, :host { --radius-2xl: 1rem; --radius-3xl: 1.5rem; } .rounded-2xl { border-radius: var(--radius-2xl); } .rounded-3xl { border-radius: var(--radius-3xl); }
.max-w-5xl { max-width: var(--container-5xl); } .min-w-\\[400px\\] { min-width: 400px; } .w-full { width: 100%; } .max-w-5xl { max-width: var(--container-5xl); } .min-w-\\[400px\\] { min-width: 400px; } .w-full { width: 100%; }
.\\@container { container-type: inline-size; } .\\@container { container-type: inline-size; }
@container (width >= 918px) { .\\@wide\\:block { display: block; } .\\@wide\\:w-\\[35\\%\\] { width: 35%; } .\\@wide\\:max-w-xl { max-width: var(--container-xl); } .\\@wide\\:shrink-0 { flex-shrink: 0; } } @container (width >= 918px) { .\\@wide\\:block { display: block; } .\\@wide\\:w-\\[35\\%\\] { width: 35%; } .\\@wide\\:max-w-xl { max-width: var(--container-xl); } .\\@wide\\:shrink-0 { flex-shrink: 0; } }
@ -100,7 +103,7 @@ export const CHAT_CSS = `
.fx-glyph { width: 20px; height: 20px; border: 2px solid currentColor; border-radius: 5px; } .fx-glyph { width: 20px; height: 20px; border: 2px solid currentColor; border-radius: 5px; }
`; `;
const avatar = (size, extra = '') => `<div class="bg-gray-300" style="width: ${size}px; height: ${size}px; min-width: ${size}px; border-radius: 9999px; overflow: hidden; ${extra}"><div style="width: 100%; height: 100%; background: linear-gradient(135deg, #8aa4b8, #4f6b80);"></div></div>`; const avatar = (size, extra = '') => `<div class="bg-gray-300 overflow-hidden rounded-full" style="width: ${size}px; height: ${size}px; min-width: ${size}px; ${extra}"><div style="width: 100%; height: 100%; background: linear-gradient(135deg, #8aa4b8, #4f6b80);"></div></div>`;
const iconButton = (testid, size = 48, classes = 'bg-btn-tertiary text-primary hover:bg-btn-tertiary-hover') => `<button type="button" data-slot="xds-button"${testid ? ` data-testid="${testid}"` : ''} class="fx-btn ${classes}" style="width: ${size}px; height: ${size}px;"><span class="fx-glyph"></span></button>`; const iconButton = (testid, size = 48, classes = 'bg-btn-tertiary text-primary hover:bg-btn-tertiary-hover') => `<button type="button" data-slot="xds-button"${testid ? ` data-testid="${testid}"` : ''} class="fx-btn ${classes}" style="width: ${size}px; height: ${size}px;"><span class="fx-glyph"></span></button>`;
const stamp = (time, mine) => `<div style="position: absolute; bottom: 0; inset-inline-end: 0;"><div class="${mine ? 'text-white' : 'text-gray700'}" style="display: flex; align-items: center; gap: 4px;"><span class="fx-f fx-sub3 text-[color:inherit]">${time}</span></div></div>`; const stamp = (time, mine) => `<div style="position: absolute; bottom: 0; inset-inline-end: 0;"><div class="${mine ? 'text-white' : 'text-gray700'}" style="display: flex; align-items: center; gap: 4px;"><span class="fx-f fx-sub3 text-[color:inherit]">${time}</span></div></div>`;
@ -146,7 +149,7 @@ function inbox() {
<input data-testid="dm-search-input" data-slot="xds-input" placeholder="Search" class="fx-f fx-body rounded-full w-full text-primary border border-transparent bg-inputs placeholder:text-tertiary" style="height: 40px; padding: 0 40px; outline: 0;"></div></div> <input data-testid="dm-search-input" data-slot="xds-input" placeholder="Search" class="fx-f fx-body rounded-full w-full text-primary border border-transparent bg-inputs placeholder:text-tertiary" style="height: 40px; padding: 0 40px; outline: 0;"></div></div>
</header><div style="padding: 8px 0;"></div> </header><div style="padding: 8px 0;"></div>
<div role="listbox" style="display: flex; min-height: 0; flex: 1; flex-direction: column;"><div data-testid="dm-conversation-scroller" class="scrollbar-thin-custom border-transparent" style="height: 100%; overflow: hidden auto; width: 100%; border-top-width: 1px;"><ul style="margin: 0; padding: 0; list-style: none;"> <div role="listbox" style="display: flex; min-height: 0; flex: 1; flex-direction: column;"><div data-testid="dm-conversation-scroller" class="scrollbar-thin-custom border-transparent" style="height: 100%; overflow: hidden auto; width: 100%; border-top-width: 1px;"><ul style="margin: 0; padding: 0; list-style: none;">
${rows.map((r, i) => `<li><div data-testid="dm-conversation-item-fx${i}"><a href="#" role="option" aria-selected="${!!r.selected}" style="display: block;"><div class="hover:bg-fg-alpha-05/50${r.selected ? ' bg-fg-alpha-05! dark:bg-fg-alpha-10!' : ''}" style="margin: 0 16px; display: flex; gap: 16px; border-radius: 12px; padding: 0 16px 0 8px; cursor: pointer;"> ${rows.map((r, i) => `<li><div data-testid="dm-conversation-item-fx${i}"><a href="#" role="option" aria-selected="${!!r.selected}" style="display: block;"><div class="rounded-md hover:bg-fg-alpha-05/50${r.selected ? ' bg-fg-alpha-05! dark:bg-fg-alpha-10!' : ''}" style="margin: 0 16px; display: flex; gap: 16px; padding: 0 16px 0 8px; cursor: pointer;">
<div style="padding: 12px 0;">${avatar(48)}</div> <div style="padding: 12px 0;">${avatar(48)}</div>
<div style="display: flex; min-width: 0; flex: 1; flex-direction: column; justify-content: center; gap: 4px;"> <div style="display: flex; min-width: 0; flex: 1; flex-direction: column; justify-content: center; gap: 4px;">
<div class="fx-f fx-body" style="display: flex; align-items: center; justify-content: space-between; gap: 6px; font-weight: 500;"><div style="min-width: 0; flex: 1;"><div class="text-text fx-clamp1" data-fx-min="7">${r.name}</div></div><div class="${r.unread ? 'text-primary' : 'text-secondary'}" style="flex-shrink: 0;"><div class="fx-sub2 text-[color:inherit]">${r.time}</div></div></div> <div class="fx-f fx-body" style="display: flex; align-items: center; justify-content: space-between; gap: 6px; font-weight: 500;"><div style="min-width: 0; flex: 1;"><div class="text-text fx-clamp1" data-fx-min="7">${r.name}</div></div><div class="${r.unread ? 'text-primary' : 'text-secondary'}" style="flex-shrink: 0;"><div class="fx-sub2 text-[color:inherit]">${r.time}</div></div></div>
@ -194,7 +197,7 @@ function conversation(kind) {
const typed = group ? '' : 'a message being written'; const typed = group ? '' : 'a message being written';
const composer = `<div data-testid="dm-composer-container" class="max-w-5xl w-full fx-opaque-btn" style="position: absolute; bottom: 0; left: 50%; isolation: isolate; z-index: 10; transform: translateX(-50%); padding: 16px;"> const composer = `<div data-testid="dm-composer-container" class="max-w-5xl w-full fx-opaque-btn" style="position: absolute; bottom: 0; left: 50%; isolation: isolate; z-index: 10; transform: translateX(-50%); padding: 16px;">
<div style="display: flex; align-items: flex-end; gap: 8px;">${iconButton('dm-composer-attachment-button')} <div style="display: flex; align-items: flex-end; gap: 8px;">${iconButton('dm-composer-attachment-button')}
<form data-testid="dm-composer-form" style="position: relative; min-width: 0; flex: 1; margin: 0;"><div data-testid="dm-composer-input-container" class="fx-f fx-body bg-btn-tertiary" style="display: flex; align-items: flex-end; overflow: hidden; border-radius: 24px; padding: 8px; line-height: 24px;"> <form data-testid="dm-composer-form" style="position: relative; min-width: 0; flex: 1; margin: 0;"><div data-testid="dm-composer-input-container" class="fx-f fx-body bg-btn-tertiary rounded-3xl" style="display: flex; align-items: flex-end; overflow: hidden; padding: 8px; line-height: 24px;">
<textarea data-testid="dm-composer-textarea" rows="1" placeholder="${group ? 'Message' : 'Unencrypted message'}" class="text-primary placeholder:text-tertiary" style="flex: 1; min-width: 0; border: 0; outline: 0; resize: none; height: 32px; padding: 4px 8px;">${typed}</textarea> <textarea data-testid="dm-composer-textarea" rows="1" placeholder="${group ? 'Message' : 'Unencrypted message'}" class="text-primary placeholder:text-tertiary" style="flex: 1; min-width: 0; border: 0; outline: 0; resize: none; height: 32px; padding: 4px 8px;">${typed}</textarea>
${typed ? `<button type="button" data-testid="dm-composer-send-button" class="fx-btn bg-btn-primary text-inverted" style="width: 32px; height: 32px;"><span class="fx-f fx-sub2" style="font-weight: 700;">↑</span></button>` : iconButton('dm-composer-voice-button', 32, 'bg-gray-0 text-primary')} ${typed ? `<button type="button" data-testid="dm-composer-send-button" class="fx-btn bg-btn-primary text-inverted" style="width: 32px; height: 32px;"><span class="fx-f fx-sub2" style="font-weight: 700;">↑</span></button>` : iconButton('dm-composer-voice-button', 32, 'bg-gray-0 text-primary')}
</div></form></div></div>`; </div></form></div></div>`;

View file

@ -95,6 +95,8 @@ body { font-family: TwitterChirp, -apple-system, "Segoe UI", Roboto, Helvetica,
.r-hover { background-color: ${m.hover}; } .r-hover { background-color: ${m.hover}; }
.r-yyyyoo { fill: currentcolor; } .r-yyyyoo { fill: currentcolor; }
.r-1otekoa { color: ${m.dimIcon}; } .r-1otekoa { color: ${m.dimIcon}; }
/* Read live 2026-10-01: X brightens the dim tool icons with a filter on their wrapper. */
.r-1jodnrb { filter: brightness(2.5); }
.r-module { background-color: ${m.module}; } .r-module { background-color: ${m.module}; }
.r-search { background-color: ${m.search}; } .r-search { background-color: ${m.search}; }
.r-sdzlij { border-top-left-radius: 9999px; border-top-right-radius: 9999px; border-bottom-right-radius: 9999px; border-bottom-left-radius: 9999px; } .r-sdzlij { border-top-left-radius: 9999px; border-top-right-radius: 9999px; border-bottom-right-radius: 9999px; border-bottom-left-radius: 9999px; }
@ -159,7 +161,7 @@ function composer(m, { inline = true } = {}) {
<div data-testid="tweetTextarea_0" role="textbox" class="r-chirp r-adyw6z" style="color: ${m.muted}; min-height: ${inline ? 28 : 96}px;">What is happening?!</div> <div data-testid="tweetTextarea_0" role="textbox" class="r-chirp r-adyw6z" style="color: ${m.muted}; min-height: ${inline ? 28 : 96}px;">What is happening?!</div>
<div class="css-175oi2r r-18u37iz r-qklmqi r-1kqtdi0" style="border-bottom-style: solid; padding-bottom: 12px;"><div role="button" class="css-175oi2r r-18u37iz" style="align-items: center; gap: 4px; color: rgb(29, 155, 240);">${icon()}${T('rgb(29, 155, 240)', 'Everyone can reply', ' r-b88u0q')}</div></div> <div class="css-175oi2r r-18u37iz r-qklmqi r-1kqtdi0" style="border-bottom-style: solid; padding-bottom: 12px;"><div role="button" class="css-175oi2r r-18u37iz" style="align-items: center; gap: 4px; color: rgb(29, 155, 240);">${icon()}${T('rgb(29, 155, 240)', 'Everyone can reply', ' r-b88u0q')}</div></div>
<div class="css-175oi2r r-18u37iz" style="align-items: center; justify-content: space-between;"><div data-testid="toolBar" class="css-175oi2r r-18u37iz r-16y2uox" style="align-items: center;"><nav class="css-175oi2r r-18u37iz" style="align-items: center;"> <div class="css-175oi2r r-18u37iz" style="align-items: center; justify-content: space-between;"><div data-testid="toolBar" class="css-175oi2r r-18u37iz r-16y2uox" style="align-items: center;"><nav class="css-175oi2r r-18u37iz" style="align-items: center;">
${tools.map(label => `<button aria-label="${label}" role="button" type="button" class="css-175oi2r r-sdzlij" style="background-color: rgba(0, 0, 0, 0); border-color: rgba(0, 0, 0, 0); min-width: 36px; min-height: 36px; align-items: center; justify-content: center;"><div dir="ltr" class="css-175oi2r" style="color: ${m.iconButton};">${icon(' r-1otekoa')}</div></button>`).join('')} ${tools.map(label => `<button aria-label="${label}" role="button" type="button" class="css-175oi2r r-sdzlij" style="background-color: rgba(0, 0, 0, 0); border-color: rgba(0, 0, 0, 0); min-width: 36px; min-height: 36px; align-items: center; justify-content: center;"><div dir="ltr" class="css-175oi2r r-1jodnrb" style="color: ${m.iconButton};">${icon(' r-1otekoa')}</div></button>`).join('')}
</nav></div><button data-testid="${inline ? 'tweetButtonInline' : 'tweetButton'}" class="css-175oi2r r-sdzlij" style="background-color: ${m.fill}; padding: 8px 18px; border: 0; opacity: 0.5;"><span class="css-1jxf684 r-chirp r-b88u0q" style="color: ${m.onFill};">Post</span></button></div> </nav></div><button data-testid="${inline ? 'tweetButtonInline' : 'tweetButton'}" class="css-175oi2r r-sdzlij" style="background-color: ${m.fill}; padding: 8px 18px; border: 0; opacity: 0.5;"><span class="css-1jxf684 r-chirp r-b88u0q" style="color: ${m.onFill};">Post</span></button></div>
</div></div>`; </div></div>`;
} }
@ -168,7 +170,10 @@ function nav(m) {
// X's rail as read live (2026-09-30): header > width wrapper > sticky column > [logo + nav + Post, account]. // X's rail as read live (2026-09-30): header > width wrapper > sticky column > [logo + nav + Post, account].
// Nav items: a[data-testid=AppTabBar_*] > div (the pill) > [div > svg, div > span]. // Nav items: a[data-testid=AppTabBar_*] > div (the pill) > [div > svg, div > span].
const items = [['AppTabBar_Home_Link', '/home', 'Home'], ['AppTabBar_Explore_Link', '/explore', 'Explore'], ['AppTabBar_Notifications_Link', '/notifications', 'Notifications'], const items = [['AppTabBar_Home_Link', '/home', 'Home'], ['AppTabBar_Explore_Link', '/explore', 'Explore'], ['AppTabBar_Notifications_Link', '/notifications', 'Notifications'],
['AppTabBar_DirectMessage_Link', '/i/chat', 'Chat'], ['', '/i/bookmarks', 'Bookmarks'], ['AppTabBar_Profile_Link', '/placeholder', 'Profile'], ['AppTabBar_More_Menu', '', 'More']]; ['AppTabBar_DirectMessage_Link', '/i/chat', 'Chat'], ['', '/i/grok', 'Grok'], ['premium-hub-tab', '/i/premium_sign_up', 'Premium'], ['', '/i/bookmarks', 'Bookmarks'],
// Read live 2026-10-02: X shows up to 12 rail items (History, Creator Studio, Articles join the usual ones).
['', '/i/history', 'History'], ['', '/i/creator-studio', 'Creator Studio'], ['', '/i/articles', 'Articles'],
['AppTabBar_Profile_Link', '/placeholder', 'Profile'], ['AppTabBar_More_Menu', '', 'More']];
const glyph = `<svg viewBox="0 0 24 24" aria-hidden="true" width="26" height="26" class="r-yyyyoo" style="color: ${m.text};"><g><path d="M12 3l9 8h-3v9H6v-9H3z"></path></g></svg>`; const glyph = `<svg viewBox="0 0 24 24" aria-hidden="true" width="26" height="26" class="r-yyyyoo" style="color: ${m.text};"><g><path d="M12 3l9 8h-3v9H6v-9H3z"></path></g></svg>`;
const item = ([testid, href, label]) => { const item = ([testid, href, label]) => {
const tag = href ? 'a' : 'button'; const tag = href ? 'a' : 'button';
@ -188,11 +193,11 @@ function nav(m) {
function sidebar(m) { function sidebar(m) {
return `<div data-testid="sidebarColumn" class="css-175oi2r r-1hycxz r-10f7w94 fx-sidebar"> return `<div data-testid="sidebarColumn" class="css-175oi2r r-1hycxz r-10f7w94 fx-sidebar">
<div class="css-175oi2r" style="gap: 16px; padding-top: 8px;"> <div class="css-175oi2r" style="gap: 16px; padding-top: 8px;">
<form role="search" class="css-175oi2r"><div class="css-175oi2r r-search r-sdzlij" style="padding: 10px 16px;">${T(m.muted, 'Search')}</div></form> <form role="search" class="css-175oi2r"><div class="css-175oi2r"><div class="css-175oi2r r-search r-sdzlij" style="padding: 10px 16px;">${T(m.muted, 'Search')}</div></div></form>
<div class="css-175oi2r r-1kqtdi0 r-card16" style="border-width: 1px; border-style: solid;"><aside role="complementary" class="css-175oi2r" style="padding: 12px 16px; gap: 10px;"> <div class="css-175oi2r r-1kqtdi0 r-card16" style="border-width: 1px; border-style: solid;"><div class="css-175oi2r"><aside role="complementary" class="css-175oi2r" style="padding: 12px 16px; gap: 10px;">
<span class="css-1jxf684 r-chirp r-adyw6z r-b88u0q" style="color: ${m.text};">You might like</span> <span class="css-1jxf684 r-chirp r-adyw6z r-b88u0q" style="color: ${m.text};">You might like</span>
${['Avery Stone', 'Kai Morgan', 'Remy Hart'].map(n => `<div class="css-175oi2r r-18u37iz" style="align-items: center; gap: 10px;"><div class="fx-avatar"></div><div class="css-175oi2r r-16y2uox">${T(m.text, n, ' r-b88u0q')}${T(m.muted, '@' + n.split(' ')[0].toLowerCase())}</div><button data-testid="1-follow" class="css-175oi2r r-sdzlij" style="background-color: ${m.fill}; padding: 6px 14px; border: 0;"><span class="css-1jxf684 r-chirp r-b88u0q" style="color: ${m.onFill};">Follow</span></button></div>`).join('')} ${['Avery Stone', 'Kai Morgan', 'Remy Hart'].map(n => `<div class="css-175oi2r r-18u37iz" style="align-items: center; gap: 10px;"><div class="fx-avatar"></div><div class="css-175oi2r r-16y2uox">${T(m.text, n, ' r-b88u0q')}${T(m.muted, '@' + n.split(' ')[0].toLowerCase())}</div><button data-testid="1-follow" class="css-175oi2r r-sdzlij" style="background-color: ${m.fill}; padding: 6px 14px; border: 0;"><span class="css-1jxf684 r-chirp r-b88u0q" style="color: ${m.onFill};">Follow</span></button></div>`).join('')}
</aside></div> </aside></div></div>
</div></div>`; </div></div>`;
} }
@ -376,7 +381,10 @@ ${nav(m)}${ROUTES[route](m)}
var side = document.querySelector('.fx-sidebar'); var side = document.querySelector('.fx-sidebar');
header.style.display = w < 700 ? 'none' : ''; header.style.display = w < 700 ? 'none' : '';
navInner.classList.toggle('r-nav275', wide); navInner.classList.toggle('r-nav88', !wide); navInner.classList.toggle('r-nav275', wide); navInner.classList.toggle('r-nav88', !wide);
document.querySelectorAll('.fx-label').forEach(function (l) { l.style.display = wide ? '' : 'none'; }); // Read live 2026-10-02: below 1265px X renders each rail item without its label element (the icon is
// the pill's only child), not with a hidden label.
window.__fxLabels = window.__fxLabels || [...document.querySelectorAll('.fx-label-box')].map(function (box) { return [box, box.parentElement]; });
window.__fxLabels.forEach(function (pair) { if (wide && !pair[0].isConnected) pair[1].appendChild(pair[0]); if (!wide && pair[0].isConnected) pair[0].remove(); });
var post = document.querySelector('.fx-post span'); if (post) post.textContent = wide ? 'Post' : '+'; var post = document.querySelector('.fx-post span'); if (post) post.textContent = wide ? 'Post' : '+';
document.querySelectorAll('.fx-row').forEach(function (row) { document.querySelectorAll('.fx-row').forEach(function (row) {
['r-113js5t', 'r-row990', 'r-row920', 'r-row600', 'r-13qz1uu'].forEach(function (c) { row.classList.remove(c); }); ['r-113js5t', 'r-row990', 'r-row920', 'r-row600', 'r-13qz1uu'].forEach(function (c) { row.classList.remove(c); });

View file

@ -290,7 +290,7 @@ checksum = "2af50177e190e07a26ab74f8b1efbfe2ef87da2116221318cb1c2e82baf7de06"
[[package]] [[package]]
name = "better-twttr" name = "better-twttr"
version = "1.0.1" version = "1.0.2"
dependencies = [ dependencies = [
"argon2", "argon2",
"base64 0.22.1", "base64 0.22.1",
@ -5326,6 +5326,7 @@ dependencies = [
"minisign-verify", "minisign-verify",
"objc2-app-kit", "objc2-app-kit",
"reqwest", "reqwest",
"rusqlite",
"rustls", "rustls",
"serde", "serde",
"serde_json", "serde_json",

View file

@ -1,6 +1,6 @@
[package] [package]
name = "better-twttr" name = "better-twttr"
version = "1.0.1" version = "1.0.2"
description = "X, extended: themes, plugins and recoverable drafts" description = "X, extended: themes, plugins and recoverable drafts"
license = "GPL-3.0-or-later" license = "GPL-3.0-or-later"
edition = "2021" edition = "2021"
@ -35,7 +35,8 @@ waybetter-host = { path = "../../../waybetter/crates/waybetter-host" }
[dependencies] [dependencies]
# The wayBetter framework (git submodule at the repository root): host policy, profiles, plugins, # The wayBetter framework (git submodule at the repository root): host policy, profiles, plugins,
# hotfix/update logic and, with the desktop feature, the app itself (`app::run_app`). # hotfix/update logic and, with the desktop feature, the app itself (`app::run_app`).
waybetter-host = { path = "../../../waybetter/crates/waybetter-host" } # `vault`: the drafts store (CAS revisions, history, export) the app gives its own rules.
waybetter-host = { path = "../../../waybetter/crates/waybetter-host", features = ["vault"] }
# `macos-private-api`: a transparent shell webview (drawsBackground off) that can rise above the # `macos-private-api`: a transparent shell webview (drawsBackground off) that can rise above the
# tab webviews for its overlays (host::raise_shell). Not for the Mac App Store, which we skip. # tab webviews for its overlays (host::raise_shell). Not for the Mac App Store, which we skip.
tauri = { version = "2", features = ["unstable", "macos-private-api"], optional = true } tauri = { version = "2", features = ["unstable", "macos-private-api"], optional = true }

View file

@ -5,19 +5,7 @@ fn main() {
// (`waybetter_host::commands`: tab layout and actions, shell raise, profiles, language, // (`waybetter_host::commands`: tab layout and actions, shell raise, profiles, language,
// the plugins folder and custom CSS, the tweak flags, the shell's settings). // the plugins folder and custom CSS, the tweak flags, the shell's settings).
tauri_build::AppManifest::new().commands(waybetter_host::commands::manifest(&[ tauri_build::AppManifest::new().commands(waybetter_host::commands::manifest(&[
"draft_list",
"draft_save",
"draft_revisions",
"draft_status",
"observation_list",
"data_export",
"capture_draft", "capture_draft",
"x_set_theme",
"x_theme_get",
"theme_scopes_get",
"theme_scopes_set",
"x_preview_theme",
"tab_run_command",
"column_configure", "column_configure",
"tab_report", "tab_report",
"drafts_picker_open", "drafts_picker_open",
@ -29,8 +17,6 @@ fn main() {
"popover_insert", "popover_insert",
"popover_close", "popover_close",
"popover_open_vault", "popover_open_vault",
"alerts_get",
"alerts_set",
"keyword_alert", "keyword_alert",
"tab_attach_image", "tab_attach_image",
])), ])),

View file

@ -9,16 +9,16 @@
"core:app:allow-version", "core:app:allow-version",
"allow-draft-list", "allow-draft-save", "allow-draft-revisions", "allow-draft-list", "allow-draft-save", "allow-draft-revisions",
"allow-draft-status", "allow-observation-list", "allow-data-export", "allow-draft-status", "allow-observation-list", "allow-data-export",
"allow-x-set-theme", "allow-x-theme-get", "allow-theme-scopes-get", "allow-theme-scopes-set", "allow-x-preview-theme", "allow-theme-get", "allow-theme-set", "allow-theme-preview", "allow-theme-scopes-get", "allow-theme-scopes-set",
"allow-gfonts-installed", "allow-gfonts-install", "allow-gfonts-remove", "allow-gfonts-faces", "allow-gfonts-preview", "allow-gfonts-installed", "allow-gfonts-install", "allow-gfonts-remove", "allow-gfonts-faces", "allow-gfonts-preview",
"allow-i18n-get", "allow-i18n-set", "allow-i18n-get", "allow-i18n-set",
"allow-tab-run-command", "allow-workspaces-get", "allow-workspaces-set", "allow-backup-collect", "allow-backup-export-file", "allow-backup-open-file", "allow-backup-apply", "allow-sync-status", "allow-sync-choose-folder", "allow-sync-unlock", "allow-sync-lock", "allow-sync-disable", "allow-sync-configure", "allow-sync-push", "allow-sync-check", "allow-sync-open", "allow-sync-mark-pulled", "allow-dev-get", "allow-dev-set", "allow-dev-pick-theme", "allow-dev-clear-theme", "allow-dev-reload-plugin", "allow-dev-report-error", "allow-tab-run-command", "allow-workspaces-get", "allow-workspaces-set", "allow-backup-collect", "allow-backup-export-file", "allow-backup-open-file", "allow-backup-apply", "allow-sync-status", "allow-sync-choose-folder", "allow-sync-unlock", "allow-sync-lock", "allow-sync-disable", "allow-sync-configure", "allow-sync-push", "allow-sync-check", "allow-sync-open", "allow-sync-mark-pulled", "allow-dev-get", "allow-dev-set", "allow-dev-pick-theme", "allow-dev-clear-theme", "allow-dev-reload-plugin", "allow-dev-report-error",
"allow-plugins-list", "allow-plugin-set-enabled", "allow-plugins-open-folder", "allow-plugin-remove", "allow-plugins-list", "allow-plugin-set-enabled", "allow-plugins-open-folder", "allow-plugin-remove",
"allow-install-pending", "allow-install-stage-link", "allow-install-stage-file", "allow-install-cancel", "allow-install-commit", "allow-install-records", "allow-install-forget", "allow-store-catalog", "allow-store-stage", "allow-strings-list", "allow-strings-read", "allow-strings-set", "allow-strings-remove", "allow-strings-apply", "allow-install-pending", "allow-install-stage-link", "allow-install-stage-file", "allow-install-stage-opened", "allow-install-cancel", "allow-install-commit", "allow-install-records", "allow-install-forget", "allow-store-catalog", "allow-store-stage", "allow-strings-list", "allow-strings-read", "allow-strings-set", "allow-strings-remove", "allow-strings-apply",
"allow-custom-css-get", "allow-custom-css-set", "allow-custom-css-get", "allow-custom-css-set",
"allow-features-get", "allow-features-set", "allow-mode-get", "allow-mode-set", "allow-features-get", "allow-features-set", "allow-mode-get", "allow-mode-set",
"allow-settings-get", "allow-settings-set", "allow-profiles-get", "allow-profiles-set", "allow-settings-get", "allow-settings-set", "allow-profiles-get", "allow-profiles-set",
"allow-tabs-sync", "allow-column-configure", "allow-tab-navigate", "allow-tab-action", "allow-tab-zoom", "allow-tab-find", "allow-safe-mode-get", "allow-safe-mode-set", "allow-diag-get", "allow-diag-log", "allow-open-external-url", "allow-shell-focus", "allow-shell-ready", "allow-tab-still-ready", "allow-shell-raise", "allow-tabs-sync", "allow-column-configure", "allow-tab-navigate", "allow-tab-action", "allow-tab-zoom", "allow-tab-find", "allow-menu-set", "allow-safe-mode-get", "allow-safe-mode-set", "allow-diag-get", "allow-diag-log", "allow-open-external-url", "allow-shell-focus", "allow-shell-ready", "allow-tab-still-ready", "allow-shell-raise",
"allow-update-status", "allow-update-check", "allow-apply-update", "allow-app-ready", "allow-update-status", "allow-update-check", "allow-apply-update", "allow-app-ready",
"allow-tab-insert-text", "allow-alerts-get", "allow-alerts-set", "allow-tab-insert-text", "allow-alerts-get", "allow-alerts-set",
"allow-media-get", "allow-media-set", "allow-gallery-add-folder", "allow-gallery-list", "allow-gallery-thumb", "allow-clip-list", "allow-clip-thumb", "allow-clip-remove", "allow-tab-attach-image", "allow-media-get", "allow-media-set", "allow-gallery-add-folder", "allow-gallery-list", "allow-gallery-thumb", "allow-clip-list", "allow-clip-thumb", "allow-clip-remove", "allow-tab-attach-image",

View file

@ -5,6 +5,10 @@
use serde::Deserialize; use serde::Deserialize;
pub use waybetter_host::alerts::*; pub use waybetter_host::alerts::*;
/// Where the host's alert settings are saved and how the X runtime takes the keywords
/// (`window.BetterTwttr.alerts.set`, else parked in `window.__btAlerts`).
pub static ALERTS: AlertsConfig = AlertsConfig { file: "alerts.json", member: "alerts", queue: "__btAlerts" };
/// A match reported by an X tab about a tweet it already received. /// A match reported by an X tab about a tweet it already received.
#[derive(Clone, Debug, Deserialize)] #[derive(Clone, Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]

View file

@ -26,8 +26,7 @@ pub use waybetter_host::backup::{
pub const MAX_DRAFTS: usize = 5000; pub const MAX_DRAFTS: usize = 5000;
// App-data file names (the same constants as in desktop.rs / workspaces.rs / plugins). // App-data file names (the same constants as in desktop.rs / workspaces.rs / plugins).
pub const THEME_FILE: &str = "x-theme.v2.json"; pub use crate::theme::{THEME_FILE, THEME_SCOPES_FILE};
pub const THEME_SCOPES_FILE: &str = "x-theme-scopes.json";
pub const FEATURES_FILE: &str = "features.json"; pub const FEATURES_FILE: &str = "features.json";
pub const SETTINGS_FILE: &str = "settings.json"; pub const SETTINGS_FILE: &str = "settings.json";
pub const ALERTS_FILE: &str = "alerts.json"; pub const ALERTS_FILE: &str = "alerts.json";

View file

@ -1,5 +1,4 @@
use crate::{ use crate::{
db::Store,
model::{CaptureAck, CaptureInput, SaveDraftInput}, model::{CaptureAck, CaptureInput, SaveDraftInput},
policy::{valid_identifier, validate_context, MAX_CAPTURE_TEXT_BYTES}, policy::{valid_identifier, validate_context, MAX_CAPTURE_TEXT_BYTES},
}; };
@ -8,6 +7,7 @@ use std::{
time::{Duration, Instant}, time::{Duration, Instant},
}; };
use uuid::Uuid; use uuid::Uuid;
use waybetter_host::vault::Vault;
struct Mapping { struct Mapping {
draft_id: String, draft_id: String,
@ -43,7 +43,7 @@ impl CaptureSession {
self.mappings.values().map(|mapping| mapping.draft_id.as_str()) self.mappings.values().map(|mapping| mapping.draft_id.as_str())
} }
pub fn write(&mut self, store: &mut Store, input: CaptureInput) -> Result<CaptureAck, String> { pub fn write(&mut self, store: &mut Vault, input: CaptureInput) -> Result<CaptureAck, String> {
if !valid_identifier(&input.composer_id) if !valid_identifier(&input.composer_id)
|| input.sequence == 0 || input.sequence == 0
|| input.sequence > 9_007_199_254_740_991 || input.sequence > 9_007_199_254_740_991

View file

@ -1,325 +1,43 @@
use crate::model::{Draft, DraftRevision, ExportData, Observation, SaveDraftInput}; //! X's drafts vault: the host's vault (`waybetter_host::vault`: CAS revisions, append-only revision
//! history, archive/restore, export, the capture budget) with X's rules. Everything X decides is
//! below: the draft kinds and sources, the size limits, the context URL rule, and that captured
//! drafts belong to `unassigned-x` under a 64 MiB / 50 000 revision budget.
use crate::policy::{valid_identifier, validate_context, MAX_TEXT_BYTES}; use crate::policy::{valid_identifier, validate_context, MAX_TEXT_BYTES};
use chrono::{SecondsFormat, Utc}; use std::ops::{Deref, DerefMut};
use rusqlite::{params, Connection, OptionalExtension, Row, TransactionBehavior}; use std::path::Path;
use std::{path::Path, time::Duration}; use waybetter_host::vault::{CaptureRules, Vault, VaultRules};
pub type Result<T> = std::result::Result<T, String>; pub use waybetter_host::vault::Result;
const SELECT_DRAFT: &str = "SELECT id,account_id,kind,title,text,context_url,revision,status,created_at,updated_at,source FROM drafts";
const CAPTURE_BUDGET_BYTES: i64 = 64 * 1024 * 1024;
const CAPTURE_BUDGET_REVISIONS: i64 = 50_000;
pub fn now() -> String { pub static RULES: VaultRules = VaultRules {
Utc::now().to_rfc3339_opts(SecondsFormat::Millis, true) kinds: &["post", "reply", "quote", "thread"],
} sources: &["local", "capture", "template"],
max_title_utf16: 120,
max_text_bytes: MAX_TEXT_BYTES,
valid_identifier,
validate_context: |context| validate_context(context, false),
capture: CaptureRules { account: "unassigned-x", source: "capture", budget_bytes: 64 * 1024 * 1024, budget_revisions: 50_000 },
};
fn sql_error(error: rusqlite::Error) -> String { /// The vault with X's rules.
// Database errors never include SQL parameters (draft contents). pub struct Store(Vault);
format!("DATABASE: {error}")
}
fn draft_row(row: &Row<'_>) -> rusqlite::Result<Draft> {
Ok(Draft {
id: row.get(0)?,
account_id: row.get(1)?,
kind: row.get(2)?,
title: row.get(3)?,
text: row.get(4)?,
context_url: row.get(5)?,
revision: row.get(6)?,
status: row.get(7)?,
created_at: row.get(8)?,
updated_at: row.get(9)?,
source: row.get(10)?,
})
}
fn revision_row(row: &Row<'_>) -> rusqlite::Result<DraftRevision> {
Ok(DraftRevision {
draft_id: row.get(0)?,
revision: row.get(1)?,
title: row.get(2)?,
text: row.get(3)?,
context_url: row.get(4)?,
source: row.get(5)?,
created_at: row.get(6)?,
})
}
fn validate_input(input: &SaveDraftInput) -> Result<()> {
if !valid_identifier(&input.id) || !valid_identifier(&input.account_id) {
return Err("VALIDATION: invalid draft or account identifier".into());
}
if !["post", "reply", "quote", "thread"].contains(&input.kind.as_str())
|| !["local", "capture", "template"].contains(&input.source.as_str())
|| !(0..9_007_199_254_740_991).contains(&input.expected_revision)
{
return Err("VALIDATION: invalid draft kind, source, or revision".into());
}
if input.title.encode_utf16().count() > 120 || input.text.len() > MAX_TEXT_BYTES {
return Err("VALIDATION: draft size limit exceeded".into());
}
validate_context(&input.context_url, false)
}
pub struct Store {
connection: Connection,
}
impl Store { impl Store {
pub fn open(path: impl AsRef<Path>) -> Result<Self> { pub fn open(path: impl AsRef<Path>) -> Result<Self> {
let mut connection = Connection::open(path).map_err(sql_error)?; Vault::open(path, &RULES).map(Self)
connection
.busy_timeout(Duration::from_secs(5))
.map_err(sql_error)?;
connection
.execute_batch(
"PRAGMA journal_mode=WAL; PRAGMA synchronous=FULL; PRAGMA foreign_keys=ON;",
)
.map_err(sql_error)?;
let version: i64 = connection
.pragma_query_value(None, "user_version", |row| row.get(0))
.map_err(sql_error)?;
if version > 1 {
return Err("DATABASE: newer schema; use a newer application version".into());
} }
if version == 0 {
let tx = connection
.transaction_with_behavior(TransactionBehavior::Immediate)
.map_err(sql_error)?;
tx.execute_batch(
"CREATE TABLE IF NOT EXISTS drafts (
id TEXT PRIMARY KEY, account_id TEXT NOT NULL,
kind TEXT NOT NULL CHECK(kind IN ('post','reply','quote','thread')),
title TEXT NOT NULL, text TEXT NOT NULL, context_url TEXT NOT NULL,
revision INTEGER NOT NULL CHECK(revision > 0),
status TEXT NOT NULL CHECK(status IN ('active','archived')),
created_at TEXT NOT NULL, updated_at TEXT NOT NULL,
source TEXT NOT NULL CHECK(source IN ('local','capture','template'))
);
CREATE INDEX IF NOT EXISTS drafts_updated ON drafts(updated_at DESC);
CREATE TABLE IF NOT EXISTS revisions (
draft_id TEXT NOT NULL REFERENCES drafts(id), revision INTEGER NOT NULL,
title TEXT NOT NULL, text TEXT NOT NULL, context_url TEXT NOT NULL,
source TEXT NOT NULL, created_at TEXT NOT NULL,
PRIMARY KEY(draft_id,revision)
);
CREATE TABLE IF NOT EXISTS observations (
id TEXT PRIMARY KEY, account_id TEXT NOT NULL, user_id TEXT NOT NULL,
following INTEGER CHECK(following IN (0,1)),
followed_by INTEGER CHECK(followed_by IN (0,1)),
observed_at TEXT NOT NULL, source TEXT NOT NULL
);
CREATE TABLE IF NOT EXISTS capture_usage (
singleton INTEGER PRIMARY KEY CHECK(singleton=1),
stored_bytes INTEGER NOT NULL, revision_count INTEGER NOT NULL
);
INSERT OR IGNORE INTO capture_usage VALUES(1,0,0);
PRAGMA user_version=1;",
)
.map_err(sql_error)?;
tx.commit().map_err(sql_error)?;
}
Ok(Self { connection })
} }
pub fn list_drafts(&self) -> Result<Vec<Draft>> { impl Deref for Store {
let mut statement = self type Target = Vault;
.connection fn deref(&self) -> &Vault {
.prepare(&format!("{SELECT_DRAFT} ORDER BY updated_at DESC,id")) &self.0
.map_err(sql_error)?; }
let rows = statement.query_map([], draft_row).map_err(sql_error)?;
rows.collect::<rusqlite::Result<_>>().map_err(sql_error)
} }
pub fn get_draft(&self, id: &str) -> Result<Option<Draft>> { impl DerefMut for Store {
self.connection fn deref_mut(&mut self) -> &mut Vault {
.query_row(&format!("{SELECT_DRAFT} WHERE id=?1"), [id], draft_row) &mut self.0
.optional()
.map_err(sql_error)
}
pub fn save_draft(&mut self, input: &SaveDraftInput) -> Result<Draft> {
self.save(input, false)
}
pub(crate) fn save_capture(&mut self, input: &SaveDraftInput) -> Result<Draft> {
if input.account_id != "unassigned-x" || input.source != "capture" {
return Err("FORBIDDEN: capture account/source are native-owned".into());
}
self.save(input, true)
}
fn save(&mut self, input: &SaveDraftInput, capture: bool) -> Result<Draft> {
validate_input(input)?;
let tx = self
.connection
.transaction_with_behavior(TransactionBehavior::Immediate)
.map_err(sql_error)?;
let old = tx
.query_row(
&format!("{SELECT_DRAFT} WHERE id=?1"),
[&input.id],
draft_row,
)
.optional()
.map_err(sql_error)?;
match &old {
Some(draft) if draft.revision != input.expected_revision => {
return Err("CONFLICT: draft changed; reload before saving".into())
}
Some(draft) if draft.account_id != input.account_id => {
return Err("FORBIDDEN: draft account cannot change".into())
}
Some(draft) if capture && (draft.status != "active" || draft.source != "capture") => {
return Err("CONFLICT: captured draft was edited or archived locally".into())
}
None if input.expected_revision != 0 => {
return Err("CONFLICT: draft no longer matches expected revision".into())
}
_ => {}
}
if capture {
let bytes =
(input.text.len() + input.title.len() + input.context_url.len() + 256) as i64;
let changed = tx.execute(
"UPDATE capture_usage SET stored_bytes=stored_bytes+?1,revision_count=revision_count+1 WHERE singleton=1 AND stored_bytes+?1<=?2 AND revision_count+1<=?3",
params![bytes, CAPTURE_BUDGET_BYTES, CAPTURE_BUDGET_REVISIONS],
).map_err(sql_error)?;
if changed != 1 {
return Err(
"QUOTA: capture storage limit reached; existing drafts are preserved".into(),
);
}
}
let stamp = now();
let draft = Draft {
id: input.id.clone(),
account_id: input.account_id.clone(),
kind: input.kind.clone(),
title: input.title.clone(),
text: input.text.clone(),
context_url: input.context_url.clone(),
revision: input.expected_revision + 1,
status: old
.as_ref()
.map_or("active", |draft| draft.status.as_str())
.to_string(),
created_at: old.map_or_else(|| stamp.clone(), |draft| draft.created_at),
updated_at: stamp,
source: input.source.clone(),
};
tx.execute(
"INSERT INTO drafts(id,account_id,kind,title,text,context_url,revision,status,created_at,updated_at,source)
VALUES(?1,?2,?3,?4,?5,?6,?7,?8,?9,?10,?11)
ON CONFLICT(id) DO UPDATE SET kind=excluded.kind,title=excluded.title,text=excluded.text,
context_url=excluded.context_url,revision=excluded.revision,updated_at=excluded.updated_at,source=excluded.source",
params![draft.id,draft.account_id,draft.kind,draft.title,draft.text,draft.context_url,draft.revision,draft.status,draft.created_at,draft.updated_at,draft.source],
).map_err(sql_error)?;
Self::append_revision(&tx, &draft)?;
tx.commit().map_err(sql_error)?;
Ok(draft)
}
fn append_revision(connection: &Connection, draft: &Draft) -> Result<()> {
connection.execute(
"INSERT INTO revisions(draft_id,revision,title,text,context_url,source,created_at) VALUES(?1,?2,?3,?4,?5,?6,?7)",
params![draft.id,draft.revision,draft.title,draft.text,draft.context_url,draft.source,draft.updated_at],
).map_err(sql_error)?;
Ok(())
}
pub fn set_status(&mut self, id: &str, expected_revision: i64, status: &str) -> Result<Draft> {
if !valid_identifier(id)
|| !["active", "archived"].contains(&status)
|| expected_revision < 1
|| expected_revision >= 9_007_199_254_740_991
{
return Err("VALIDATION: invalid status update".into());
}
let tx = self
.connection
.transaction_with_behavior(TransactionBehavior::Immediate)
.map_err(sql_error)?;
let mut draft = tx
.query_row(&format!("{SELECT_DRAFT} WHERE id=?1"), [id], draft_row)
.optional()
.map_err(sql_error)?
.ok_or("CONFLICT: draft not found")?;
if draft.revision != expected_revision {
return Err("CONFLICT: draft changed before status update".into());
}
draft.status = status.into();
draft.revision += 1;
draft.updated_at = now();
tx.execute(
"UPDATE drafts SET status=?1,revision=?2,updated_at=?3 WHERE id=?4",
params![draft.status, draft.revision, draft.updated_at, id],
)
.map_err(sql_error)?;
Self::append_revision(&tx, &draft)?;
tx.commit().map_err(sql_error)?;
Ok(draft)
}
pub fn revisions(&self, id: &str) -> Result<Vec<DraftRevision>> {
if !valid_identifier(id) {
return Err("VALIDATION: invalid draft identifier".into());
}
let mut statement = self.connection.prepare("SELECT draft_id,revision,title,text,context_url,source,created_at FROM revisions WHERE draft_id=?1 ORDER BY revision DESC").map_err(sql_error)?;
let rows = statement.query_map([id], revision_row).map_err(sql_error)?;
rows.collect::<rusqlite::Result<_>>().map_err(sql_error)
}
pub fn observations(&self) -> Result<Vec<Observation>> {
// No remote observation ingestion yet: account identity has not been verified.
let mut statement = self.connection.prepare("SELECT id,account_id,user_id,following,followed_by,observed_at,source FROM observations ORDER BY observed_at DESC,id").map_err(sql_error)?;
let rows = statement
.query_map([], |row| {
Ok(Observation {
id: row.get(0)?,
account_id: row.get(1)?,
user_id: row.get(2)?,
following: row.get(3)?,
followed_by: row.get(4)?,
observed_at: row.get(5)?,
source: row.get(6)?,
})
})
.map_err(sql_error)?;
rows.collect::<rusqlite::Result<_>>().map_err(sql_error)
}
pub fn export(&mut self) -> Result<ExportData> {
// A deferred transaction gives all export tables one SQLite read snapshot.
self.connection
.execute_batch("BEGIN DEFERRED")
.map_err(sql_error)?;
let result = (|| {
let drafts = self.list_drafts()?;
let observations = self.observations()?;
let mut statement = self.connection.prepare("SELECT draft_id,revision,title,text,context_url,source,created_at FROM revisions ORDER BY draft_id,revision").map_err(sql_error)?;
let rows = statement.query_map([], revision_row).map_err(sql_error)?;
let revisions = rows
.collect::<rusqlite::Result<Vec<_>>>()
.map_err(sql_error)?;
Ok(ExportData {
version: 1,
exported_at: now(),
drafts,
revisions,
observations,
})
})();
match result {
Ok(data) => {
self.connection.execute_batch("COMMIT").map_err(sql_error)?;
Ok(data)
}
Err(error) => {
let _ = self.connection.execute_batch("ROLLBACK");
Err(error)
}
}
} }
} }

View file

@ -6,16 +6,14 @@
//! `XSite` fills in its hooks. //! `XSite` fills in its hooks.
use crate::{ use crate::{
alerts::{self, AlertGate, AlertSettings, KeywordHit, Throttle}, alerts::{self, AlertGate, KeywordHit, Throttle},
capture::CaptureSession, capture::CaptureSession,
compose, compose,
db::Store,
desktop_popover, desktop_popover,
model::*, model::*,
plugins, profiles, plugins, profiles,
policy, policy,
site::SITE, site::SITE,
theme::{x_default, ThemeScopes, XTheme, X_THEMES},
}; };
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use std::collections::{HashMap, HashSet}; use std::collections::{HashMap, HashSet};
@ -24,7 +22,8 @@ use tauri::{AppHandle, Manager, State, Webview};
use url::Url; use url::Url;
use waybetter_host::app::{self as wb, AppConfig, NewTab, SiteHooks, TabClosed}; use waybetter_host::app::{self as wb, AppConfig, NewTab, SiteHooks, TabClosed};
use waybetter_host::host::emit_tab_state as emit_state; use waybetter_host::host::emit_tab_state as emit_state;
pub(crate) use waybetter_host::host::{data_file, emit_shell, read_json, shell_only, tab_only, tab_webview, write_json}; pub(crate) use waybetter_host::vault_commands::lock as vault;
pub(crate) use waybetter_host::host::{emit_shell, shell_only, tab_only, tab_webview};
use waybetter_host::tabs::{self, ColumnConfig, TabLayout, TabRole, TabState}; use waybetter_host::tabs::{self, ColumnConfig, TabLayout, TabRole, TabState};
// Settings backup/sync, workspaces, plugin palette commands and developer mode (shell-only). // Settings backup/sync, workspaces, plugin palette commands and developer mode (shell-only).
@ -35,36 +34,20 @@ mod settings;
const LEGACY_IDENTIFIER: &str = "dev.xworkspace.desktop"; const LEGACY_IDENTIFIER: &str = "dev.xworkspace.desktop";
/// The page for new tabs and the first launch until the owner sets another. /// The page for new tabs and the first launch until the owner sets another.
const HOME_URL: &str = "https://x.com/home"; const HOME_URL: &str = "https://x.com/home";
/// Written only when the owner opts in to theming X ("Apply theme to X").
const THEME_FILE: &str = "x-theme.v2.json";
/// Pre-opt-in builds wrote this automatically; it must not keep recoloring X.
const LEGACY_THEME_FILE: &str = "x-theme.json";
/// Account and pane themes and the chrome setting (`theme::ThemeScopes`); absent = defaults.
const THEME_SCOPES_FILE: &str = "x-theme-scopes.json";
/// The account profiles (the framework keeps them; backups read and import them). /// The account profiles (the framework keeps them; backups read and import them).
const PROFILES_FILE: &str = wb::PROFILES_FILE; const PROFILES_FILE: &str = wb::PROFILES_FILE;
const ALERTS_FILE: &str = "alerts.json";
// --------------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------------
// State // State
struct NativeData { struct NativeData {
store: Store,
/// Composer→draft mappings per tab; navigation in a tab rotates only that tab's mappings. /// Composer→draft mappings per tab; navigation in a tab rotates only that tab's mappings.
captures: HashMap<String, CaptureSession>, captures: HashMap<String, CaptureSession>,
theme: Option<XTheme>,
/// Which theme each tab shows (pane, account, global) and whether the chrome follows it.
theme_scopes: ThemeScopes,
/// The Theme Builder's unsaved draft, shown in every X tab until it is saved or closed.
theme_preview: Option<XTheme>,
/// Tab webview label -> X's left navigation repeats one already on screen (see `pane_script`). /// Tab webview label -> X's left navigation repeats one already on screen (see `pane_script`).
tab_nav_redundant: HashMap<String, bool>, tab_nav_redundant: HashMap<String, bool>,
/// Tab webview label -> its deck column config (Power User Mode; `column_configure`). /// Tab webview label -> its deck column config (Power User Mode; `column_configure`).
tab_columns: HashMap<String, ColumnConfig>, tab_columns: HashMap<String, ColumnConfig>,
/// Tab webview label -> the palette commands its plugins registered (`tab_report.commands`). /// Keyword alert dedupe/rate limit (the settings are the host's: `waybetter_host::alerts_commands`).
tab_commands: HashMap<String, Vec<crate::palette_commands::PaletteCommand>>,
/// Keyword alerts (local only) and their dedupe/rate limit.
alerts: AlertSettings,
alert_gate: AlertGate, alert_gate: AlertGate,
/// Capture-failure notifications: at most one per tab every few minutes. /// Capture-failure notifications: at most one per tab every few minutes.
capture_failures: Throttle, capture_failures: Throttle,
@ -91,19 +74,13 @@ fn lock(state: &AppState) -> Result<MutexGuard<'_, NativeData>, String> {
// --------------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------------
// Workspace commands (shell only) // Workspace commands (shell only)
#[tauri::command]
async fn draft_list(webview: Webview, state: State<'_, AppState>) -> Result<Vec<Draft>, String> {
shell_only(&webview)?;
lock(&state)?.store.list_drafts()
}
/// Vault reads for the drafts popover (desktop_popover.rs checks the caller first). /// Vault reads for the drafts popover (desktop_popover.rs checks the caller first).
pub(crate) fn vault_drafts(app: &AppHandle) -> Result<Vec<Draft>, String> { pub(crate) fn vault_drafts(app: &AppHandle) -> Result<Vec<Draft>, String> {
lock(&app.state::<AppState>())?.store.list_drafts() vault(app)?.list_drafts()
} }
pub(crate) fn vault_draft(app: &AppHandle, id: &str) -> Result<Option<Draft>, String> { pub(crate) fn vault_draft(app: &AppHandle, id: &str) -> Result<Option<Draft>, String> {
lock(&app.state::<AppState>())?.store.get_draft(id) vault(app)?.get_draft(id)
} }
/// Whether tab `label` has a captured draft for exactly this post page that none of its live /// Whether tab `label` has a captured draft for exactly this post page that none of its live
@ -114,58 +91,11 @@ pub(crate) fn resumable_draft(app: &AppHandle, label: &str, url: &Url) -> Result
if !crate::popover::is_reply_context(url) { if !crate::popover::is_reply_context(url) {
return Ok(false); return Ok(false);
} }
let drafts = data.store.list_drafts()?; let drafts = vault(app)?.list_drafts()?;
let live: HashSet<&str> = data.captures.get(label).map(|session| session.draft_ids().collect()).unwrap_or_default(); let live: HashSet<&str> = data.captures.get(label).map(|session| session.draft_ids().collect()).unwrap_or_default();
Ok(crate::popover::has_resumable_draft(&drafts, url, |id| live.contains(id))) Ok(crate::popover::has_resumable_draft(&drafts, url, |id| live.contains(id)))
} }
#[tauri::command]
async fn draft_save(
webview: Webview,
state: State<'_, AppState>,
input: SaveDraftInput,
) -> Result<Draft, String> {
shell_only(&webview)?;
lock(&state)?.store.save_draft(&input)
}
#[tauri::command]
async fn draft_revisions(
webview: Webview,
state: State<'_, AppState>,
draft_id: String,
) -> Result<Vec<DraftRevision>, String> {
shell_only(&webview)?;
lock(&state)?.store.revisions(&draft_id)
}
#[tauri::command]
async fn draft_status(
webview: Webview,
state: State<'_, AppState>,
id: String,
expected_revision: i64,
status: String,
) -> Result<Draft, String> {
shell_only(&webview)?;
lock(&state)?.store.set_status(&id, expected_revision, &status)
}
#[tauri::command]
async fn observation_list(
webview: Webview,
state: State<'_, AppState>,
) -> Result<Vec<Observation>, String> {
shell_only(&webview)?;
lock(&state)?.store.observations()
}
#[tauri::command]
async fn data_export(webview: Webview, state: State<'_, AppState>) -> Result<ExportData, String> {
shell_only(&webview)?;
lock(&state)?.store.export()
}
/// The X page may only append composer snapshots. Mappings are owned natively per tab. /// The X page may only append composer snapshots. Mappings are owned natively per tab.
#[tauri::command] #[tauri::command]
async fn capture_draft( async fn capture_draft(
@ -182,11 +112,14 @@ async fn capture_draft(
return Err("UNSUPPORTED: remote capture is enabled only on macOS and Windows".into()); return Err("UNSUPPORTED: remote capture is enabled only on macOS and Windows".into());
} }
let mut data = lock(&state)?; let mut data = lock(&state)?;
let NativeData { store, captures, capture_failures, .. } = &mut *data; let NativeData { captures, capture_failures, .. } = &mut *data;
// The vault is locked after the capture state, always in this order (see `resumable_draft`).
let mut store = vault(webview.app_handle())?;
let result = captures let result = captures
.entry(webview.label().to_owned()) .entry(webview.label().to_owned())
.or_default() .or_default()
.write(store, capture); .write(&mut store, capture);
drop(store);
if let Err(error) = &result { if let Err(error) = &result {
if alerts::capture_failure_notifies(error) if alerts::capture_failure_notifies(error)
&& capture_failures.allow(webview.label(), std::time::Instant::now()) && capture_failures.allow(webview.label(), std::time::Instant::now())
@ -275,38 +208,6 @@ async fn tab_insert_text(webview: Webview, app: AppHandle, id: String, text: Str
tab.eval(&script).map_err(|error| format!("TAB: {error}")) tab.eval(&script).map_err(|error| format!("TAB: {error}"))
} }
#[tauri::command]
async fn alerts_get(webview: Webview, state: State<'_, AppState>) -> Result<AlertSettings, String> {
shell_only(&webview)?;
Ok(lock(&state)?.alerts.clone())
}
#[tauri::command]
async fn alerts_set(
webview: Webview,
app: AppHandle,
state: State<'_, AppState>,
settings: AlertSettings,
) -> Result<AlertSettings, String> {
shell_only(&webview)?;
let settings = settings.validated()?;
let script = alerts_script(&settings);
{
// Hold the lock across the write so concurrent saves cannot leave disk and memory disagreeing.
let mut data = lock(&state)?;
write_json(&app, ALERTS_FILE, &settings)?;
data.alerts = settings.clone();
}
eval_in_x_tabs(&app, &script);
Ok(settings)
}
/// Hands the X runtime the keywords to watch for (empty = alerts off, observer uninstalled).
fn alerts_script(settings: &AlertSettings) -> String {
let keywords = serde_json::to_string(settings.active_keywords()).unwrap_or_else(|_| "[]".into());
tabs::deliver_script(SITE.runtime_global, "alerts", "set", "__btAlerts", &keywords)
}
/// An X tab reports a configured keyword in a tweet it already received. Local notification only, /// An X tab reports a configured keyword in a tweet it already received. Local notification only,
/// deduplicated per tweet and rate limited. /// deduplicated per tweet and rate limited.
#[tauri::command] #[tauri::command]
@ -315,7 +216,7 @@ async fn keyword_alert(webview: Webview, state: State<'_, AppState>, hit: Keywor
policy::require_capture(webview.label(), &url)?; policy::require_capture(webview.label(), &url)?;
let message = { let message = {
let mut data = lock(&state)?; let mut data = lock(&state)?;
let message = alerts::check_hit(&data.alerts, &hit)?; let message = alerts::check_hit(&waybetter_host::alerts_commands::settings(webview.app_handle())?, &hit)?;
if !data.alert_gate.allow(&hit, std::time::Instant::now()) { if !data.alert_gate.allow(&hit, std::time::Instant::now()) {
return Ok(()); return Ok(());
} }
@ -332,138 +233,6 @@ async fn keyword_alert(webview: Webview, state: State<'_, AppState>, hit: Keywor
Ok(()) Ok(())
} }
fn load_theme(app: &AppHandle) -> Option<XTheme> {
let theme: XTheme = read_json(app, THEME_FILE)?;
theme.validate(&X_THEMES).ok()?;
Some(theme)
}
fn load_theme_scopes(app: &AppHandle) -> ThemeScopes {
read_json::<ThemeScopes>(app, THEME_SCOPES_FILE).filter(|scopes| scopes.validate().is_ok()).unwrap_or_default()
}
/// The theme (and the Google font bytes it needs) for the X tab `label`: the Theme Builder's
/// preview while one is open, else its pane's, its account's or the global theme.
fn tab_theme(app: &AppHandle, state: &NativeData, label: &str) -> XTheme {
let global = state.theme.clone().unwrap_or_else(x_default);
match &state.theme_preview {
Some(preview) => preview.clone(),
None => {
let tab = policy::tab_id(label).unwrap_or_default();
state.theme_scopes.for_tab(&X_THEMES, &global, tab, wb::tab_profile(app, label).as_deref())
}
}
}
/// The X tab `label`'s native background: its theme's page color (see `XTheme::page_color`).
fn tab_background(app: &AppHandle, state: &NativeData, label: &str) -> Option<tauri::window::Color> {
tab_theme(app, state, label).page_color(&X_THEMES).map(|(r, g, b)| tauri::window::Color(r, g, b, 255))
}
fn tab_theme_scripts(app: &AppHandle, state: &NativeData, label: &str) -> Vec<String> {
let theme = tab_theme(app, state, label);
let mut scripts = Vec::new();
if let Some(fonts) = waybetter_host::fonts::page_script_for(&SITE, &theme.google_fonts()) {
scripts.push(fonts);
}
if let Ok(script) = theme.script(&X_THEMES, &SITE) {
scripts.push(script);
}
scripts
}
/// Sends every X tab its theme again (after the theme, the scopes, the preview or the fonts changed).
fn apply_themes(app: &AppHandle) {
// Safe mode: X pages keep X's own look; a theme chosen meanwhile applies when safe mode is left.
if waybetter_host::safe::active() {
return;
}
let Some(state) = app.try_state::<AppState>() else { return };
let per_tab: Vec<(Webview, Vec<String>, Option<tauri::window::Color>)> = {
let Ok(data) = state.0.lock() else { return };
app.webviews()
.into_iter()
.filter(|(label, tab)| policy::tab_id(label).is_some() && tab.url().is_ok_and(|url| policy::x_origin(&url)))
.map(|(label, tab)| (tab, tab_theme_scripts(app, &data, &label), tab_background(app, &data, &label)))
.collect()
};
for (tab, scripts, background) in per_tab {
let _ = tab.set_background_color(background);
for script in scripts {
let _ = tab.eval(&script);
}
}
}
/// Applies a theme to every X tab and persists it. `None` (or the `x` preset without an accent)
/// restores X's own look.
#[tauri::command]
async fn x_set_theme(
webview: Webview,
app: AppHandle,
state: State<'_, AppState>,
theme: Option<XTheme>,
) -> Result<(), String> {
shell_only(&webview)?;
let theme = theme.unwrap_or_else(x_default);
theme.validate(&X_THEMES)?;
if theme.is_empty(&X_THEMES) {
if let Some(path) = data_file(&app, THEME_FILE) {
let _ = std::fs::remove_file(path);
}
lock(&state)?.theme = None;
} else {
write_json(&app, THEME_FILE, &theme)?;
lock(&state)?.theme = Some(theme);
}
apply_themes(&app);
Ok(())
}
/// Account and pane themes and the chrome setting.
#[tauri::command]
async fn theme_scopes_get(webview: Webview, state: State<'_, AppState>) -> Result<ThemeScopes, String> {
shell_only(&webview)?;
Ok(lock(&state)?.theme_scopes.clone())
}
/// Saves account and pane themes (bounded, ids checked) and re-themes every X tab.
#[tauri::command]
async fn theme_scopes_set(webview: Webview, app: AppHandle, state: State<'_, AppState>, scopes: ThemeScopes) -> Result<(), String> {
shell_only(&webview)?;
scopes.validate()?;
if scopes.is_default() {
if let Some(path) = data_file(&app, THEME_SCOPES_FILE) {
let _ = std::fs::remove_file(path);
}
} else {
write_json(&app, THEME_SCOPES_FILE, &scopes)?;
}
lock(&state)?.theme_scopes = scopes;
apply_themes(&app);
Ok(())
}
/// The Theme Builder's live preview: an unsaved theme shown in every X tab (not persisted). `None`
/// ends the preview and gives every tab its own theme back.
#[tauri::command]
async fn x_preview_theme(webview: Webview, app: AppHandle, state: State<'_, AppState>, theme: Option<XTheme>) -> Result<(), String> {
shell_only(&webview)?;
if let Some(theme) = &theme {
theme.validate(&X_THEMES)?;
}
lock(&state)?.theme_preview = theme;
apply_themes(&app);
Ok(())
}
/// The persisted X theme (default when none).
#[tauri::command]
async fn x_theme_get(webview: Webview, state: State<'_, AppState>) -> Result<XTheme, String> {
shell_only(&webview)?;
Ok(lock(&state)?.theme.clone().unwrap_or_else(x_default))
}
/// Tells an X tab whether its left navigation repeats one already on screen; the runtime hides it /// Tells an X tab whether its left navigation repeats one already on screen; the runtime hides it
/// while the `singleSplitNav` feature is on. Queued in `__btPane` until the runtime exists. /// while the `singleSplitNav` feature is on. Queued in `__btPane` until the runtime exists.
fn pane_script(nav_redundant: bool) -> String { fn pane_script(nav_redundant: bool) -> String {
@ -534,7 +303,7 @@ struct TabReport {
/// Injected into every tab: SPA URL/title/favicon changes and focus, for the address bar. /// Injected into every tab: SPA URL/title/favicon changes and focus, for the address bar.
#[tauri::command] #[tauri::command]
async fn tab_report(webview: Webview, app: AppHandle, state: State<'_, AppState>, report: TabReport) -> Result<(), String> { async fn tab_report(webview: Webview, app: AppHandle, report: TabReport) -> Result<(), String> {
let id = tab_only(&webview)?; let id = tab_only(&webview)?;
let seen = match (report.account, report.signed_out) { let seen = match (report.account, report.signed_out) {
(Some(account), _) => Some(profiles::AccountSeen::SignedIn(account)), (Some(account), _) => Some(profiles::AccountSeen::SignedIn(account)),
@ -547,11 +316,7 @@ async fn tab_report(webview: Webview, app: AppHandle, state: State<'_, AppState>
} }
// Plugin palette commands: strings about this tab, only from a tab on x.com right now. // Plugin palette commands: strings about this tab, only from a tab on x.com right now.
if let Some(list) = report.commands { if let Some(list) = report.commands {
if webview.url().is_ok_and(|url| policy::x_origin(&url)) { waybetter_host::tab_commands::reported(&app, &webview, list)?;
let list = crate::palette_commands::validate(list)?;
let mut data = lock(&state)?;
settings::tab_commands_reported(&app, &mut data, webview.label(), &id, Some(list));
}
} }
// Only a number about this tab, only from a tab on x.com right now (column.rs). // Only a number about this tab, only from a tab on x.com right now (column.rs).
let unread = webview.url().ok().and_then(|url| crate::column::accept_unread(webview.label(), &url, report.unread)); let unread = webview.url().ok().and_then(|url| crate::column::accept_unread(webview.label(), &url, report.unread));
@ -589,12 +354,10 @@ fn as_x_url(url: &Url) -> Option<Url> {
/// Theme, custom CSS, feature flags and enabled plugins for a freshly loaded X document in tab /// Theme, custom CSS, feature flags and enabled plugins for a freshly loaded X document in tab
/// `label`. The flags, the link setting, custom CSS and the plugins are the host's page state /// `label`. The flags, the link setting, custom CSS and the plugins are the host's page state
/// (`wb::page_scripts`); X's alerts and theme go between them, as they always did. /// (`wb::page_scripts`); X's alerts and theme go between them, as they always did.
fn x_page_scripts(app: &AppHandle, state: &NativeData, label: &str) -> Vec<String> { fn x_page_scripts(app: &AppHandle, label: &str) -> Vec<String> {
let Ok(page) = wb::page_scripts(app) else { return Vec::new() }; let Ok(page) = wb::page_scripts(app) else { return Vec::new() };
let mut scripts = vec![page.features, alerts_script(&state.alerts), page.links]; let mut scripts = vec![page.features, waybetter_host::alerts_commands::script(app), page.links];
if state.theme.is_some() || state.theme_preview.is_some() || !state.theme_scopes.is_default() { scripts.extend(waybetter_host::theme_commands::page_scripts(app, label));
scripts.extend(tab_theme_scripts(app, state, label));
}
scripts.extend(page.css); scripts.extend(page.css);
scripts.extend(page.plugins); scripts.extend(page.plugins);
scripts scripts
@ -630,9 +393,7 @@ impl SiteHooks for XSite {
} }
fn tab_background(&self, app: &AppHandle, label: &str) -> Option<tauri::window::Color> { fn tab_background(&self, app: &AppHandle, label: &str) -> Option<tauri::window::Color> {
let state = app.state::<AppState>(); waybetter_host::theme_commands::tab_background(app, label)
let data = lock(&state).ok()?;
tab_background(app, &data, label)
} }
/// Legacy twitter.com links (other than login routes) load as the same path on x.com. /// Legacy twitter.com links (other than login routes) load as the same path on x.com.
@ -656,21 +417,13 @@ impl SiteHooks for XSite {
Some(wb::page(app).ok()?.settings.external_in_browser()) Some(wb::page(app).ok()?.settings.external_in_browser())
} }
/// A new document: its plugins register their palette commands again.
fn page_started(&self, app: &AppHandle, tab: &Webview) {
let Some(id) = policy::tab_id(tab.label()) else { return };
if let Ok(mut data) = app.state::<AppState>().0.lock() {
settings::tab_commands_reported(app, &mut data, tab.label(), id, None);
}
}
fn site_page_loaded(&self, app: &AppHandle, tab: &Webview, _url: &Url) { fn site_page_loaded(&self, app: &AppHandle, tab: &Webview, _url: &Url) {
let mut scripts = app let mut scripts = app
.state::<AppState>() .state::<AppState>()
.0 .0
.lock() .lock()
.map(|data| { .map(|data| {
let mut scripts = x_page_scripts(app, &data, tab.label()); let mut scripts = x_page_scripts(app, tab.label());
let redundant = data.tab_nav_redundant.get(tab.label()).copied().unwrap_or(false); let redundant = data.tab_nav_redundant.get(tab.label()).copied().unwrap_or(false);
scripts.push(pane_script(redundant)); scripts.push(pane_script(redundant));
if let Some(column) = data.tab_columns.get(tab.label()) { if let Some(column) = data.tab_columns.get(tab.label()) {
@ -690,11 +443,6 @@ impl SiteHooks for XSite {
} }
} }
/// A Google font was installed or removed: every X tab gets its theme (and font bytes) again.
fn fonts_changed(&self, app: &AppHandle) {
apply_themes(app);
}
/// What a backup and sync carry from app data (the host adds the shell's own storage). /// What a backup and sync carry from app data (the host adds the shell's own storage).
fn backup_sections(&self, app: &AppHandle) -> Result<serde_json::Map<String, serde_json::Value>, String> { fn backup_sections(&self, app: &AppHandle) -> Result<serde_json::Map<String, serde_json::Value>, String> {
settings::backup_native(app) settings::backup_native(app)
@ -715,18 +463,14 @@ impl SiteHooks for XSite {
fn dev_theme_apply(&self, app: &AppHandle, path: &std::path::Path) -> Result<(), waybetter_host::devmode::DevError> { fn dev_theme_apply(&self, app: &AppHandle, path: &std::path::Path) -> Result<(), waybetter_host::devmode::DevError> {
let theme = crate::devmode::load_theme_file(path)?; let theme = crate::devmode::load_theme_file(path)?;
if let Ok(mut data) = lock(&app.state::<AppState>()) { let _ = waybetter_host::theme_commands::set_preview(app, Some(theme));
data.theme_preview = Some(theme); waybetter_host::theme_commands::apply(app);
}
apply_themes(app);
Ok(()) Ok(())
} }
fn dev_theme_end(&self, app: &AppHandle) { fn dev_theme_end(&self, app: &AppHandle) {
if let Ok(mut data) = lock(&app.state::<AppState>()) { let _ = waybetter_host::theme_commands::set_preview(app, None);
data.theme_preview = None; waybetter_host::theme_commands::apply(app);
}
apply_themes(app);
} }
fn tab_created(&self, _app: &AppHandle) { fn tab_created(&self, _app: &AppHandle) {
@ -791,32 +535,25 @@ fn config() -> AppConfig {
updater: true, updater: true,
page_string_prefixes: crate::desktop_i18n::PAGE_PREFIXES, page_string_prefixes: crate::desktop_i18n::PAGE_PREFIXES,
home_url: Some(HOME_URL), home_url: Some(HOME_URL),
..AppConfig::new(&SITE, "wayBetter for X", &plugins::HOST).with_store(&crate::distribution::STORE).with_media().with_fonts().with_updates(&crate::desktop_update::CONFIG).with_sync().with_dev() ..AppConfig::new(&SITE, "wayBetter for X", &plugins::HOST).with_store(&crate::distribution::STORE).with_media().with_fonts().with_updates(&crate::desktop_update::CONFIG).with_sync().with_dev().with_themes(&crate::theme::THEMES).with_alerts(&alerts::ALERTS).with_vault(&VAULT)
} }
} }
/// X's drafts vault: where it lives in app data and X's rules for it (`db::RULES`).
static VAULT: waybetter_host::vault_commands::VaultConfig = waybetter_host::vault_commands::VaultConfig { file: "workspace.sqlite3", rules: &crate::db::RULES };
/// X's own state and services, after the host's (app data folder, profiles, language, the plugin /// X's own state and services, after the host's (app data folder, profiles, language, the plugin
/// store, tweak flags and settings). /// store, tweak flags and settings).
fn setup(handle: &AppHandle) -> Result<(), Box<dyn std::error::Error>> { fn setup(handle: &AppHandle) -> Result<(), Box<dyn std::error::Error>> {
let directory = handle.path().app_data_dir()?; let directory = handle.path().app_data_dir()?;
let _ = std::fs::remove_file(directory.join(LEGACY_THEME_FILE)); let _ = std::fs::remove_file(directory.join(crate::theme::LEGACY_FILE));
let store = Store::open(directory.join("workspace.sqlite3")).map_err(std::io::Error::other)?;
handle.manage(AppState(Mutex::new(NativeData { handle.manage(AppState(Mutex::new(NativeData {
store,
captures: HashMap::new(), captures: HashMap::new(),
theme: load_theme(handle),
theme_scopes: load_theme_scopes(handle),
theme_preview: None,
tab_nav_redundant: HashMap::new(), tab_nav_redundant: HashMap::new(),
tab_columns: HashMap::new(), tab_columns: HashMap::new(),
tab_commands: HashMap::new(),
alerts: read_json::<AlertSettings>(handle, ALERTS_FILE)
.and_then(|settings| settings.validated().ok())
.unwrap_or_default(),
alert_gate: AlertGate::default(), alert_gate: AlertGate::default(),
capture_failures: Throttle::new(std::time::Duration::from_secs(300), std::time::Duration::from_secs(300), 3), capture_failures: Throttle::new(std::time::Duration::from_secs(300), std::time::Duration::from_secs(300), 3),
}))); })));
desktop_popover::manage(handle);
Ok(()) Ok(())
} }
@ -828,19 +565,7 @@ pub fn run() {
setup, setup,
tauri::generate_context!(), tauri::generate_context!(),
tauri::generate_handler![ tauri::generate_handler![
draft_list,
draft_save,
draft_revisions,
draft_status,
observation_list,
data_export,
capture_draft, capture_draft,
x_set_theme,
x_theme_get,
theme_scopes_get,
theme_scopes_set,
x_preview_theme,
settings::tab_run_command,
column_configure, column_configure,
tab_report, tab_report,
drafts_picker_open, drafts_picker_open,
@ -852,8 +577,6 @@ pub fn run() {
desktop_popover::popover_insert, desktop_popover::popover_insert,
desktop_popover::popover_close, desktop_popover::popover_close,
desktop_popover::popover_open_vault, desktop_popover::popover_open_vault,
alerts_get,
alerts_set,
keyword_alert, keyword_alert,
crate::desktop_media::tab_attach_image, crate::desktop_media::tab_attach_image,
], ],

View file

@ -8,233 +8,67 @@
//! popover webview, which is local code, reads active drafts and inserts one into the tab that //! popover webview, which is local code, reads active drafts and inserts one into the tab that
//! opened it, and nothing else (capability `drafts-popover`, checks below). //! opened it, and nothing else (capability `drafts-popover`, checks below).
//! //!
//! Z-order: a new child webview is placed on top of its siblings (wry: HWND_TOP on Windows, //! The webview, its placement, its session and its z-order handling are the host's
//! addSubview on macOS). A tab webview created after the popover would cover it, so the popover //! (`waybetter_host::popover_host`); this file is what only X knows: the drafts the card shows and
//! is recreated whenever a tab webview was created since it was. //! inserts, the X tab commands and the "continue your draft?" hint.
use crate::compose; use crate::compose;
use crate::desktop::{emit_shell, resumable_draft, tab_only, tab_webview, vault_draft, vault_drafts}; use crate::desktop::{resumable_draft, tab_only, tab_webview, vault_draft, vault_drafts, emit_shell};
use crate::model::Draft; use crate::model::Draft;
use crate::policy; use crate::policy;
use crate::popover::{self, Placement, Rect}; use crate::popover::{self, Rect};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use std::collections::HashMap; use std::collections::HashMap;
use std::sync::atomic::{AtomicU64, Ordering}; use std::sync::{Mutex, MutexGuard, OnceLock};
use std::sync::{Mutex, MutexGuard};
use std::time::{Duration, Instant}; use std::time::{Duration, Instant};
use tauri::webview::NewWindowResponse; use tauri::{AppHandle, Manager, Webview};
use tauri::{AppHandle, LogicalPosition, LogicalSize, Manager, Webview, WebviewBuilder, WebviewUrl};
use url::Url; use url::Url;
use waybetter_host::popover_host::{self as host, PopoverConfig, Session};
/// Bumped whenever a tab webview is created (see the z-order note above). /// The popover is the app's own page with `?popover=drafts`; a reused one re-reads its session on
static TAB_GENERATION: AtomicU64 = AtomicU64::new(0); /// `bt-popover-open`.
/// A Drafts click that lands right after the popover closed on blur is the same click that const CONFIG: PopoverConfig = PopoverConfig { url: "index.html?popover=drafts", open_event: "bt-popover-open", ground: (13, 16, 23) };
/// blurred it: treat it as "toggle closed" instead of reopening.
const TOGGLE_WINDOW: Duration = Duration::from_millis(350);
/// `drafts_hint` answers at most this often per tab. /// `drafts_hint` answers at most this often per tab.
const HINT_INTERVAL: Duration = Duration::from_millis(400); const HINT_INTERVAL: Duration = Duration::from_millis(400);
pub(crate) fn tab_created() { pub(crate) fn tab_created() {
TAB_GENERATION.fetch_add(1, Ordering::SeqCst); host::tab_created();
} }
/// What the popover shows; `seq` identifies one opening so stale clicks from a previous one fail. /// When each tab was last asked `drafts_hint`.
#[derive(Clone, Serialize)] fn hints() -> MutexGuard<'static, HashMap<String, Instant>> {
#[serde(rename_all = "camelCase")] static HINTS: OnceLock<Mutex<HashMap<String, Instant>>> = OnceLock::new();
pub(crate) struct Session { HINTS.get_or_init(Default::default).lock().unwrap_or_else(|poisoned| poisoned.into_inner())
seq: u64,
from: String,
kind: Option<String>,
context_url: String,
placement: Placement,
#[serde(skip)]
tab_rect: Rect,
}
#[derive(Default)]
struct Popover {
label: Option<String>,
created_generation: u64,
next_label: u64,
seq: u64,
open: Option<Session>,
last_closed: Option<(String, Instant)>,
hints: HashMap<String, Instant>,
}
pub(crate) struct PopoverState(Mutex<Popover>);
pub(crate) fn manage(app: &AppHandle) {
app.manage(PopoverState(Mutex::new(Popover::default())));
}
fn state(app: &AppHandle) -> Result<MutexGuard<'_, Popover>, String> {
app.state::<PopoverState>().inner().0.lock().map_err(|_| "STATE: popover state poisoned".to_string())
}
/// Only the popover webview, on the app's own local origin.
fn popover_only(webview: &Webview) -> Result<(), String> {
let url = webview.url().map_err(|_| "FORBIDDEN: cannot verify popover origin")?;
if popover::valid_label(webview.label()) && policy::local_navigation_allowed(&url, cfg!(debug_assertions)) {
Ok(())
} else {
Err("FORBIDDEN: drafts popover required".into())
}
}
/// The open session, if `seq` names it and the caller is the current popover webview.
fn current(app: &AppHandle, webview: &Webview, seq: u64) -> Result<Session, String> {
popover_only(webview)?;
let data = state(app)?;
if data.label.as_deref() != Some(webview.label()) {
return Err("FORBIDDEN: stale popover".into());
}
match &data.open {
Some(session) if session.seq == seq => Ok(session.clone()),
_ => Err("CLOSED: the popover is not open".into()),
}
}
fn logical_rect(tab: &Webview) -> Result<Rect, String> {
// GTK child webviews report no position of their own; the host knows where it put them.
#[cfg(target_os = "linux")]
if let Some((x, y, width, height)) = waybetter_host::host::placed_rect(tab) {
return Ok(Rect::new(x, y, width, height));
}
let scale = tab.window().scale_factor().map_err(|e| format!("POPOVER: {e}"))?;
let position = tab.position().map_err(|e| format!("POPOVER: {e}"))?.to_logical::<f64>(scale);
let size = tab.size().map_err(|e| format!("POPOVER: {e}"))?.to_logical::<f64>(scale);
Ok(Rect::new(position.x, position.y, size.width, size.height))
}
fn builder(label: &str) -> WebviewBuilder<tauri::Wry> {
let builder = WebviewBuilder::new(label, WebviewUrl::App("index.html?popover=drafts".into()))
.disable_drag_drop_handler()
.focused(true)
.on_navigation(|url| policy::local_navigation_allowed(url, cfg!(debug_assertions)))
.on_new_window(|_, _| NewWindowResponse::Deny);
// The card draws its own rounded corners and shadow over X. macOS would need the private API
// for transparency; there the margin shows the popover's dark ground instead.
#[cfg(not(target_os = "macos"))]
let builder = builder.transparent(true);
#[cfg(target_os = "macos")]
let builder = builder.background_color(tauri::window::Color(13, 16, 23, 255));
builder
} }
/// Opens (or moves) the popover for tab `from` under `anchor` (the button, in the tab's viewport). /// Opens (or moves) the popover for tab `from` under `anchor` (the button, in the tab's viewport).
/// An error means the caller should fall back to the shell's picker. /// An error means the caller should fall back to the shell's picker.
pub(crate) fn open(app: &AppHandle, tab: &Webview, from: String, kind: Option<String>, context_url: String, anchor: Rect) -> Result<(), String> { pub(crate) fn open(app: &AppHandle, tab: &Webview, from: String, kind: Option<String>, context_url: String, anchor: Rect) -> Result<(), String> {
let tab_rect = logical_rect(tab)?; let mut meta = serde_json::Map::new();
let placement = popover::place(anchor, tab_rect).ok_or("POPOVER: no room in this pane")?; meta.insert("kind".into(), kind.map_or(serde_json::Value::Null, serde_json::Value::String));
let window = tab.window(); meta.insert("contextUrl".into(), context_url.into());
let generation = TAB_GENERATION.load(Ordering::SeqCst); host::open(app, &CONFIG, tab, from, meta, anchor)
let (label, fresh, session) = {
let mut data = state(app)?;
if let Some((closed_from, at)) = &data.last_closed {
if *closed_from == from && at.elapsed() < TOGGLE_WINDOW && data.open.is_none() {
data.last_closed = None;
return Ok(());
}
}
// Recreate when a tab webview may now sit above it, or when it is gone.
let existing = data.label.clone().and_then(|label| app.get_webview(&label));
let reuse = existing.filter(|_| data.created_generation == generation);
if reuse.is_none() {
if let Some(old) = data.label.take().and_then(|label| app.get_webview(&label)) {
let _ = old.close();
}
data.next_label += 1;
data.label = Some(format!("{}{}", popover::LABEL_PREFIX, data.next_label));
data.created_generation = generation;
}
data.seq += 1;
let session = Session { seq: data.seq, from, kind, context_url, placement, tab_rect };
data.open = Some(session.clone());
(data.label.clone().unwrap_or_default(), reuse.is_none(), session)
};
let rect = placement.webview;
let popover = if fresh {
window
.add_child(builder(&label), LogicalPosition::new(rect.x, rect.y), LogicalSize::new(rect.width, rect.height))
.map_err(|error| {
if let Ok(mut data) = state(app) {
data.label = None;
data.open = None;
}
format!("POPOVER: {error}")
})?
} else {
let popover = app.get_webview(&label).ok_or("POPOVER: missing webview")?;
waybetter_host::host::place_child(&popover, rect.x, rect.y, rect.width, rect.height);
// The page re-reads its session (drafts, placement) on this event.
let _ = popover.eval(&format!("window.dispatchEvent(new CustomEvent('bt-popover-open',{{detail:{}}}))", session.seq));
popover
};
// Linux: out of the window box, over the tabs (see `host::place_child`).
#[cfg(target_os = "linux")]
if fresh {
waybetter_host::host::place_child(&popover, rect.x, rect.y, rect.width, rect.height);
}
let _ = popover.show();
let _ = popover.set_focus();
Ok(())
} }
/// Hides the popover. `refocus` gives keyboard focus back to the tab (Esc, after inserting).
fn close(app: &AppHandle, refocus: bool) -> Option<Session> { fn close(app: &AppHandle, refocus: bool) -> Option<Session> {
let (session, label) = { host::close(app, refocus)
let mut data = state(app).ok()?;
let session = data.open.take()?;
data.last_closed = Some((session.from.clone(), Instant::now()));
(session, data.label.clone())
};
if let Some(popover) = label.and_then(|label| app.get_webview(&label)) {
let _ = popover.hide();
}
if refocus {
if let Some(tab) = tab_webview(app, &session.from) {
let _ = tab.set_focus();
}
}
Some(session)
} }
/// Layout changed (tabs_sync): close unless the source tab is still visible at the same place. /// Layout changed (tabs_sync): close unless the source tab is still visible at the same place.
pub(crate) fn layout_changed(app: &AppHandle, tabs: &[(String, Rect, bool)]) { pub(crate) fn layout_changed(app: &AppHandle, tabs: &[(String, Rect, bool)]) {
let stale = match state(app) { host::layout_changed(app, tabs);
Ok(data) => data.open.as_ref().is_some_and(|session| {
!tabs.iter().any(|(id, rect, visible)| {
*id == session.from
&& *visible
&& (rect.x - session.tab_rect.x).abs() < 2.0
&& (rect.y - session.tab_rect.y).abs() < 2.0
&& (rect.width - session.tab_rect.width).abs() < 2.0
&& (rect.height - session.tab_rect.height).abs() < 2.0
})
}),
Err(_) => false,
};
if stale {
close(app, false);
}
} }
/// The source tab navigated (SPA or full load): its composer is gone. /// The source tab navigated (SPA or full load): its composer is gone.
pub(crate) fn tab_navigated(app: &AppHandle, id: &str, url: &str) { pub(crate) fn tab_navigated(app: &AppHandle, id: &str, url: &str) {
let navigated = state(app) host::tab_navigated(app, id, |session| {
.map(|data| data.open.as_ref().is_some_and(|s| s.from == id && !popover::same_context(&s.context_url, url))) !session.meta.get("contextUrl").and_then(|value| value.as_str()).is_some_and(|context| popover::same_context(context, url))
.unwrap_or(false); });
if navigated {
close(app, false);
}
} }
/// The shell is raised over the tabs for one of its own overlays: the popover would sit under it. /// The shell is raised over the tabs for one of its own overlays: the popover would sit under it.
pub(crate) fn shell_raised(app: &AppHandle) { pub(crate) fn shell_raised(app: &AppHandle) {
close(app, false); host::shell_raised(app);
} }
// --------------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------------
@ -246,8 +80,7 @@ pub(crate) async fn drafts_popover_dismiss(webview: Webview, app: AppHandle) ->
let url = webview.url().map_err(|_| "FORBIDDEN: cannot verify origin")?; let url = webview.url().map_err(|_| "FORBIDDEN: cannot verify origin")?;
policy::require_capture(webview.label(), &url)?; policy::require_capture(webview.label(), &url)?;
let id = tab_only(&webview)?; let id = tab_only(&webview)?;
let mine = state(&app)?.open.as_ref().is_some_and(|session| session.from == id); if host::opened_by(&id) {
if mine {
close(&app, false); close(&app, false);
} }
Ok(()) Ok(())
@ -263,13 +96,13 @@ pub(crate) async fn drafts_hint(webview: Webview, app: AppHandle) -> Result<bool
policy::validate_context(url.as_str(), true)?; policy::validate_context(url.as_str(), true)?;
let label = webview.label().to_owned(); let label = webview.label().to_owned();
{ {
let mut data = state(&app)?; let mut hints = hints();
let now = Instant::now(); let now = Instant::now();
if data.hints.get(&label).is_some_and(|at| now.duration_since(*at) < HINT_INTERVAL) { if hints.get(&label).is_some_and(|at| now.duration_since(*at) < HINT_INTERVAL) {
return Ok(false); return Ok(false);
} }
data.hints.retain(|_, at| now.duration_since(*at) < Duration::from_secs(60)); hints.retain(|_, at| now.duration_since(*at) < Duration::from_secs(60));
data.hints.insert(label.clone(), now); hints.insert(label.clone(), now);
} }
resumable_draft(&app, &label, &url) resumable_draft(&app, &label, &url)
} }
@ -278,19 +111,14 @@ pub(crate) async fn drafts_hint(webview: Webview, app: AppHandle) -> Result<bool
// Popover commands (drafts-popover capability) // Popover commands (drafts-popover capability)
#[tauri::command] #[tauri::command]
pub(crate) async fn popover_state(webview: Webview, app: AppHandle) -> Result<Option<Session>, String> { pub(crate) async fn popover_state(webview: Webview) -> Result<Option<Session>, String> {
popover_only(&webview)?; host::session_of(&webview)
let data = state(&app)?;
if data.label.as_deref() != Some(webview.label()) {
return Ok(None);
}
Ok(data.open.clone())
} }
/// Active drafts with text, newest first. Only while this popover is open. /// Active drafts with text, newest first. Only while this popover is open.
#[tauri::command] #[tauri::command]
pub(crate) async fn popover_drafts(webview: Webview, app: AppHandle, seq: u64) -> Result<Vec<Draft>, String> { pub(crate) async fn popover_drafts(webview: Webview, app: AppHandle, seq: u64) -> Result<Vec<Draft>, String> {
current(&app, &webview, seq)?; host::current(&webview, seq)?;
let mut drafts = vault_drafts(&app)?; let mut drafts = vault_drafts(&app)?;
drafts.retain(|draft| draft.status == "active" && !draft.text.trim().is_empty()); drafts.retain(|draft| draft.status == "active" && !draft.text.trim().is_empty());
Ok(drafts) Ok(drafts)
@ -309,7 +137,7 @@ pub(crate) struct InsertRequest {
/// never a click on Post), then closes the popover and gives the tab focus. /// never a click on Post), then closes the popover and gives the tab focus.
#[tauri::command] #[tauri::command]
pub(crate) async fn popover_insert(webview: Webview, app: AppHandle, request: InsertRequest) -> Result<(), String> { pub(crate) async fn popover_insert(webview: Webview, app: AppHandle, request: InsertRequest) -> Result<(), String> {
let session = current(&app, &webview, request.seq)?; let session = host::current(&webview, request.seq)?;
if !policy::valid_identifier(&request.draft_id) { if !policy::valid_identifier(&request.draft_id) {
return Err("VALIDATION: invalid draft id".into()); return Err("VALIDATION: invalid draft id".into());
} }
@ -333,7 +161,7 @@ pub(crate) async fn popover_insert(webview: Webview, app: AppHandle, request: In
#[tauri::command] #[tauri::command]
pub(crate) async fn popover_close(webview: Webview, app: AppHandle, seq: u64, refocus: Option<bool>) -> Result<(), String> { pub(crate) async fn popover_close(webview: Webview, app: AppHandle, seq: u64, refocus: Option<bool>) -> Result<(), String> {
if current(&app, &webview, seq).is_ok() { if host::current(&webview, seq).is_ok() {
close(&app, refocus.unwrap_or(false)); close(&app, refocus.unwrap_or(false));
} }
Ok(()) Ok(())
@ -342,7 +170,7 @@ pub(crate) async fn popover_close(webview: Webview, app: AppHandle, seq: u64, re
/// Closes the popover and opens the wayBetter panel's drafts vault beside the tab. /// Closes the popover and opens the wayBetter panel's drafts vault beside the tab.
#[tauri::command] #[tauri::command]
pub(crate) async fn popover_open_vault(webview: Webview, app: AppHandle, seq: u64) -> Result<(), String> { pub(crate) async fn popover_open_vault(webview: Webview, app: AppHandle, seq: u64) -> Result<(), String> {
let session = current(&app, &webview, seq)?; let session = host::current(&webview, seq)?;
close(&app, false); close(&app, false);
#[derive(Clone, Serialize)] #[derive(Clone, Serialize)]
struct Open { struct Open {

View file

@ -1,28 +1,26 @@
//! What X adds to the framework's settings backup, workspaces, sync and developer mode (waybetter-host //! What X adds to the framework's settings backup, workspaces, sync and developer mode (waybetter-host
//! `backup_commands`, `sync_commands`, `dev_commands`, answered through `SiteHooks`): the native backup //! `backup_commands`, `sync_commands`, `dev_commands`, answered through `SiteHooks`): the native backup
//! sections, the drafts section and the import step that applies each chosen section the way its own //! sections, the drafts section and the import step that applies each chosen section the way its own
//! setter does (themes, plugins, tweaks, settings, alerts, accounts, workspaces, drafts), plus the //! setter does (themes, plugins, tweaks, settings, alerts, accounts, workspaces, drafts). A child module of `desktop` so it applies imported
//! plugin palette commands (`palette_commands.rs`). A child module of `desktop` so it applies imported
//! settings through the same state and page scripts as the individual setters. //! settings through the same state and page scripts as the individual setters.
use super::{alerts_script, apply_themes, eval_in_x_tabs, lock, AppState, NativeData, ALERTS_FILE, PROFILES_FILE, THEME_FILE, THEME_SCOPES_FILE}; use super::{eval_in_x_tabs, lock, AppState, PROFILES_FILE};
use crate::{ use crate::{
alerts::AlertSettings, alerts::AlertSettings,
backup, backup,
model::SaveDraftInput, model::SaveDraftInput,
palette_commands::{self, PaletteCommand},
plugins, plugins,
profiles::{Profile, ProfileSettings}, profiles::{Profile, ProfileSettings},
site::SITE, site::SITE,
theme::{x_default, ThemeScopes, XTheme, X_THEMES}, theme::{ThemeScopes, XTheme, X_THEMES},
workspaces::{self, WorkspaceStore}, workspaces::{self, WorkspaceStore},
}; };
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use serde_json::{json, Map, Value}; use serde_json::{json, Map, Value};
use std::path::PathBuf; use std::path::PathBuf;
use tauri::{AppHandle, Manager, State, Webview}; use tauri::{AppHandle, Manager};
use waybetter_host::app as wb; use waybetter_host::app as wb;
use waybetter_host::host::{data_file, emit_shell, shell_only, tab_webview, write_json}; use waybetter_host::host::{emit_shell, write_json};
use waybetter_host::settings::{ShellSettings, ShellSettingsInput}; use waybetter_host::settings::{ShellSettings, ShellSettingsInput};
fn app_dir(app: &AppHandle) -> Result<PathBuf, String> { fn app_dir(app: &AppHandle) -> Result<PathBuf, String> {
@ -42,55 +40,13 @@ fn shipped_plugins() -> Vec<(&'static str, &'static str)> {
shipped shipped
} }
// ---------------------------------------------------------------------------------------------
// Plugin palette commands
/// Stores what tab `label` reported (validated) and tells the shell. `None` clears (page load).
pub(super) fn tab_commands_reported(app: &AppHandle, data: &mut NativeData, label: &str, id: &str, list: Option<Vec<PaletteCommand>>) {
let list = list.unwrap_or_default();
let changed = data.tab_commands.get(label).map(Vec::as_slice).unwrap_or(&[]) != list.as_slice();
if list.is_empty() {
data.tab_commands.remove(label);
} else {
data.tab_commands.insert(label.to_owned(), list.clone());
}
if changed {
#[derive(Clone, Serialize)]
struct Commands {
id: String,
commands: Vec<PaletteCommand>,
}
emit_shell(app, palette_commands::EVENT, Commands { id: id.to_owned(), commands: list });
}
}
/// Runs a plugin's palette command in tab `id`: only a command that tab reported, only while it is
/// on x.com. The command's code runs in the page; the tab gets keyboard focus for what it opens.
#[tauri::command]
pub(super) async fn tab_run_command(webview: Webview, app: AppHandle, state: State<'_, AppState>, id: String, command: String) -> Result<(), String> {
shell_only(&webview)?;
let label = format!("{}{id}", crate::policy::TAB_PREFIX);
let known = lock(&state)?.tab_commands.get(&label).is_some_and(|list| list.iter().any(|item| item.id == command));
if !known {
return Err("VALIDATION: that tab has no such command".into());
}
let tab = tab_webview(&app, &id).ok_or("VALIDATION: no such tab")?;
if !tab.url().is_ok_and(|url| crate::policy::x_origin(&url)) {
return Err("VALIDATION: the tab is not on x.com".into());
}
let script = palette_commands::run_script(&SITE, &command)?;
let _ = tab.set_focus();
tab.eval(&script).map_err(|error| format!("TABS: {error}"))
}
// --------------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------------
// Backup // Backup
/// The `drafts` backup section (text, no ids), for the host's backup when the owner ticks "include /// The `drafts` backup section (text, no ids), for the host's backup when the owner ticks "include
/// drafts". /// drafts".
pub(super) fn backup_drafts(app: &AppHandle) -> Result<Option<Value>, String> { pub(super) fn backup_drafts(app: &AppHandle) -> Result<Option<Value>, String> {
let state = app.state::<AppState>(); let drafts = super::vault(app)?.list_drafts()?;
let drafts = lock(&state)?.store.list_drafts()?;
let list: Vec<backup::BackupDraft> = drafts let list: Vec<backup::BackupDraft> = drafts
.into_iter() .into_iter()
.take(backup::MAX_DRAFTS) .take(backup::MAX_DRAFTS)
@ -203,30 +159,14 @@ fn apply_sections(app: &AppHandle, state: &AppState, sections: &Map<String, Valu
let mut scripts: Vec<String> = Vec::new(); let mut scripts: Vec<String> = Vec::new();
let mut themes_changed = false; let mut themes_changed = false;
{ {
let mut data = lock(state)?; let _data = lock(state)?; // serializes the whole apply; the vault is locked after it
if let Some(theme) = plan.theme { if let Some(theme) = plan.theme {
let theme = theme.unwrap_or_else(x_default); waybetter_host::theme_commands::set_theme(app, theme)?;
if theme.is_empty(&X_THEMES) {
if let Some(path) = data_file(app, THEME_FILE) {
let _ = std::fs::remove_file(path);
}
data.theme = None;
} else {
write_json(app, THEME_FILE, &theme)?;
data.theme = Some(theme);
}
themes_changed = true; themes_changed = true;
out.applied.push("themes".into()); out.applied.push("themes".into());
} }
if let Some(scopes) = plan.scopes { if let Some(scopes) = plan.scopes {
if scopes.is_default() { waybetter_host::theme_commands::set_scopes(app, scopes)?;
if let Some(path) = data_file(app, THEME_SCOPES_FILE) {
let _ = std::fs::remove_file(path);
}
} else {
write_json(app, THEME_SCOPES_FILE, &scopes)?;
}
data.theme_scopes = scopes;
themes_changed = true; themes_changed = true;
} }
if let Some((enabled, files)) = plan.plugins { if let Some((enabled, files)) = plan.plugins {
@ -282,9 +222,8 @@ fn apply_sections(app: &AppHandle, state: &AppState, sections: &Map<String, Valu
out.applied.push("settings".into()); out.applied.push("settings".into());
} }
if let Some(alerts) = plan.alerts { if let Some(alerts) = plan.alerts {
write_json(app, ALERTS_FILE, &alerts)?; waybetter_host::alerts_commands::store(app, alerts)?;
scripts.push(alerts_script(&alerts)); scripts.push(waybetter_host::alerts_commands::script(app));
data.alerts = alerts;
out.applied.push("alerts".into()); out.applied.push("alerts".into());
} }
if let Some((imported, active)) = plan.accounts { if let Some((imported, active)) = plan.accounts {
@ -320,13 +259,14 @@ fn apply_sections(app: &AppHandle, state: &AppState, sections: &Map<String, Valu
out.applied.push("workspaces".into()); out.applied.push("workspaces".into());
} }
if let Some(drafts) = plan.drafts { if let Some(drafts) = plan.drafts {
let existing: Vec<(String, String)> = data.store.list_drafts()?.into_iter().map(|draft| (draft.kind, draft.text)).collect(); let mut store = super::vault(app)?;
let existing: Vec<(String, String)> = store.list_drafts()?.into_iter().map(|draft| (draft.kind, draft.text)).collect();
let mut added = 0; let mut added = 0;
for draft in drafts { for draft in drafts {
if existing.iter().any(|(kind, text)| *kind == draft.kind && *text == draft.text) { if existing.iter().any(|(kind, text)| *kind == draft.kind && *text == draft.text) {
continue; continue;
} }
let saved = data.store.save_draft(&SaveDraftInput { let saved = store.save_draft(&SaveDraftInput {
id: uuid::Uuid::new_v4().to_string(), id: uuid::Uuid::new_v4().to_string(),
account_id: "local".into(), account_id: "local".into(),
kind: draft.kind, kind: draft.kind,
@ -337,7 +277,7 @@ fn apply_sections(app: &AppHandle, state: &AppState, sections: &Map<String, Valu
source: "local".into(), source: "local".into(),
})?; })?;
if draft.status == "archived" { if draft.status == "archived" {
data.store.set_status(&saved.id, saved.revision, "archived")?; store.set_status(&saved.id, saved.revision, "archived")?;
} }
added += 1; added += 1;
} }
@ -349,7 +289,7 @@ fn apply_sections(app: &AppHandle, state: &AppState, sections: &Map<String, Valu
eval_in_x_tabs(app, &script); eval_in_x_tabs(app, &script);
} }
if themes_changed { if themes_changed {
apply_themes(app); waybetter_host::theme_commands::apply(app);
} }
Ok(out) Ok(out)
} }

View file

@ -56,15 +56,31 @@ mod tests {
/// verifies with the production key, and every X item file matches its catalog entry. /// verifies with the production key, and every X item file matches its catalog entry.
#[test] #[test]
fn committed_store_catalog_verifies_with_the_production_key() { fn committed_store_catalog_verifies_with_the_production_key() {
// catalog.json (format 2: the kinds every app knows) and, once published, catalog.v3.json (every kind).
let dir = std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("../../web/public/store"); let dir = std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("../../web/public/store");
let Ok(body) = std::fs::read(dir.join("catalog.json")) else { assert!(dir.join(CATALOG_FILE).exists(), "apps/web/public/store/catalog.json missing: run node scripts/build-store.mjs && node scripts/sign-store.mjs");
panic!("apps/web/public/store/catalog.json missing: run node scripts/build-store.mjs && node scripts/sign-store.mjs"); let legacy = verified_catalog(&dir, CATALOG_FILE);
}; assert!(legacy.items.iter().all(|item| item.kind.is_legacy()), "catalog.json lists only the kinds every app knows");
let signature = std::fs::read_to_string(dir.join("catalog.json.sig")).expect("catalog.json.sig"); if dir.join(CATALOG_FILE_NEXT).exists() {
let catalog = verify_catalog(&STORE, &body, &signature).expect("store catalog must verify: rebuild and re-sign it"); let next = verified_catalog(&dir, CATALOG_FILE_NEXT);
let old: Vec<_> = next.items.iter().filter(|item| item.kind.is_legacy()).map(|item| (item.kind, item.id.clone(), item.sha256.clone())).collect();
let same: Vec<_> = legacy.items.iter().map(|item| (item.kind, item.id.clone(), item.sha256.clone())).collect();
assert_eq!(old, same, "both files list the same items of the common kinds");
}
}
fn verified_catalog(dir: &std::path::Path, file: &str) -> Catalog {
let body = std::fs::read(dir.join(file)).unwrap_or_else(|_| panic!("{file} missing"));
let signature = std::fs::read_to_string(dir.join(format!("{file}.sig"))).unwrap_or_else(|_| panic!("{file}.sig missing"));
let catalog = verify_catalog(&STORE, &body, &signature).unwrap_or_else(|e| panic!("{file} must verify: rebuild and re-sign it ({e})"));
assert!(catalog.items.iter().any(|item| item.kind == Kind::Plugin) && catalog.items.iter().any(|item| item.kind == Kind::Theme)); assert!(catalog.items.iter().any(|item| item.kind == Kind::Plugin) && catalog.items.iter().any(|item| item.kind == Kind::Theme));
for item in &catalog.items { for item in &catalog.items {
assert!(item.is_for("x")); assert!(item.is_for("x"));
if item.kind == Kind::Builtin {
// An area plugin listed for the in-app Store: part of the app, nothing to download.
assert!(item.url.is_empty() && item.sha256.is_empty() && item.size == 0, "{}: a built-in item has no file", item.id);
continue;
}
let relative = item.url.strip_prefix(STORE.store_base).expect("store items live under the store base"); let relative = item.url.strip_prefix(STORE.store_base).expect("store items live under the store base");
let bytes = std::fs::read(dir.join(relative)).unwrap_or_else(|_| panic!("{relative} missing")); let bytes = std::fs::read(dir.join(relative)).unwrap_or_else(|_| panic!("{relative} missing"));
verify_item(item, &bytes).unwrap_or_else(|e| panic!("{relative}: {e}")); verify_item(item, &bytes).unwrap_or_else(|e| panic!("{relative}: {e}"));
@ -80,7 +96,13 @@ mod tests {
Kind::Strings => { Kind::Strings => {
validate_strings(&bytes).unwrap_or_else(|e| panic!("{relative}: {e}")); validate_strings(&bytes).unwrap_or_else(|e| panic!("{relative}: {e}"));
} }
Kind::Icons => {
let info = validate_icons(&bytes).unwrap_or_else(|e| panic!("{relative}: {e}"));
assert_eq!(info.id, item.id, "{relative}: the pack's id is the item id");
}
Kind::Builtin => unreachable!("built-in items are handled above"),
} }
} }
catalog
} }
} }

View file

@ -1,67 +1,5 @@
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
pub use waybetter_host::vault::{Draft, DraftRevision, ExportData, Observation, SaveDraftInput};
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
#[serde(rename_all = "camelCase", deny_unknown_fields)]
pub struct Draft {
pub id: String,
pub account_id: String,
pub kind: String,
pub title: String,
pub text: String,
pub context_url: String,
pub revision: i64,
pub status: String,
pub created_at: String,
pub updated_at: String,
pub source: String,
}
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
#[serde(rename_all = "camelCase", deny_unknown_fields)]
pub struct DraftRevision {
pub draft_id: String,
pub revision: i64,
pub title: String,
pub text: String,
pub context_url: String,
pub source: String,
pub created_at: String,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase", deny_unknown_fields)]
pub struct SaveDraftInput {
pub id: String,
pub account_id: String,
pub kind: String,
pub title: String,
pub text: String,
pub context_url: String,
pub expected_revision: i64,
pub source: String,
}
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
#[serde(rename_all = "camelCase", deny_unknown_fields)]
pub struct Observation {
pub id: String,
pub account_id: String,
pub user_id: String,
pub following: Option<bool>,
pub followed_by: Option<bool>,
pub observed_at: String,
pub source: String,
}
#[derive(Debug, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct ExportData {
pub version: u8,
pub exported_at: String,
pub drafts: Vec<Draft>,
pub revisions: Vec<DraftRevision>,
pub observations: Vec<Observation>,
}
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
#[serde(rename_all = "camelCase", deny_unknown_fields)] #[serde(rename_all = "camelCase", deny_unknown_fields)]

View file

@ -1,132 +1,12 @@
//! Drafts popover geometry and the "continue your draft?" hint check. Pure and headless-tested; //! Drafts popover: X's rules on top of the host's popover geometry (`waybetter_host::popover`: the card
//! placement) and the "continue your draft?" hint check. Pure and headless-tested;
//! `desktop_popover.rs` drives the native webview with it. //! `desktop_popover.rs` drives the native webview with it.
//! //!
//! The popover is a small trusted local webview layered over an X tab, right under the composer's //! The popover is a small trusted local webview layered over an X tab, right under the composer's
//! Drafts button, so X stays visible. The X page reports only the button rectangle (in its own //! Drafts button, so X stays visible.
//! viewport); native code adds the tab webview's position and keeps the card inside that tab.
use crate::model::Draft; use crate::model::Draft;
use serde::Serialize; pub use waybetter_host::popover::*;
/// Labels of the popover webview are `popover-<n>` (a fresh label whenever it is recreated, so a
/// closing webview never collides with the new one).
pub const LABEL_PREFIX: &str = "popover-";
/// Card size in logical px. The card shrinks to the room left in the tab, never below the minimum.
pub const CARD_WIDTH: f64 = 408.0;
pub const CARD_MAX_HEIGHT: f64 = 472.0;
pub const CARD_MIN_WIDTH: f64 = 260.0;
pub const CARD_MIN_HEIGHT: f64 = 200.0;
/// Prefer flipping above the button when less than this is left below it.
pub const FLIP_BELOW: f64 = 300.0;
/// Space between the button and the card (the caret lives here).
pub const GAP: f64 = 8.0;
/// Minimum distance from the tab's edges.
pub const EDGE: f64 = 8.0;
/// Transparent margin around the card for its shadow (not on the button side).
pub const SHADOW: f64 = 22.0;
/// The caret never gets closer than this to the card's corners.
const CARET_INSET: f64 = 20.0;
pub fn valid_label(label: &str) -> bool {
label
.strip_prefix(LABEL_PREFIX)
.is_some_and(|n| !n.is_empty() && n.len() <= 12 && n.bytes().all(|b| b.is_ascii_digit()))
}
#[derive(Clone, Copy, Debug, PartialEq, Serialize)]
pub struct Rect {
pub x: f64,
pub y: f64,
pub width: f64,
pub height: f64,
}
impl Rect {
pub const fn new(x: f64, y: f64, width: f64, height: f64) -> Self {
Self { x, y, width, height }
}
fn finite(&self) -> bool {
[self.x, self.y, self.width, self.height].iter().all(|v| v.is_finite())
}
fn right(&self) -> f64 {
self.x + self.width
}
fn bottom(&self) -> f64 {
self.y + self.height
}
/// Same rectangle within half a px (layout reports round differently on each side).
pub fn near(&self, other: &Rect) -> bool {
(self.x - other.x).abs() < 0.5
&& (self.y - other.y).abs() < 0.5
&& (self.width - other.width).abs() < 0.5
&& (self.height - other.height).abs() < 0.5
}
}
/// Where the popover goes. `webview` is in window coordinates (logical px); `card` is relative to
/// the webview; `caret_x` is relative to the card.
#[derive(Clone, Copy, Debug, PartialEq, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct Placement {
pub webview: Rect,
pub card: Rect,
pub above: bool,
pub caret_x: f64,
}
fn clamp(value: f64, min: f64, max: f64) -> f64 {
value.max(min).min(max.max(min))
}
/// Places the card under `anchor` (the button, in the tab's viewport), flipping above it when the
/// room below is short, always inside `tab` (the tab webview, in window coordinates). `None` when
/// the input is not finite or the tab is too small to hold a usable card.
pub fn place(anchor: Rect, tab: Rect) -> Option<Placement> {
if !anchor.finite() || !tab.finite() || tab.width <= 0.0 || tab.height <= 0.0 {
return None;
}
// The page's numbers are only a hint: keep the anchor inside its own viewport.
let ax = tab.x + clamp(anchor.x, 0.0, tab.width);
let ay = tab.y + clamp(anchor.y, 0.0, tab.height);
let aw = clamp(anchor.width, 0.0, (tab.right() - ax).min(400.0));
let ah = clamp(anchor.height, 0.0, (tab.bottom() - ay).min(200.0));
let width = CARD_WIDTH.min(tab.width - 2.0 * EDGE);
if width < CARD_MIN_WIDTH {
return None;
}
// Left edge a little left of the button so the caret sits near the card's corner.
let left = clamp(ax + aw / 2.0 - 34.0, tab.x + EDGE, tab.right() - EDGE - width);
let below = tab.bottom() - EDGE - (ay + ah + GAP);
let above_room = ay - GAP - (tab.y + EDGE);
let above = below < FLIP_BELOW.min(CARD_MAX_HEIGHT) && above_room > below;
let room = if above { above_room } else { below };
if room < CARD_MIN_HEIGHT.min(tab.height - 2.0 * EDGE).max(120.0) {
return None;
}
let height = CARD_MAX_HEIGHT.min(room);
let top = if above { ay - GAP - height } else { ay + ah + GAP };
let card = Rect::new(left, top, width, height);
// Shadow margin on every side except toward the button, clipped to the tab so the popover
// never covers the shell's address bar or another pane.
let (pad_top, pad_bottom) = if above { (SHADOW, GAP) } else { (GAP, SHADOW) };
let wx = (card.x - SHADOW).max(tab.x);
let wy = (card.y - pad_top).max(tab.y);
let wr = (card.right() + SHADOW).min(tab.right());
let wb = (card.bottom() + pad_bottom).min(tab.bottom());
let webview = Rect::new(wx, wy, wr - wx, wb - wy);
let caret_x = clamp(ax + aw / 2.0 - card.x, CARET_INSET, width - CARET_INSET);
Some(Placement {
webview,
card: Rect::new(card.x - wx, card.y - wy, width, height),
above,
caret_x,
})
}
/// `https://x.com/a/status/1/?s=20#x` and `https://x.com/A/status/1` are the same context. /// `https://x.com/a/status/1/?s=20#x` and `https://x.com/A/status/1` are the same context.
pub fn same_context(a: &str, b: &str) -> bool { pub fn same_context(a: &str, b: &str) -> bool {
@ -167,88 +47,6 @@ pub fn has_resumable_draft(drafts: &[Draft], context: &url::Url, live: impl Fn(&
mod tests { mod tests {
use super::*; use super::*;
const TAB: Rect = Rect::new(100.0, 92.0, 800.0, 700.0);
#[test]
fn labels() {
assert!(valid_label("popover-1"));
assert!(valid_label("popover-42"));
assert!(!valid_label("popover-"));
assert!(!valid_label("popover-x"));
assert!(!valid_label("tab-1"));
assert!(!valid_label("shell"));
}
#[test]
fn opens_below_the_button_in_window_coordinates() {
let p = place(Rect::new(200.0, 150.0, 34.0, 34.0), TAB).unwrap();
assert!(!p.above);
// Card: left = 100 + 200 + 17 - 34 = 283; top = 92 + 150 + 34 + 8 = 284.
let card_x = p.webview.x + p.card.x;
let card_y = p.webview.y + p.card.y;
assert_eq!((card_x, card_y), (283.0, 284.0));
assert_eq!(p.card.width, CARD_WIDTH);
assert_eq!(p.card.height, CARD_MAX_HEIGHT);
// Only a GAP-high strip above the card (no shadow margin over the button).
assert_eq!(p.card.y, GAP);
assert_eq!(p.card.x, SHADOW);
// The caret points at the button's center.
assert_eq!(card_x + p.caret_x, 100.0 + 200.0 + 17.0);
}
#[test]
fn flips_above_near_the_bottom() {
let p = place(Rect::new(200.0, 600.0, 34.0, 34.0), TAB).unwrap();
assert!(p.above);
let card_bottom = p.webview.y + p.card.y + p.card.height;
assert_eq!(card_bottom, 92.0 + 600.0 - GAP);
assert_eq!(p.webview.y + p.webview.height, card_bottom + GAP);
}
#[test]
fn stays_inside_the_tab() {
for anchor in [
Rect::new(790.0, 10.0, 34.0, 34.0),
Rect::new(-50.0, -50.0, 34.0, 34.0),
Rect::new(5_000.0, 5_000.0, 34.0, 34.0),
Rect::new(400.0, 330.0, 34.0, 34.0),
] {
let p = place(anchor, TAB).unwrap();
let w = p.webview;
assert!(w.x >= TAB.x && w.y >= TAB.y && w.right() <= TAB.right() && w.bottom() <= TAB.bottom(), "{anchor:?} -> {w:?}");
let (cx, cy) = (w.x + p.card.x, w.y + p.card.y);
assert!(cx >= TAB.x + EDGE && cx + p.card.width <= TAB.right() - EDGE, "{anchor:?}");
assert!(cy >= TAB.y + EDGE && cy + p.card.height <= TAB.bottom() - EDGE, "{anchor:?}");
assert!(p.caret_x >= CARET_INSET && p.caret_x <= p.card.width - CARET_INSET);
}
}
#[test]
fn right_edge_keeps_the_caret_on_the_button() {
let p = place(Rect::new(740.0, 100.0, 34.0, 34.0), TAB).unwrap();
let card_x = p.webview.x + p.card.x;
assert_eq!(card_x + p.card.width, TAB.right() - EDGE);
assert_eq!(card_x + p.caret_x, 100.0 + 740.0 + 17.0);
}
#[test]
fn narrow_panes_shrink_the_card() {
let tab = Rect::new(0.0, 44.0, 300.0, 700.0);
let p = place(Rect::new(10.0, 100.0, 34.0, 34.0), tab).unwrap();
assert_eq!(p.card.width, 300.0 - 2.0 * EDGE);
let short = Rect::new(0.0, 44.0, 800.0, 400.0);
let p = place(Rect::new(10.0, 60.0, 34.0, 34.0), short).unwrap();
assert!(p.card.height < CARD_MAX_HEIGHT && p.card.height >= 120.0);
}
#[test]
fn rejects_unusable_input() {
assert!(place(Rect::new(f64::NAN, 0.0, 1.0, 1.0), TAB).is_none());
assert!(place(Rect::new(0.0, 0.0, 1.0, 1.0), Rect::new(0.0, 0.0, f64::INFINITY, 10.0)).is_none());
assert!(place(Rect::new(0.0, 0.0, 1.0, 1.0), Rect::new(0.0, 0.0, 200.0, 700.0)).is_none());
assert!(place(Rect::new(0.0, 60.0, 1.0, 1.0), Rect::new(0.0, 0.0, 800.0, 140.0)).is_none());
}
#[test] #[test]
fn contexts() { fn contexts() {
assert!(same_context("https://x.com/a/status/1", "https://x.com/A/status/1/?s=20#top")); assert!(same_context("https://x.com/a/status/1", "https://x.com/A/status/1/?s=20#top"));

View file

@ -32,6 +32,16 @@ pub const PRESET_PAGE_COLORS: [(&str, &str); 13] = [
/// X's themes: `x` (X's own look) first. /// X's themes: `x` (X's own look) first.
pub static X_THEMES: ThemeSite = ThemeSite { presets: &PRESETS, page_colors: &PRESET_PAGE_COLORS }; pub static X_THEMES: ThemeSite = ThemeSite { presets: &PRESETS, page_colors: &PRESET_PAGE_COLORS };
/// Where the owner's theme choice and the account and pane themes are saved (app data).
pub const THEME_FILE: &str = "x-theme.v2.json";
pub const THEME_SCOPES_FILE: &str = "x-theme-scopes.json";
/// Pre-opt-in builds wrote this automatically; it must not keep recoloring X.
pub const LEGACY_FILE: &str = "x-theme.json";
/// What the host's theme commands need from X: its themes and the two files.
pub static THEMES: waybetter_host::theme::ThemeConfig =
waybetter_host::theme::ThemeConfig { site: &X_THEMES, file: THEME_FILE, scopes_file: THEME_SCOPES_FILE };
/// X's own look, nothing customized. /// X's own look, nothing customized.
pub fn x_default() -> XTheme { pub fn x_default() -> XTheme {
XTheme::default_for(&X_THEMES) XTheme::default_for(&X_THEMES)

View file

@ -1,7 +1,7 @@
{ {
"$schema": "https://schema.tauri.app/config/2", "$schema": "https://schema.tauri.app/config/2",
"productName": "wayBetter for X", "productName": "wayBetter for X",
"version": "1.0.1", "version": "1.0.2",
"identifier": "app.bettertwttr.desktop", "identifier": "app.bettertwttr.desktop",
"build": { "build": {
"beforeDevCommand": "bun run dev", "beforeDevCommand": "bun run dev",
@ -117,7 +117,25 @@
"macOS": { "macOS": {
"minimumSystemVersion": "11.0" "minimumSystemVersion": "11.0"
}, },
"createUpdaterArtifacts": true "createUpdaterArtifacts": true,
"fileAssociations": [
{
"ext": ["js"],
"name": "waybetter.plugin",
"description": "wayBetter plugin (.plugin.js)",
"mimeType": "text/javascript",
"role": "Viewer",
"rank": "Alternate"
},
{
"ext": ["json"],
"name": "waybetter.json",
"description": "wayBetter theme, icon pack or string pack (.json)",
"mimeType": "application/json",
"role": "Viewer",
"rank": "Alternate"
}
]
}, },
"plugins": { "plugins": {
"deep-link": { "deep-link": {

View file

@ -0,0 +1,6 @@
index drafts_updated: CREATE INDEX drafts_updated ON drafts(updated_at DESC)
table capture_usage: CREATE TABLE capture_usage ( singleton INTEGER PRIMARY KEY CHECK(singleton=1), stored_bytes INTEGER NOT NULL, revision_count INTEGER NOT NULL )
table drafts: CREATE TABLE drafts ( id TEXT PRIMARY KEY, account_id TEXT NOT NULL, kind TEXT NOT NULL CHECK(kind IN ('post','reply','quote','thread')), title TEXT NOT NULL, text TEXT NOT NULL, context_url TEXT NOT NULL, revision INTEGER NOT NULL CHECK(revision > 0), status TEXT NOT NULL CHECK(status IN ('active','archived')), created_at TEXT NOT NULL, updated_at TEXT NOT NULL, source TEXT NOT NULL CHECK(source IN ('local','capture','template')) )
table observations: CREATE TABLE observations ( id TEXT PRIMARY KEY, account_id TEXT NOT NULL, user_id TEXT NOT NULL, following INTEGER CHECK(following IN (0,1)), followed_by INTEGER CHECK(followed_by IN (0,1)), observed_at TEXT NOT NULL, source TEXT NOT NULL )
table revisions: CREATE TABLE revisions ( draft_id TEXT NOT NULL REFERENCES drafts(id), revision INTEGER NOT NULL, title TEXT NOT NULL, text TEXT NOT NULL, context_url TEXT NOT NULL, source TEXT NOT NULL, created_at TEXT NOT NULL, PRIMARY KEY(draft_id,revision) )
user_version 1

View file

@ -352,3 +352,72 @@ fn newer_schema_is_never_silently_downgraded() {
connection.pragma_update(None, "user_version", 2).unwrap(); connection.pragma_update(None, "user_version", 2).unwrap();
assert!(Store::open(&path).err().unwrap().contains("newer schema")); assert!(Store::open(&path).err().unwrap().contains("newer schema"));
} }
/// What a database file looks like after its first open: every table, index and the user version.
/// Existing users' databases are opened by whatever code serves the vault, so this must never change.
fn schema_dump(path: &std::path::Path) -> String {
let connection = rusqlite::Connection::open(path).unwrap();
let mut statement = connection.prepare("SELECT type,name,sql FROM sqlite_master WHERE sql IS NOT NULL ORDER BY type,name").unwrap();
let rows: Vec<String> = statement
.query_map([], |row| Ok(format!("{} {}: {}", row.get::<_, String>(0)?, row.get::<_, String>(1)?, row.get::<_, String>(2)?.split_whitespace().collect::<Vec<_>>().join(" "))))
.unwrap()
.map(Result::unwrap)
.collect();
let version: i64 = connection.pragma_query_value(None, "user_version", |row| row.get(0)).unwrap();
format!("{}\nuser_version {version}\n", rows.join("\n"))
}
#[test]
fn the_database_schema_is_pinned() {
let directory = tempdir().unwrap();
let path = directory.path().join("workspace.sqlite3");
drop(Store::open(&path).unwrap());
let dump = schema_dump(&path);
let expected = include_str!("fixtures/vault-schema-v1.txt").replace("\r\n", "\n");
assert_eq!(dump, expected, "the v1 schema changed: existing databases would no longer match");
}
/// One database goes through a revision conflict, an archive and a restore, a capture that forks over a
/// local edit and an export; then it is reopened and every draft, revision and exported row must be
/// exactly what was acknowledged, with nothing from the refused writes.
#[test]
fn conflict_archive_capture_fork_and_export_lose_nothing_across_reopen() {
let directory = tempdir().unwrap();
let path = directory.path().join("workspace.sqlite3");
let acknowledged;
{
let mut store = Store::open(&path).unwrap();
let first = store.save_draft(&input("keep", 0, "one")).unwrap();
let second = store.save_draft(&input("keep", first.revision, "two")).unwrap();
// A stale writer is refused and leaves no revision, no partial text.
let stale = store.save_draft(&input("keep", first.revision, "stale overwrite"));
assert!(stale.unwrap_err().starts_with("CONFLICT"));
assert!(store.save_draft(&input("missing", 5, "x")).unwrap_err().starts_with("CONFLICT"));
assert!(store.get_draft("missing").unwrap().is_none());
// Archive and restore are revisions; the text stays.
let archived = store.set_status("keep", second.revision, "archived").unwrap();
assert!(store.set_status("keep", second.revision, "active").unwrap_err().starts_with("CONFLICT"));
let restored = store.set_status("keep", archived.revision, "active").unwrap();
assert_eq!((restored.status.as_str(), restored.text.as_str()), ("active", "two"));
// A captured draft, edited locally, is never overwritten by the next capture: it forks.
let mut session = CaptureSession::default();
let ack = session.write(&mut store, capture(1, "captured first")).unwrap();
assert_eq!(ack.revision, 1);
let captured = store.list_drafts().unwrap().into_iter().find(|draft| draft.source == "capture").unwrap();
store.save_draft(&SaveDraftInput { account_id: captured.account_id.clone(), ..input(&captured.id, captured.revision, "edited by hand") }).unwrap();
session.write(&mut store, capture(2, "captured second")).unwrap();
let exported = store.export().unwrap();
assert_eq!(exported.drafts.len(), 3, "keep, the edited capture and its fork");
acknowledged = (store.list_drafts().unwrap(), exported.revisions.clone());
assert_eq!(exported.revisions.len(), store.list_drafts().unwrap().iter().map(|d| store.revisions(&d.id).unwrap().len()).sum::<usize>());
let json = serde_json::to_value(&exported).unwrap();
assert!(json["drafts"][0].get("accountId").is_some() && json["revisions"][0].get("draftId").is_some() && json.get("exportedAt").is_some());
}
let mut reopened = Store::open(&path).unwrap();
assert_eq!(reopened.list_drafts().unwrap(), acknowledged.0);
assert_eq!(reopened.export().unwrap().revisions, acknowledged.1);
let keep = reopened.revisions("keep").unwrap();
let texts: Vec<&str> = keep.iter().rev().map(|revision| revision.text.as_str()).collect();
assert_eq!(texts, ["one", "two", "two", "two"], "write, write, archive, restore; never the refused overwrite");
assert!(reopened.get_draft("keep").unwrap().unwrap().text != "stale overwrite");
}

View file

@ -132,7 +132,7 @@ fn remote_capabilities_cannot_reach_the_vault() {
"allow-tab-insert-text", "allow-alerts-get", "allow-alerts-set", "allow-draft-list", "allow-draft-revisions", "allow-tab-insert-text", "allow-alerts-get", "allow-alerts-set", "allow-draft-list", "allow-draft-revisions",
// Google Fonts downloads (network), account/pane themes and the builder preview: shell only. // Google Fonts downloads (network), account/pane themes and the builder preview: shell only.
"allow-gfonts-installed", "allow-gfonts-install", "allow-gfonts-remove", "allow-gfonts-faces", "allow-gfonts-preview", "allow-gfonts-installed", "allow-gfonts-install", "allow-gfonts-remove", "allow-gfonts-faces", "allow-gfonts-preview",
"allow-theme-scopes-get", "allow-theme-scopes-set", "allow-x-preview-theme", "allow-theme-scopes-get", "allow-theme-scopes-set", "allow-theme-preview",
// Installing themes/plugins (links, dropped files, the signed store; owner-approved 2026-09-28): // Installing themes/plugins (links, dropped files, the signed store; owner-approved 2026-09-28):
// only the shell, after its confirmation screen. X tabs and web pages cannot install anything. // only the shell, after its confirmation screen. X tabs and web pages cannot install anything.
"allow-install-pending", "allow-install-stage-link", "allow-install-stage-file", "allow-install-cancel", "allow-install-pending", "allow-install-stage-link", "allow-install-stage-file", "allow-install-cancel",
@ -302,13 +302,12 @@ fn host_commands_keep_their_callers() {
// X's own: vault, settings, themes, installs, backups, sync, dev mode, updates are the shell's. // X's own: vault, settings, themes, installs, backups, sync, dev mode, updates are the shell's.
for command in [ for command in [
"draft_list", "draft_save", "draft_revisions", "draft_status", "observation_list", "data_export", "draft_list", "draft_save", "draft_revisions", "draft_status", "observation_list", "data_export",
"x_set_theme", "x_theme_get", "theme_scopes_get", "theme_scopes_set", "x_preview_theme",
"gfonts_installed", "gfonts_install", "gfonts_remove", "gfonts_faces", "gfonts_preview", "gfonts_installed", "gfonts_install", "gfonts_remove", "gfonts_faces", "gfonts_preview",
"tab_run_command", "workspaces_get", "workspaces_set", "backup_collect", "backup_export_file", "backup_open_file", "backup_apply", "tab_run_command", "workspaces_get", "workspaces_set", "backup_collect", "backup_export_file", "backup_open_file", "backup_apply",
"sync_status", "sync_choose_folder", "sync_unlock", "sync_lock", "sync_disable", "sync_configure", "sync_push", "sync_check", "sync_open", "sync_mark_pulled", "sync_status", "sync_choose_folder", "sync_unlock", "sync_lock", "sync_disable", "sync_configure", "sync_push", "sync_check", "sync_open", "sync_mark_pulled",
"dev_get", "dev_set", "dev_pick_theme", "dev_clear_theme", "dev_reload_plugin", "dev_report_error", "dev_get", "dev_set", "dev_pick_theme", "dev_clear_theme", "dev_reload_plugin", "dev_report_error",
"plugins_list", "plugin_set_enabled", "plugins_open_folder", "plugin_remove", "plugins_list", "plugin_set_enabled", "plugins_open_folder", "plugin_remove",
"install_pending", "install_stage_link", "install_stage_file", "install_cancel", "install_commit", "install_records", "install_forget", "store_catalog", "store_stage", "install_pending", "install_stage_link", "install_stage_file", "install_stage_opened", "install_cancel", "install_commit", "install_records", "install_forget", "store_catalog", "store_stage",
"custom_css_get", "custom_css_set", "features_get", "features_set", "mode_get", "mode_set", "settings_get", "settings_set", "column_configure", "custom_css_get", "custom_css_set", "features_get", "features_set", "mode_get", "mode_set", "settings_get", "settings_set", "column_configure",
"update_status", "update_check", "apply_update", "app_ready", "tab_insert_text", "alerts_get", "alerts_set", "update_status", "update_check", "apply_update", "app_ready", "tab_insert_text", "alerts_get", "alerts_set",
"media_get", "media_set", "gallery_add_folder", "gallery_list", "gallery_thumb", "clip_list", "clip_thumb", "clip_remove", "tab_attach_image", "media_get", "media_set", "gallery_add_folder", "gallery_list", "gallery_thumb", "clip_list", "clip_thumb", "clip_remove", "tab_attach_image",
@ -320,8 +319,14 @@ fn host_commands_keep_their_callers() {
caps.assert_tab_only(command); caps.assert_tab_only(command);
} }
let desktop = include_str!("../src/desktop.rs"); let desktop = include_str!("../src/desktop.rs");
for command in ["draft_list", "draft_save", "x_set_theme", "tab_insert_text", "alerts_set"] { assert_guarded(desktop, "tab_insert_text", "shell_only(&webview)?");
assert_guarded(desktop, command, "shell_only(&webview)?"); // The vault commands are the host's: shell-only in the capability files and each checking its caller
// first; X's own handler no longer has them, and X turns the vault on with its rules.
caps.assert_shell_only_group(waybetter_host::commands::VAULT);
waybetter_host::testkit::assert_vault_guards();
assert!(desktop.contains(".with_vault("), "the app enables the host's vault");
for command in waybetter_host::commands::VAULT {
assert!(!desktop.contains(&format!("fn {command}(")), "{command} is served by the host only");
} }
// The updater commands are the shell's too, each checking its caller first; `update_check` runs the // The updater commands are the shell's too, each checking its caller first; `update_check` runs the
// timer's own check once (no other endpoint), and tabs have no updater command at all. // timer's own check once (no other endpoint), and tabs have no updater command at all.
@ -368,6 +373,14 @@ fn install_store_media_and_font_commands_are_shell_only() {
waybetter_host::testkit::assert_dev_guards(); waybetter_host::testkit::assert_dev_guards();
assert!(include_str!("../src/desktop.rs").contains(".with_dev()"), "the app enables developer mode"); assert!(include_str!("../src/desktop.rs").contains(".with_dev()"), "the app enables developer mode");
assert!(include_str!("../src/desktop.rs").contains(".with_sync()"), "the app enables sync"); assert!(include_str!("../src/desktop.rs").contains(".with_sync()"), "the app enables sync");
// Site themes too (AppConfig::with_themes): the framework's commands; X only names its built-in themes.
caps.assert_shell_only_group(waybetter_host::commands::THEME);
waybetter_host::testkit::assert_theme_guards();
assert!(include_str!("../src/desktop.rs").contains(".with_themes(&crate::theme::THEMES)"), "the app configures its themes");
// The keyword alert settings (AppConfig::with_alerts): the framework's commands; the hit and its notification are X's.
caps.assert_shell_only_group(waybetter_host::commands::ALERTS);
waybetter_host::testkit::assert_alerts_guards();
assert!(include_str!("../src/desktop.rs").contains(".with_alerts(&alerts::ALERTS)"), "the app configures its alerts");
// Google Fonts too (AppConfig::with_fonts). // Google Fonts too (AppConfig::with_fonts).
caps.assert_shell_only_group(waybetter_host::commands::GFONTS); caps.assert_shell_only_group(waybetter_host::commands::GFONTS);
waybetter_host::testkit::assert_fonts_guards(); waybetter_host::testkit::assert_fonts_guards();
@ -385,3 +398,33 @@ fn install_store_media_and_font_commands_are_shell_only() {
assert!(settings.contains("app_id: \"x\"") && settings.contains("allowed_hosts: DEFAULT_HOSTS") && settings.contains("include_str!(\"../keys/store.pub\")")); assert!(settings.contains("app_id: \"x\"") && settings.contains("allowed_hosts: DEFAULT_HOSTS") && settings.contains("include_str!(\"../keys/store.pub\")"));
assert!(include_str!("../src/desktop.rs").contains(".with_store(&crate::distribution::STORE)"), "the app configures the store"); assert!(include_str!("../src/desktop.rs").contains(".with_store(&crate::distribution::STORE)"), "the app configures the store");
} }
/// The popover's webview and session are the host's; X's commands reached by the popover each check
/// their caller first (the popover webview with the open session), and inserting a draft only
/// focuses the tab and types (`compose` scripts), never clicks Post.
#[test]
fn popover_commands_check_their_caller_and_never_post() {
use waybetter_host::testkit::assert_guarded;
let source = include_str!("../src/desktop_popover.rs");
assert_guarded(source, "popover_state", "host::session_of(&webview)");
for command in ["popover_drafts", "popover_insert", "popover_open_vault"] {
assert_guarded(source, command, "host::current(&webview,");
}
// popover_close only acts for the current popover, and does nothing otherwise.
let close = &source[source.find("fn popover_close(").unwrap()..];
let close = &close[..close.find("
}").unwrap()];
assert!(close.contains("host::current(&webview, seq).is_ok()"));
let insert = &source[source.find("fn popover_insert(").unwrap()..];
let insert = &insert[..insert.find("
}").unwrap()];
assert!(insert.contains("compose::insert_script") && insert.contains("compose::append_script"));
assert!(!insert.contains("click") && !insert.contains("submit") && !insert.contains("Post"), "popover_insert never posts");
assert!(insert.contains("policy::x_origin(&url)"), "only into X tabs");
// The host's popover check: only a `popover-<n>` webview on the app's own local origin.
let host = include_str!("../../../../waybetter/crates/waybetter-host/src/popover_host.rs");
let only = &host[host.find("pub fn popover_only(").unwrap()..];
let only = &only[..only.find("
}").unwrap()];
assert!(only.contains("popover::valid_label(webview.label())") && only.contains("local_navigation_allowed"));
}

View file

@ -18,11 +18,12 @@ export function accountHue(handle: string): number {
const CSS = ` const CSS = `
[${CHIP_ATTR}] { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; min-width: 0; box-sizing: border-box; [${CHIP_ATTR}] { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; min-width: 0; box-sizing: border-box;
padding: 2px 9px 2px 7px; border-radius: 9999px; white-space: nowrap; color: rgb(113, 118, 123); padding: 2px 9px 2px 7px; border-radius: 9999px; white-space: nowrap; color: var(--wb-muted, rgb(113, 118, 123));
border: 1px solid hsl(var(--bt-compose-hue) 70% 50% / .4); background: hsl(var(--bt-compose-hue) 70% 50% / .1); } border: 1px solid hsl(var(--bt-compose-hue) 70% 50% / .4); background: hsl(var(--bt-compose-hue) 70% 50% / .1); }
[${CHIP_ATTR}] > i { flex: none; width: 7px; height: 7px; border-radius: 50%; background: hsl(var(--bt-compose-hue) 70% 50%); } [${CHIP_ATTR}] > i { flex: none; width: 7px; height: 7px; border-radius: 50%; background: hsl(var(--bt-compose-hue) 70% 50%); }
[${CHIP_ATTR}] > span { overflow: hidden; text-overflow: ellipsis; } [${CHIP_ATTR}] > span { overflow: hidden; text-overflow: ellipsis; }
[${CHIP_ATTR}] b { font-weight: 700; color: hsl(var(--bt-compose-hue) 70% 50%); } /* The handle in the theme's text color (a 50%-lightness hue read 1.6:1 on light themes); the account's hue stays in the dot and the edge. */
[${CHIP_ATTR}] b { font-weight: 700; color: var(--wb-text, hsl(var(--bt-compose-hue) 70% 50%)); }
`; `;
export const postingAs: FeatureModule<PluginApi> = { export const postingAs: FeatureModule<PluginApi> = {

View file

@ -294,39 +294,6 @@ export function formatFullCount(value: number, locale?: string): string {
// -- Runtime: DOM patching + observers (installFeatures) -- // -- Runtime: DOM patching + observers (installFeatures) --
const WORDING_MAP: Record<string, string> = { Post: 'Tweet', Posts: 'Tweets', Repost: 'Retweet', Reposts: 'Retweets' };
const WORDING_REVERSE: Record<string, string> = Object.fromEntries(Object.entries(WORDING_MAP).map(([x, twitter]) => [twitter, x]));
const RETEXT_ATTR = 'data-bt-retext';
const TEXT_NODE = 3;
/** Retexts X's own label text nodes in place. Editing the node (not `span.textContent`, which
* swaps in a new node) keeps React owning it, so X's later updates (e.g. the label emptied when the
* nav collapses to icon-only) still land instead of leaving a stale "Tweet" behind. */
function retextExact(el: Element | null | undefined) {
if (!el) return;
for (const span of el.querySelectorAll('span')) {
for (const node of Array.from(span.childNodes)) {
const text = node.nodeType === TEXT_NODE ? node.nodeValue : null;
if (text == null || !Object.hasOwn(WORDING_MAP, text)) continue;
node.nodeValue = WORDING_MAP[text]!;
span.setAttribute(RETEXT_ATTR, '');
}
}
}
/** Puts X's own wording back on labels `retextExact` changed. */
function restoreText(root: ParentNode | null | undefined) {
if (!root) return;
for (const span of root.querySelectorAll(`[${RETEXT_ATTR}]`)) {
for (const node of Array.from(span.childNodes)) {
const text = node.nodeType === TEXT_NODE ? node.nodeValue : null;
if (text != null && Object.hasOwn(WORDING_REVERSE, text)) node.nodeValue = WORDING_REVERSE[text]!;
}
span.removeAttribute(RETEXT_ATTR);
}
}
function buildFaviconDataUrl(brush: boolean): string { function buildFaviconDataUrl(brush: boolean): string {
if (brush) return LOGO_PNG; if (brush) return LOGO_PNG;
const svg = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="${THEME_BLUE}" d="${TWITTER_LOGO_PATH}"/></svg>`; const svg = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="${THEME_BLUE}" d="${TWITTER_LOGO_PATH}"/></svg>`;
@ -410,19 +377,6 @@ export function installFeatures(target: Window = window): FeatureHandle {
} catch { /* degrade silently */ } } catch { /* degrade silently */ }
}; };
const patchWording = () => {
try {
retextExact(doc.querySelector('button[data-testid^="tweetButton"]'));
// Compact nav: X renders an icon-only round button (svg + empty label). Leave it as X drew it.
const sideNav = doc.querySelector('[data-testid="SideNav_NewTweet_Button"]');
if (sideNav?.querySelector('svg')) restoreText(sideNav);
else retextExact(sideNav);
for (const item of doc.querySelectorAll('[data-testid="retweetConfirm"], [data-testid="repostConfirm"], [data-testid="unretweetConfirm"], [data-testid="unrepostConfirm"]')) {
retextExact(item);
}
} catch { /* degrade silently */ }
};
const patchTitle = () => { const patchTitle = () => {
if (!config.twitterWording) return; if (!config.twitterWording) return;
try { try {
@ -448,10 +402,8 @@ export function installFeatures(target: Window = window): FeatureHandle {
syncRoute(); syncRoute();
patchLogo(); patchLogo();
if (faviconDirty) { faviconDirty = false; patchFavicon(); } if (faviconDirty) { faviconDirty = false; patchFavicon(); }
if (config.twitterWording) patchWording();
else restoreText(doc);
}; };
// Shared body observer + frame (domHub.ts). Route, logo and wording also apply on chat pages. // Shared body observer + frame (domHub.ts). Route and logo also apply on chat pages (the wording is a string pack now; the title suffix stays here).
const watch = watchDom(win, runPatches); const watch = watchDom(win, runPatches);
const schedule = watch.schedule; const schedule = watch.schedule;

View file

@ -161,7 +161,7 @@ const OWN = { author: AUTHOR, license: 'own', source: 'drawn for wayBetter for X
const documents = [ const documents = [
{ id: 'wb-line', name: 'Line', description: 'Thin line icons; stroke and caps follow the theme.', ...OWN, style: { stroke: 1.75, cap: 'round', join: 'round', scale: 1 }, glyphs: LINE }, { id: 'wb-line', name: 'Line', description: 'Thin line icons; stroke and caps follow the theme.', ...OWN, style: { stroke: 1.75, cap: 'round', join: 'round', scale: 1 }, glyphs: LINE },
{ id: 'wb-classic', name: 'Classic', description: 'Solid glyphs in the manner of 2012: a star to like, square-loop arrows to repost.', ...OWN, style: { stroke: 1.75, cap: 'round', join: 'round', scale: 0.92 }, glyphs: CLASSIC, symbols: { like: 'star' } }, { id: 'wb-classic', name: 'Classic', description: 'Solid glyphs in the manner of 2012: a star to like, square-loop arrows to repost.', ...OWN, style: { stroke: 1.75, cap: 'round', join: 'round', scale: 0.92 }, glyphs: CLASSIC, symbols: { like: 'star' } },
{ id: 'wb-aero', name: 'Aero', description: 'Glossy colored glyphs with a sheen.', ...OWN, style: { stroke: 1.75, cap: 'round', join: 'round', scale: 1 }, glyphs: AERO }, { id: 'wb-aero', name: 'Aero', description: 'Glossy colored glyphs with a vertical sheen, in the manner of 2008.', ...OWN, style: { stroke: 1.75, cap: 'round', join: 'round', scale: 1 }, glyphs: AERO },
{ id: 'wb-pixel', name: 'Pixel 98', description: 'Sixteen-pixel icons in the manner of a 1998 desktop. Our own drawings.', ...OWN, style: { stroke: 1.75, cap: 'square', join: 'miter', scale: 1 }, glyphs: PIXEL }, { id: 'wb-pixel', name: 'Pixel 98', description: 'Sixteen-pixel icons in the manner of a 1998 desktop. Our own drawings.', ...OWN, style: { stroke: 1.75, cap: 'square', join: 'miter', scale: 1 }, glyphs: PIXEL },
]; ];

View file

@ -0,0 +1,400 @@
// Retro icon packs for the wayBetter Store (not bundled in the app: they are installed from the
// Store, the same way as any pack). Both are our own drawings; nothing is traced or extracted from
// Windows, from X or from any icon archive (the Windows icon archives on the web carry Microsoft's
// copyright, and the plan bans them). The look is the idea of the era, drawn from scratch.
// retro-98 16 by 16 pixel art on the 98 desktop palette: black outline, silver, navy, teal.
// retro-xp vector glyphs in the manner of 2001: gel fills, a dark edge, a lit top.
// Both draw every name X's left rail uses (home .. compose, and the .active forms) and the action bar.
// Generated into store/x/icons/<id>/ by scripts/build-store-icons.mjs.
import { sanitizeIconPack, type IconGlyph, type IconName, type IconPack } from '../../../../../waybetter/packages/runtime/src/themeIcons.ts';
// ---------------------------------------------------------------------------------------------
// retro-98: rows of 16 letters, `.` is transparent
const P98: Record<string, string> = {
k: '#000000', w: '#ffffff', s: '#c0c0c0', g: '#808080', n: '#000080', b: '#0000ff', c: '#008080', t: '#00ffff',
y: '#ffff00', d: '#808000', r: '#ff0000', m: '#800000', p: '#ff80c0', e: '#00a000', o: '#ff8000', u: '#800080',
};
/** Rows to a glyph of 1.5px squares on the 24px box; same-colored cells are merged into rectangles; the outline is drawn last. */
export function rasterGlyph(name: string, rows: readonly string[]): IconGlyph {
if (rows.length !== 16) throw new Error(`${name}: ${rows.length} rows, 16 needed`);
rows.forEach((row, y) => {
if (row.length !== 16) throw new Error(`${name}: row ${y} has ${row.length} cells, 16 needed (${row})`);
for (const ch of row) if (ch !== '.' && !P98[ch]) throw new Error(`${name}: row ${y} has an unknown color "${ch}"`);
});
const taken = rows.map(() => new Array<boolean>(16).fill(false));
const byColor = new Map<string, string[]>();
const f = (n: number) => +(n * 1.5).toFixed(1);
for (let y = 0; y < 16; y++) {
for (let x = 0; x < 16; x++) {
const key = rows[y]![x]!;
if (key === '.' || taken[y]![x]) continue;
let w = 1;
while (x + w < 16 && rows[y]![x + w] === key && !taken[y]![x + w]) w++;
let h = 1;
grow: while (y + h < 16) {
for (let i = 0; i < w; i++) if (rows[y + h]![x + i] !== key || taken[y + h]![x + i]) break grow;
h++;
}
for (let j = 0; j < h; j++) for (let i = 0; i < w; i++) taken[y + j]![x + i] = true;
const list = byColor.get(key) ?? [];
list.push(`M${f(x)} ${f(y)}h${f(w)}v${f(h)}h-${f(w)}z`);
byColor.set(key, list);
}
}
const keys = [...byColor.keys()].sort((a, b) => (a === 'k' ? 1 : 0) - (b === 'k' ? 1 : 0));
if (keys.length > 6) throw new Error(`${name}: ${keys.length} colors, a glyph has 6 layers at most`);
return { layers: keys.map(key => ({ d: byColor.get(key)!.join(''), fill: P98[key]! })) };
}
const ART98: Record<string, readonly string[]> = {
home: [
'................', '.......kk.......', '......krrk......', '.....krrrrk.....', '....krrrrrrk....', '...krrrrrrrrk...', '..krrrrrrrrrrk..', '.kkkkkkkkkkkkkk.',
'..kwwwwwwwwwwk..', '..kwbbbwwbbbwk..', '..kwbbbwwbbbwk..', '..kwwwwkkkkwwk..', '..kwwwwkmmkwwk..', '..kwwwwkmmkwwk..', '..kkkkkkkkkkkk..', '................',
],
search: [
'................', '...kkkkkk.......', '..kwwwwwwk......', '.kwwwwwwwwk.....', '.kwtwwwwwwk.....', '.kwtwwwwwwk.....', '.kwwwwwwwwk.....', '.kwwwwwwwwk.....',
'..kwwwwwwkk.....', '...kkkkkksgk....', '........kgggk...', '.........kgggk..', '..........kgggk.', '...........kgk..', '............k...', '................',
],
bell: [
'................', '.......kk.......', '......kyyk......', '.....kywyyk.....', '....kywyyyyk....', '....kywyyyyk....', '....kyyyyyyk....', '...kyyyyyyyyk...',
'...kyyyyyyyyk...', '..kyyyyyyyyyyk..', '..kddddddddddk..', '..kkkkkkkkkkkk..', '.....kkddkk.....', '......kddk......', '.......kk.......', '................',
],
mail: [
'................', '................', '.kkkkkkkkkkkkkk.', '.kwwwwwwwwwwwwk.', '.kkwwwwwwwwwwkk.', '.kwkwwwwwwwwkwk.', '.kwwkwwwwwwkwwk.', '.kwwwkwwwwkwwwk.',
'.kwwwwkwwkwwwwk.', '.kwwwwwkkwwwwwk.', '.kwwwwwwwwwwwwk.', '.kssssssssssssk.', '.kssssssssssssk.', '.kkkkkkkkkkkkkk.', '................', '................',
],
monitor: [
'................', '..kkkkkkkkkkkk..', '..kssssssssssk..', '..ksnnnnnnnnsk..', '..ksnttnnnnnsk..', '..ksnttnnnwnsk..', '..ksnnnnnwwwsk..', '..ksnnnnnnwnsk..',
'..ksnnnnnnnnsk..', '..kssssssssssk..', '..kkkkkggkkkkk..', '......kssk......', '....kkssssk.....', '...kssssssssk...', '...kkkkkkkkkk...', '................',
],
folder: [
'................', '................', '..kkkkk.........', '.kyyyyyk........', '.kyyyyyykkkkkkk.', '.kywwwwwwwwwwyk.', '.kywyyyyyyyyyyk.', '.kyyyyyyyyyyyyk.',
'.kyyyyyyyyyyyyk.', '.kyyyyyyyyyyyyk.', '.kyyyyyyyyyyyyk.', '.kyyyyyyyyyyyyk.', '.kddddddddddddk.', '.kkkkkkkkkkkkkk.', '................', '................',
],
notepad: [
'................', '..kkkkkkkkkkk...', '..kwwwwwwwwwk...', '..kwkkkkkkkwk...', '..kwwwwwwwwwk...', '..kwkkkkkkkwk...', '..kwwwwwwwwwk...', '..kwkkkkkkwwk...',
'..kwwwwwwwwwk...', '..kwkkkkkkkwk...', '..kwwwwwwwwwk...', '..kwkkkkwwwwk...', '..kwwwwwwwwwk...', '..kkkkkkkkkkk...', '................', '................',
],
people: [
'................', '...kkkk..kkkk...', '..kyyyyk.kyyyk..', '..kykkyk.kkyyk..', '..kyyyyk.kyyyk..', '...kkkk..kkkk...', '..kccccck.kuuuk.', '.kcccccccckuuuuk',
'.kccccccckkuuuuk', '.kcccccccckuuuuk', '.kkkkkkkkkkkkkkk', '................', '................', '................', '................', '................',
],
badge: [
'................', '.......kk.......', '......kyyk......', '.....kyyyyk.....', '.kkkkkywyykkkk..', '.kyyyyywyyyyyk..', '..kyyyyyyyyyk...', '...kyyyyyyyk....',
'...kyyywyyyk....', '..kyyywwwyyyk...', '..kyyywyywyyk...', '.kyyyk..kyyyk...', '.kkkk....kkkk...', '................', '................', '................',
],
person: [
'................', '......kkkk......', '.....kyyyyk.....', '....kyyyyyyk....', '....kykyykyk....', '....kyyyyyyk....', '....kyykkyyk....', '.....kyyyyk.....',
'....kkkkkkkk....', '...kcccccccck...', '..kcccccccccck..', '..kcccccccccck..', '..kcccccccccck..', '..kkkkkkkkkkkk..', '................', '................',
],
// Three white dots in a black frame: the frame reads on the silver desktop, the white on a dark one.
dots: [
'................', '................', '................', '................', '................', '.kkkk.kkkk.kkkk.', '.kwwk.kwwk.kwwk.', '.kwwk.kwwk.kwwk.',
'.kkkk.kkkk.kkkk.', '................', '................', '................', '................', '................', '................', '................',
],
pencil: [
'............kk..', '...........kmmk.', '..........kyymk.', '.........kyyyk..', '........kyyyk...', '.......kyyyk....', '......kyyyk.....', '.....kyyyk......',
'....kyyyk.......', '...kdyyk........', '...kddk.........', '..kwwk..........', '..kkkk..........', '................', '................', '................',
],
balloon: [
'................', '..kkkkkkkkkkkk..', '.kwwwwwwwwwwwwk.', '.kwwwwwwwwwwwwk.', '.kwwkkkkkkkkwwk.', '.kwwwwwwwwwwwwk.', '.kwwkkkkkkwwwwk.', '.kwwwwwwwwwwwwk.',
'..kkkkwwkkkkkk..', '....kwwk........', '....kwk.........', '....kk..........', '................', '................', '................', '................',
],
// Off: white arrows like the other outlined actions (X draws repost muted until it is on); on: green.
arrows: [
'................', '.....k..........', '....kwk.........', '...kwwwkkkkkk...', '..kwwwwwwwwwwk..', '...kwwwkkkkkwk..', '....kwk.....kwk.', '.....k......kwk.',
'.kwk......k.....', '.kwk.....kwk....', '.kwkkkkkkwwwk...', '..kwwwwwwwwwwk..', '...kkkkkwwwk....', '.........kwk....', '..........k.....', '................',
],
arrowsOn: [
'................', '.....k..........', '....kek.........', '...keeekkkkkk...', '..keeeeeeeeeek..', '...keeekkkkkek..', '....kek.....kek.', '.....k......kek.',
'.kek......k.....', '.kek.....kek....', '.kekkkkkkeeek...', '..keeeeeeeeeek..', '...kkkkkeeek....', '.........kek....', '..........k.....', '................',
],
heart: [
'................', '..kkk.....kkk...', '.kpppk...kpppk..', 'kpwppkkkkpppppk.', 'kpwppppppppppk..', 'kppppppppppppk..', 'kppppppppppppk..', '.kppppppppppk...',
'..kppppppppk....', '...kppppppk.....', '....kppppk......', '.....kppk.......', '......kk........', '................', '................', '................',
],
heartOn: [
'................', '..kkk.....kkk...', '.krrrk...krrrk..', 'krwrrrkkkrrrrrk.', 'krwrrrrrrrrrrk..', 'krrrrrrrrrrrrk..', 'krrrrrrrrrrrrk..', '.krrrrrrrrrrk...',
'..krrrrrrrrk....', '...krrrrrrk.....', '....krrrrk......', '.....krrk.......', '......kk........', '................', '................', '................',
],
bars: [
'................', '................', '...........kkk..', '...........kbk..', '...........kbk..', '.......kkk.kbk..', '.......kbk.kbk..', '.......kbk.kbk..',
'...kkk.kbk.kbk..', '...kbk.kbk.kbk..', '...kbk.kbk.kbk..', '...kbk.kbk.kbk..', '..kkkkkkkkkkkkk.', '................', '................', '................',
],
share: [
'.......kk.......', '......kwwk......', '.....kwwwwk.....', '....kwwwwwwk....', '...kkkwwwwkkk...', '.....kwwwwk.....', '.....kwwwwk.....', '.....kwwwwk.....',
'..kk.kkkkkk.kk..', '..ks........sk..', '..ks........sk..', '..kssssssssssk..', '..kkkkkkkkkkkk..', '................', '................', '................',
],
picture: [
'................', '.kkkkkkkkkkkkkk.', '.kttttttttyyttk.', '.kttttttttyyttk.', '.kttttttttttttk.', '.ktttttteettttk.', '.kttttteeeetttk.', '.kttteeeeeeettk.',
'.kteeeeeeeeeetk.', '.keeeeddeeeeeek.', '.keeeeeeeeeeeek.', '.kkkkkkkkkkkkkk.', '................', '................', '................', '................',
],
bookmark: [
'................', '...kkkkkkkkkk...', '...kwwwwwwwwk...', '...kwwwwwwwwk...', '...kwwwwwwwwk...', '...kwwwwwwwwk...', '...kwwwwwwwwk...', '...kwwwwwwwwk...',
'...kwwwwwwwwk...', '...kwwwwwwwwk...', '...kwwwkkwwwk...', '...kwwkk.kwwk...', '...kwkk...kwk...', '...kkk.....kk...', '................', '................',
],
bookmarkOn: [
'................', '...kkkkkkkkkk...', '...kbbbbbbbbk...', '...kbwbbbbbbk...', '...kbwbbbbbbk...', '...kbbbbbbbbk...', '...kbbbbbbbbk...', '...kbbbbbbbbk...',
'...kbbbbbbbbk...', '...kbbbbbbbbk...', '...kbbbkkbbbk...', '...kbbkk.kbbk...', '...kbkk...kbk...', '...kkk.....kk...', '................', '................',
],
gif: [
'................', '................', 'kkkkkkkkkkkkkkkk', 'knnnnnnnnnnnnnnk', 'knnnnnnnnnnnnnnk', 'knnwwwnwwwnwwwnk', 'knnwnnnnwnnwnnnk', 'knnwnnnnwnnwwnnk',
'knnwnwnnwnnwnnnk', 'knnwwwnwwwnwnnnk', 'knnnnnnnnnnnnnnk', 'knnnnnnnnnnnnnnk', 'kkkkkkkkkkkkkkkk', '................', '................', '................',
],
poll: [
'................', '................', '.kkkkkkkkkkkkkk.', '.kwwwwwwwwwwwwk.', '.kwkkkkkkkwwwwk.', '.kwkbbbbbkwwwwk.', '.kwkkkkkkkwwwwk.', '.kwkkkkkkkkkkwk.',
'.kwkeeeeeeeekwk.', '.kwkkkkkkkkkkwk.', '.kwwwwwwwwwwwwk.', '.kkkkkkkkkkkkkk.', '................', '................', '................', '................',
],
smile: [
'................', '.....kkkkkk.....', '...kkyyyyyykk...', '..kyyyyyyyyyyk..', '..kyykkyykkyyk..', '.kyyykkyykkyyyk.', '.kyyyyyyyyyyyyk.', '.kykyyyyyyyykyk.',
'.kyykyyyyyykyyk.', '..kyykkkkkkyyk..', '..kyyyyyyyyyyk..', '...kkyyyyyykk...', '.....kkkkkk.....', '................', '................', '................',
],
clock: [
'................', '.....kkkkkk.....', '...kkwwwwwwkk...', '..kwwwwkwwwwwk..', '..kwwwwkwwwwwk..', '.kwwwwwkwwwwwwk.', '.kwwwwwkwwwwwwk.', '.kwwwwwkkkkwwwk.',
'.kwwwwwwwwwwwwk.', '.kwwwwwwwwwwwwk.', '..kwwwwwwwwwwk..', '..kwwwwwwwwwwk..', '...kkwwwwwwkk...', '.....kkkkkk.....', '................', '................',
],
pin: [
'................', '.....kkkkkk.....', '....krrrrrrk....', '...krrwrrrrrrk..', '...krwwrrrrrrk..', '...krrrrkkrrrk..', '...krrrrkkrrrk..', '....krrrrrrrk...',
'.....krrrrrk....', '......krrrk.....', '.......krk......', '........k.......', '................', '................', '................', '................',
],
lock: [
'................', '.....kkkkkk.....', '....kgwwwwgk....', '....kw....wk....', '....kw....wk....', '....kw....wk....', '..kkkkkkkkkkkk..', '..kyyyyyyyyyyk..',
'..kywwwwwwwwdk..', '..kyyyykkyyyyk..', '..kyyyykkyyyyk..', '..kyyyyyyyyyyk..', '..kddddddddddk..', '..kkkkkkkkkkkk..', '................', '................',
],
check: [
'................', '.....kkkkkk.....', '...kkbbbbbbkk...', '..kbbbbbbbbbbk..', '.kbbbbbbbbbwwbk.', '.kbbbbbbbbwwbbk.', '.kbwwbbbbwwbbbk.', '.kbbwwbbwwbbbbk.',
'.kbbbwwwwbbbbbk.', '..kbbbbwwbbbbk..', '..kbbbbbbbbbbk..', '...kkbbbbbbkk...', '.....kkkkkk.....', '................', '................', '................',
],
back: [
'................', '................', '.......k........', '......kk........', '.....kgk........', '....kgwwkkkkkkk.', '...kgwwwwwwwwwk.', '..kgwwwwwwwwwwk.',
'...kgwwwwwwwwk..', '....kgwwkkkkkk..', '.....kgk........', '......kk........', '.......k........', '................', '................', '................',
],
// A bright red cross in a black frame (the dark red of the first draft vanished on dark grounds).
close: [
'................', '................', '..kk........kk..', '..krk......krk..', '...krk....krk...', '....krk..krk....', '.....krkkrk.....', '......krrk......',
'.....krkkrk.....', '....krk..krk....', '...krk....krk...', '..krk......krk..', '..kk........kk..', '................', '................', '................',
],
gear: [
'................', '......kkkk......', '...kk.kssk.kk...', '..ksskksskksk...', '...kssssssssk...', '..kksskkkksskk..', '.kssskkwwkksssk.', '.kssskwwwwksssk.',
'.kssskwwwwksssk.', '..kksskkkksskk..', '...kssssssssk...', '..ksskksskksk...', '...kk.kssk.kk...', '......kkkk......', '................', '................',
],
};
// Anything a hand-typed row got wrong is reported by rasterGlyph with the icon's name and the row.
// ---------------------------------------------------------------------------------------------
// retro-xp: vector gel, 24 by 24
const n2 = (n: number) => +n.toFixed(2);
const circ = (cx: number, cy: number, r: number) => `M${n2(cx - r)} ${n2(cy)}a${n2(r)} ${n2(r)} 0 1 0 ${n2(2 * r)} 0a${n2(r)} ${n2(r)} 0 1 0 ${n2(-2 * r)} 0z`;
const ell = (cx: number, cy: number, rx: number, ry: number) => `M${n2(cx - rx)} ${n2(cy)}a${n2(rx)} ${n2(ry)} 0 1 0 ${n2(2 * rx)} 0a${n2(rx)} ${n2(ry)} 0 1 0 ${n2(-2 * rx)} 0z`;
const rr = (x: number, y: number, w: number, h: number, r: number) =>
`M${n2(x + r)} ${n2(y)}h${n2(w - 2 * r)}a${n2(r)} ${n2(r)} 0 0 1 ${n2(r)} ${n2(r)}v${n2(h - 2 * r)}a${n2(r)} ${n2(r)} 0 0 1 ${n2(-r)} ${n2(r)}h${n2(-(w - 2 * r))}a${n2(r)} ${n2(r)} 0 0 1 ${n2(-r)} ${n2(-r)}v${n2(-(h - 2 * r))}a${n2(r)} ${n2(r)} 0 0 1 ${n2(r)} ${n2(-r)}z`;
const poly = (...pts: Array<[number, number]>) => `M${pts.map(([x, y]) => `${n2(x)} ${n2(y)}`).join('L')}z`;
/** A straight bar of width `w` from one point to another. */
const bar = (x1: number, y1: number, x2: number, y2: number, w: number) => {
const dx = x2 - x1, dy = y2 - y1, len = Math.hypot(dx, dy) || 1;
const px = (-dy / len) * (w / 2), py = (dx / len) * (w / 2);
return poly([x1 + px, y1 + py], [x2 + px, y2 + py], [x2 - px, y2 - py], [x1 - px, y1 - py]);
};
const star = (cx: number, cy: number, R: number, r: number, points = 5) => poly(...Array.from({ length: points * 2 }, (_, i): [number, number] => {
const angle = -Math.PI / 2 + (i * Math.PI) / points, radius = i % 2 ? r : R;
return [cx + radius * Math.cos(angle), cy + radius * Math.sin(angle)];
}));
type Layer = { d: string; fill: string | { from: string; to: string }; opacity?: number };
const flat = (d: string, fill: string): Layer => ({ d, fill });
const gel = (d: string, from: string, to: string): Layer => ({ d, fill: { from, to } });
const sheen = (d: string, opacity = 0.42): Layer => ({ d, fill: { from: '#ffffff', to: '#ffffff' }, opacity });
const glyph = (...layers: Layer[]): IconGlyph => {
if (layers.length > 6) throw new Error(`a glyph has 6 layers at most (${layers.length})`);
return { layers };
};
const EDGE = { blue: '#143c8c', red: '#7a1a10', green: '#17591f', gold: '#7a5410', gray: '#3b4256', brown: '#5a3410' };
const BLUE: [string, string] = ['#8fc0ff', '#2563d6'];
const RED: [string, string] = ['#ff9a80', '#d2301a'];
const GREEN: [string, string] = ['#a6ec8a', '#2f9e2b'];
const GOLD: [string, string] = ['#ffe9a0', '#eaa21a'];
const PAPER: [string, string] = ['#ffffff', '#dfe8f6'];
const XP: Record<string, IconGlyph> = {
home: glyph(
flat(rr(3.4, 10.4, 17.2, 11.6, 1.2), '#6a5a2a'), gel(rr(4.4, 11.4, 15.2, 9.6, 0.6), '#fff9dc', '#e8d28c'),
flat(poly([12, 1.6], [23.4, 12.4], [0.6, 12.4]), EDGE.red), gel(poly([12, 4.2], [20.6, 11.2], [3.4, 11.2]), ...RED),
gel(rr(9.8, 14.4, 4.4, 6.6, 0.8), '#6fa8ff', '#1c4fb8'), sheen(poly([12, 4.6], [16.4, 8.2], [7.6, 8.2]), 0.3),
),
explore: glyph(
flat(bar(15.2, 15.2, 21.4, 21.4, 4.6), EDGE.brown), gel(bar(15.2, 15.2, 21.2, 21.2, 3), '#f6bd5a', '#b8651a'),
flat(circ(10, 10, 8), EDGE.blue), gel(circ(10, 10, 6.9), ...BLUE), gel(circ(10, 10, 4.9), '#f2f9ff', '#a8cfff'), sheen(ell(8.5, 7.4, 3.1, 1.8), 0.7),
),
bell: glyph(
flat('M12 1.8a1.6 1.6 0 0 1 1.6 1.6v.5a6.4 6.4 0 0 1 4.4 6.1v4.7l2.2 3.6H3.8L6 14.7V10a6.4 6.4 0 0 1 4.4-6.1v-.5A1.6 1.6 0 0 1 12 1.8z', EDGE.gold),
gel('M12 3.2a.6.6 0 0 1 .6.6v1.1a5.2 5.2 0 0 1 4.2 5.1v4.9l1.7 2.9H5.5l1.7-2.9V10a5.2 5.2 0 0 1 4.2-5.1V3.8a.6.6 0 0 1 .6-.6z', ...GOLD),
flat(circ(12, 20.4, 2.2), EDGE.gold), gel(circ(12, 20.4, 1.3), '#ffe28a', '#d58b10'), sheen(ell(9.6, 9, 1.6, 3.2), 0.55),
),
messages: glyph(
flat(rr(1.6, 4.6, 20.8, 14.8, 1.8), EDGE.blue), gel(rr(2.6, 5.6, 18.8, 12.8, 1), ...PAPER),
flat(poly([3, 6.6], [12, 13.6], [21, 6.6], [21, 8.4], [12, 15.4], [3, 8.4]), '#2a62d4'), sheen(poly([3.2, 6], [12, 11.8], [20.8, 6]), 0.4),
),
grok: glyph(
flat(circ(12, 12, 10.4), '#10162e'), gel(circ(12, 12, 9.4), '#6a78a8', '#141a3a'), flat(bar(6.4, 17.6, 17.6, 6.4, 2.2), '#ffffff'),
flat(poly([11, 5.6], [18.4, 5.6], [18.4, 13]), '#ffffff'), sheen(ell(9.6, 6.6, 4.4, 2.4), 0.3),
),
folder: glyph(
flat('M2.2 5.4A1.6 1.6 0 0 1 3.8 3.8h5.4l2 2.2h9A1.6 1.6 0 0 1 21.8 7.6v11.2a1.6 1.6 0 0 1-1.6 1.6H3.8a1.6 1.6 0 0 1-1.6-1.6z', EDGE.gold),
gel('M3.2 5.6a.8.8 0 0 1 .8-.8h4.8l2 2.2h9a.8.8 0 0 1 .8.8v10.8a.8.8 0 0 1-.8.8H4a.8.8 0 0 1-.8-.8z', '#fff1b0', '#f0b72a'),
gel(rr(3.2, 9.2, 17.6, 10, 0.8), '#ffe27a', '#e69a12'), sheen(rr(4, 9.8, 16, 3.2, 0.6), 0.45),
),
lists: glyph(
flat(rr(4.2, 1.8, 15.6, 20.4, 1.4), EDGE.gray), gel(rr(5.2, 2.8, 13.6, 18.4, 0.7), ...PAPER),
flat(rr(7.4, 6.2, 9.2, 1.6, 0.8), '#2a62d4'), flat(rr(7.4, 10.2, 9.2, 1.6, 0.8), '#2a62d4'), flat(rr(7.4, 14.2, 9.2, 1.6, 0.8), '#2a62d4'), flat(rr(7.4, 17.8, 5.4, 1.4, 0.7), '#2a62d4'),
),
people: glyph(
flat(circ(8, 7.6, 4.2), EDGE.blue), gel(circ(8, 7.6, 3.2), '#ffe2c0', '#e8a86c'), flat('M1.2 21a6.8 6.8 0 0 1 13.6 0z', EDGE.blue), gel('M2.4 20.2a5.6 5.6 0 0 1 11.2 0z', ...BLUE),
flat(circ(17, 8.4, 3.6), EDGE.red), gel('M12.2 21a4.8 4.8 0 0 1 9.6 0z', ...RED),
),
star: glyph(
flat(star(12, 12.6, 11, 4.9), EDGE.gold), gel(star(12, 12.8, 9.6, 4.1), ...GOLD), sheen(poly([12, 4.2], [14, 9.4], [12, 10.4], [10, 9.4]), 0.55),
),
person: glyph(
flat(circ(12, 7, 5.4), EDGE.blue), gel(circ(12, 7, 4.4), '#ffe2c0', '#e8a86c'), flat('M2.6 22a9.4 9.4 0 0 1 18.8 0z', EDGE.blue), gel('M3.8 21a8.2 8.2 0 0 1 16.4 0z', ...BLUE),
sheen(ell(10.4, 5.4, 2.2, 1.4), 0.7),
),
more: glyph(
flat(rr(1.4, 7.6, 21.2, 8.8, 4.4), EDGE.blue), gel(rr(2.4, 8.6, 19.2, 6.8, 3.4), ...BLUE), flat(circ(7, 12, 1.5), '#ffffff'), flat(circ(12, 12, 1.5), '#ffffff'), flat(circ(17, 12, 1.5), '#ffffff'),
sheen(rr(3.4, 9, 17.2, 2.8, 1.4), 0.4),
),
compose: glyph(
flat(rr(2.4, 3.6, 15.6, 18, 1.4), EDGE.gray), gel(rr(3.4, 4.6, 13.6, 16, 0.7), ...PAPER),
flat(bar(11.4, 16.4, 20.6, 4.4, 4.2), EDGE.gold), gel(bar(11.6, 16, 20.2, 4.8, 2.6), '#ffe27a', '#e69a12'),
flat(poly([9.8, 20.4], [10.6, 15.6], [14, 17.6]), '#3b4256'), flat(poly([19.2, 3.4], [21.6, 2.2], [22.2, 5.4]), '#e0472b'),
),
reply: glyph(
flat('M3 3.4h18a1.6 1.6 0 0 1 1.6 1.6v10.2a1.6 1.6 0 0 1-1.6 1.6H12.4L7 21.6v-4.8H3A1.6 1.6 0 0 1 1.4 15.2V5A1.6 1.6 0 0 1 3 3.4z', EDGE.blue),
gel('M3.2 4.6h17.6a.6.6 0 0 1 .6.6v9.8a.6.6 0 0 1-.6.6h-9L8.2 19v-3.4H3.2a.6.6 0 0 1-.6-.6V5.2a.6.6 0 0 1 .6-.6z', '#c4e0ff', '#4c8fe8'), sheen(rr(3.6, 5.2, 16.8, 4, 0.6), 0.5),
),
// Off: brushed-steel arrows (X shows repost muted until it is on); on: the green gel.
repost: glyph(
flat('M3 11V9a3 3 0 0 1 3-3h8V2.6l6.4 5.2-6.4 5.2V9.6H7v1.4z', EDGE.gray), gel('M4.2 10.2V9.2a2.2 2.2 0 0 1 2.2-2.2h8.8V4.8l4.2 3.4-4.2 3.4V9.4H7z', '#f2f5fa', '#9aa4b8'),
flat('M21 13v2a3 3 0 0 1-3 3h-8v3.4L3.6 16.2 10 11v3.4h7v-1.4z', EDGE.gray), gel('M19.8 13.8v1a2.2 2.2 0 0 1-2.2 2.2H8.8v2.2l-4.2-3.4 4.2-3.4v2h8z', '#f2f5fa', '#9aa4b8'),
),
repostOn: glyph(
flat('M3 11V9a3 3 0 0 1 3-3h8V2.6l6.4 5.2-6.4 5.2V9.6H7v1.4z', EDGE.green), gel('M4.2 10.2V9.2a2.2 2.2 0 0 1 2.2-2.2h8.8V4.8l4.2 3.4-4.2 3.4V9.4H7z', '#d6ffb8', '#38b52a'),
flat('M21 13v2a3 3 0 0 1-3 3h-8v3.4L3.6 16.2 10 11v3.4h7v-1.4z', EDGE.green), gel('M19.8 13.8v1a2.2 2.2 0 0 1-2.2 2.2H8.8v2.2l-4.2-3.4 4.2-3.4v2h8z', '#d6ffb8', '#38b52a'),
sheen(rr(6, 7.2, 8, 1.2, 0.6), 0.6),
),
heart: glyph(
flat('M12 22.4L2.4 12.8A6 6 0 0 1 12 5.4a6 6 0 0 1 9.6 7.4z', '#8a5568'), gel('M12 20.8L3.8 12.6A4.6 4.6 0 0 1 12 6.9a4.6 4.6 0 0 1 8.2 5.7z', '#fff0f6', '#f0a6c4'), sheen(ell(8, 9.4, 2.6, 1.5), 0.7),
),
heartOn: glyph(
flat('M12 22.4L2.4 12.8A6 6 0 0 1 12 5.4a6 6 0 0 1 9.6 7.4z', '#7a0f2c'), gel('M12 20.8L3.8 12.6A4.6 4.6 0 0 1 12 6.9a4.6 4.6 0 0 1 8.2 5.7z', '#ff8fb0', '#d4123f'), sheen(ell(8, 9.4, 2.6, 1.5), 0.6),
),
views: glyph(
flat(rr(2.2, 13, 5.2, 8.8, 1), EDGE.blue), gel(rr(3, 13.8, 3.6, 7.2, 0.5), ...BLUE),
flat(rr(9.4, 4.6, 5.2, 17.2, 1), EDGE.green), gel(rr(10.2, 5.4, 3.6, 15.6, 0.5), ...GREEN),
flat(rr(16.6, 9, 5.2, 12.8, 1), EDGE.red), gel(rr(17.4, 9.8, 3.6, 11.2, 0.5), ...RED),
),
share: glyph(
flat(poly([12, 1.6], [19, 8.8], [14.4, 8.8], [14.4, 15.4], [9.6, 15.4], [9.6, 8.8], [5, 8.8]), EDGE.green), gel(poly([12, 3.8], [16.4, 8], [13.2, 8], [13.2, 14.2], [10.8, 14.2], [10.8, 8], [7.6, 8]), ...GREEN),
flat(rr(2.6, 13.4, 18.8, 8.2, 1.4), EDGE.gray), gel(rr(3.6, 14.4, 16.8, 6.2, 0.8), '#f4f7fc', '#b8c6e0'),
),
bookmark: glyph(
flat('M6 2h12a1.4 1.4 0 0 1 1.4 1.4V22.2L12 16.8 4.6 22.2V3.4A1.4 1.4 0 0 1 6 2z', EDGE.blue), gel('M6.2 3.2h11.6v15.8L12 14.8 6.2 19z', '#e8f2ff', '#8ab6f4'), sheen(rr(6.6, 3.6, 10.8, 3.4, 0.5), 0.5),
),
bookmarkOn: glyph(
flat('M6 2h12a1.4 1.4 0 0 1 1.4 1.4V22.2L12 16.8 4.6 22.2V3.4A1.4 1.4 0 0 1 6 2z', EDGE.blue), gel('M6.2 3.2h11.6v15.8L12 14.8 6.2 19z', '#8fc0ff', '#1f55c4'), sheen(rr(6.6, 3.6, 10.8, 3.4, 0.5), 0.45),
),
back: glyph(
flat(circ(12, 12, 10.6), '#0f4a12'), gel(circ(12, 12, 9.6), '#a6ec8a', '#2b9a28'), flat(poly([5.6, 12], [11.6, 6.2], [11.6, 9.6], [18.4, 9.6], [18.4, 14.4], [11.6, 14.4], [11.6, 17.8]), '#ffffff'), sheen(ell(12, 6.6, 7, 3.4), 0.4),
),
close: glyph(
flat(rr(2, 2, 20, 20, 3.4), '#ffffff'), gel(rr(3, 3, 18, 18, 2.6), '#f6a58f', '#d2301a'), flat(bar(7.6, 7.6, 16.4, 16.4, 2.6), '#ffffff'), flat(bar(16.4, 7.6, 7.6, 16.4, 2.6), '#ffffff'), sheen(rr(3.8, 3.8, 16.4, 6.4, 1.8), 0.35),
),
media: glyph(
flat(rr(1.6, 3.6, 20.8, 16.8, 1.6), EDGE.gray), gel(rr(2.6, 4.6, 18.8, 14.8, 0.8), '#b8e0ff', '#5aa8f0'),
flat('M2.6 19.4V15l5.6-5 5.2 4.4 3-2.4 4.8 4.4v3z', '#2f8a2a'), flat(circ(16.6, 8.6, 2), '#ffd84a'), sheen(rr(3.2, 5.2, 17.6, 4, 0.6), 0.3),
),
gif: glyph(
flat(rr(1.6, 5, 20.8, 14, 2.4), EDGE.blue), gel(rr(2.6, 6, 18.8, 12, 1.6), '#8fc0ff', '#2563d6'),
// "GIF" in block letters, legible at 16px (G: top, side, foot, the hook in; I; F: stem, top, bar).
flat([rr(4.6, 8.4, 4.8, 1.6, 0.3), rr(4.6, 8.4, 1.6, 7.2, 0.3), rr(4.6, 14, 4.8, 1.6, 0.3), rr(7.8, 11.6, 1.6, 4, 0.3), rr(7, 11.6, 2.4, 1.4, 0.3),
rr(11.2, 8.4, 1.6, 7.2, 0.3), rr(14.4, 8.4, 1.6, 7.2, 0.3), rr(14.4, 8.4, 5, 1.6, 0.3), rr(14.4, 11.4, 3.8, 1.4, 0.3)].join(''), '#ffffff'),
sheen(rr(3, 6.4, 18, 4, 1.2), 0.3),
),
poll: glyph(
flat(rr(2, 2.6, 20, 18.8, 1.6), EDGE.gray), gel(rr(3, 3.6, 18, 16.8, 0.8), ...PAPER),
flat(rr(5, 6.2, 12, 2.4, 1.2), '#2563d6'), flat(rr(5, 10.8, 8, 2.4, 1.2), '#2f9e2b'), flat(rr(5, 15.4, 5, 2.4, 1.2), '#d2301a'),
),
smile: glyph(
flat(circ(12, 12, 10.6), '#7a5410'), gel(circ(12, 12, 9.6), '#fff3a0', '#f2b81a'), flat(ell(8.6, 9.6, 1.2, 1.8), '#3a2a08'), flat(ell(15.4, 9.6, 1.2, 1.8), '#3a2a08'),
flat('M6.4 14a6.4 6.4 0 0 0 11.2 0z', '#3a2a08'), sheen(ell(10.4, 6, 5, 2.6), 0.55),
),
clock: glyph(
flat(circ(12, 12, 10.6), EDGE.blue), gel(circ(12, 12, 9.4), '#ffffff', '#cfdcf4'), flat(bar(12, 12, 12, 5.4, 1.8), '#143c8c'), flat(bar(12, 12, 16.6, 14.8, 1.8), '#143c8c'), flat(circ(12, 12, 1.4), '#d2301a'),
sheen(ell(10.4, 6, 5, 2.2), 0.5),
),
pin: glyph(
flat('M12 22.6C8 17.6 4.8 14 4.8 9.8a7.2 7.2 0 0 1 14.4 0c0 4.2-3.2 7.8-7.2 12.8z', EDGE.red), gel('M12 20.6C9 16.8 6.2 13.6 6.2 9.8a5.8 5.8 0 0 1 11.6 0c0 3.8-2.8 7-5.8 10.8z', ...RED),
flat(circ(12, 9.8, 2.4), '#ffffff'), sheen(ell(9.6, 6.6, 2, 1.8), 0.6),
),
lock: glyph(
flat('M7 10.4V7.6a5 5 0 0 1 10 0v2.8h-2.4V7.6a2.6 2.6 0 0 0-5.2 0v2.8z', '#4a4f5c'),
flat(rr(3.6, 10, 16.8, 12, 2), EDGE.gold), gel(rr(4.6, 11, 14.8, 10, 1.2), ...GOLD), flat(circ(12, 15.2, 1.8), '#5a3a08'), flat(rr(11.2, 15.4, 1.6, 3.6, 0.8), '#5a3a08'), sheen(rr(5, 11.4, 14, 3.4, 1), 0.45),
),
verified: glyph(
flat(star(12, 12, 11.4, 9.4, 9), '#10408f'), gel(circ(12, 12, 8.6), '#8fc4ff', '#1f6fe0'), flat('M7.4 12.2l3.2 3.2 6-6.6-1.6-1.5-4.4 4.9-1.6-1.6z', '#ffffff'), sheen(ell(10.4, 7.4, 4.4, 2.2), 0.45),
),
gear: glyph(
flat(star(12, 12, 11.4, 9, 8), EDGE.gray), gel(circ(12, 12, 8.6), '#f4f7fc', '#a6b4cf'), flat(circ(12, 12, 3.6), EDGE.gray), gel(circ(12, 12, 2.6), '#ffffff', '#c8d4ea'),
),
};
// ---------------------------------------------------------------------------------------------
type Names = Partial<Record<IconName, IconGlyph>>;
const px = (key: keyof typeof ART98) => rasterGlyph(key, ART98[key]!);
const G98: Names = {
home: px('home'), 'home.active': px('home'), explore: px('search'), 'explore.active': px('search'), notifications: px('bell'), 'notifications.active': px('bell'),
messages: px('mail'), 'messages.active': px('mail'), grok: px('monitor'), bookmarks: px('folder'), 'bookmarks.active': px('folder'), lists: px('notepad'), communities: px('people'),
premium: px('badge'), profile: px('person'), 'profile.active': px('person'), more: px('dots'), compose: px('pencil'),
reply: px('balloon'), repost: px('arrows'), 'repost.on': px('arrowsOn'), like: px('heart'), 'like.on': px('heartOn'), views: px('bars'),
bookmark: px('bookmark'), 'bookmark.on': px('bookmarkOn'), share: px('share'), verified: px('check'), back: px('back'), close: px('close'), search: px('search'), settings: px('gear'),
media: px('picture'), gif: px('gif'), poll: px('poll'), emoji: px('smile'), schedule: px('clock'), location: px('pin'), lock: px('lock'),
};
const GXP: Names = {
home: XP.home!, 'home.active': XP.home!, explore: XP.explore!, 'explore.active': XP.explore!, notifications: XP.bell!, 'notifications.active': XP.bell!,
messages: XP.messages!, 'messages.active': XP.messages!, grok: XP.grok!, bookmarks: XP.folder!, 'bookmarks.active': XP.folder!, lists: XP.lists!, communities: XP.people!,
premium: XP.star!, profile: XP.person!, 'profile.active': XP.person!, more: XP.more!, compose: XP.compose!,
reply: XP.reply!, repost: XP.repost!, 'repost.on': XP.repostOn!, like: XP.heart!, 'like.on': XP.heartOn!, views: XP.views!,
bookmark: XP.bookmark!, 'bookmark.on': XP.bookmarkOn!, share: XP.share!, verified: XP.verified!, back: XP.back!, close: XP.close!, search: XP.explore!, settings: XP.gear!,
media: XP.media!, gif: XP.gif!, poll: XP.poll!, emoji: XP.smile!, schedule: XP.clock!, location: XP.pin!, lock: XP.lock!,
};
const OWN = { author: 'wayBetter for X', license: 'own', source: 'drawn for wayBetter for X; no asset is taken from Windows or from any icon archive', credits: 'wayBetter for X contributors' };
const documents = [
{
id: 'retro-98', name: 'Retro 98', description: 'Sixteen-pixel desktop icons in the sixteen-color palette of 1998: black outlines, silver, navy and teal. Every icon of the left navigation and the action bar.',
...OWN, style: { stroke: 1.75, cap: 'square', join: 'miter', scale: 1 }, glyphs: G98,
},
{
id: 'retro-xp', name: 'Retro XP', description: 'Glossy gel icons in the manner of 2001: a dark edge, a lit top, bright blue, green and gold. Every icon of the left navigation and the action bar.',
...OWN, style: { stroke: 1.75, cap: 'round', join: 'round', scale: 1 }, glyphs: GXP,
},
];
/** The retro packs, validated like any imported pack. */
export const RETRO_PACKS: IconPack[] = documents.map(doc => {
const pack = sanitizeIconPack(doc);
if (!pack) throw new Error(`retro icon pack ${doc.id} is not valid`);
const wanted = Object.keys(doc.glyphs).length;
if (Object.keys(pack.glyphs).length !== wanted) throw new Error(`retro icon pack ${doc.id}: ${wanted - Object.keys(pack.glyphs).length} glyph(s) were refused by the sanitizer`);
return pack;
});
/** A retro pack as the JSON document it is published as (`<id>.icons.json`). */
export const retroDocument = (id: string) => {
const pack = RETRO_PACKS.find(item => item.id === id);
return pack ? { $schema: 'https://unpkg.com/waybetter/icons.schema.json', ...pack } : null;
};

View file

@ -21,11 +21,21 @@ import {
installStringPacks, mapChunkRequires, watchChunkArray, type CatalogHookAdapter, type CatalogReport, type CatalogSink, type StringPacksHandle, installStringPacks, mapChunkRequires, watchChunkArray, type CatalogHookAdapter, type CatalogReport, type CatalogSink, type StringPacksHandle,
} from '../../../../waybetter/packages/runtime/src/stringPackHook.ts'; } from '../../../../waybetter/packages/runtime/src/stringPackHook.ts';
import { inventoryLookup, isPageInventory, type PageInventory } from '../../../../waybetter/packages/runtime/src/stringPacks.ts'; import { inventoryLookup, isPageInventory, type PageInventory } from '../../../../waybetter/packages/runtime/src/stringPacks.ts';
import { createMarker, installTranslateUi, withDraft } from '../../../../waybetter/packages/runtime/src/stringPackTranslate.ts'; import { createMarker, installTranslateUi, withDraft, type TranslateWords } from '../../../../waybetter/packages/runtime/src/stringPackTranslate.ts';
import { t } from './i18n.ts';
import { richText } from './xRichText.ts';
export const X_SITE_ID = 'x'; export const X_SITE_ID = 'x';
export const X_WEB_CATALOG = 'web'; export const X_WEB_CATALOG = 'web';
export const X_CHUNK_ARRAY = 'webpackChunk_twitter_responsive_web'; export const X_CHUNK_ARRAY = 'webpackChunk_twitter_responsive_web';
/** Translate mode's words in the owner's language (`x.translate.*`), read each time the bar or the editor is drawn. */
export const translateWords = (): TranslateWords => ({
bar: t('x.translate.bar'), hint: t('x.translate.hint'), edits: count => t('x.translate.edits', { count }), exportPack: t('x.translate.exportPack'),
copied: t('x.translate.copied'), exit: t('x.translate.exit'), reload: t('x.translate.reload'), key: t('x.translate.key'), original: t('x.translate.original'),
parameters: t('x.translate.parameters'), plural: t('x.translate.plural'), save: t('x.translate.save'), cancel: t('x.translate.cancel'),
remove: t('x.translate.remove'), notTranslatable: t('x.translate.notTranslatable'), choose: t('x.translate.choose'),
});
export const X_PACKS_KEY = 'wayBetter.stringPacks'; export const X_PACKS_KEY = 'wayBetter.stringPacks';
/** /**
@ -48,7 +58,7 @@ type Registry = { _register: (this: unknown, language: string, ...rest: unknown[
const isRegistry = (value: unknown): value is Registry => typeof value === 'object' && value !== null && typeof (value as Registry)._register === 'function'; const isRegistry = (value: unknown): value is Registry => typeof value === 'object' && value !== null && typeof (value as Registry)._register === 'function';
/** A shadow of X's registry: the same object to read from, with a `_register` that asks `sink`. */ /** A shadow of X's registry: the same object to read from, with a `_register` that asks `sink`. */
function shadowRegistry(registry: Registry, sink: CatalogSink, group: string): unknown { function shadowRegistry(registry: Registry, sink: CatalogSink, group: string, rich: ReturnType<typeof richText>): unknown {
const shadow = Object.create(registry) as Registry; const shadow = Object.create(registry) as Registry;
Object.defineProperty(shadow, '_register', { Object.defineProperty(shadow, '_register', {
value(this: unknown, ...args: [string, ...unknown[]]) { value(this: unknown, ...args: [string, ...unknown[]]) {
@ -56,7 +66,9 @@ function shadowRegistry(registry: Registry, sink: CatalogSink, group: string): u
if (typeof set !== 'function') return set; if (typeof set !== 'function') return set;
sink.matched(String(args[0]), group); sink.matched(String(args[0]), group);
return function (this: unknown, id: unknown, value: unknown, ...rest: unknown[]) { return function (this: unknown, id: unknown, value: unknown, ...rest: unknown[]) {
return (set as (...a: unknown[]) => unknown).call(this, id, typeof id === 'string' ? sink.resolve(id, value) : value, ...rest); // X's rich-text class and element are registered through the same setter (xRichText.ts).
const richEntry = typeof id === 'string' ? rich.intercept(id, value) : undefined;
return (set as (...a: unknown[]) => unknown).call(this, id, richEntry ? richEntry.value : typeof id === 'string' ? sink.resolve(id, value) : value, ...rest);
}; };
}, },
}); });
@ -70,7 +82,12 @@ export const xWebCatalog: CatalogHookAdapter = {
const group = languageFile(script); const group = languageFile(script);
if (!group) return; if (!group) return;
sink.seen(group); sink.seen(group);
mapChunkRequires(chunk, exports => (isRegistry(exports) ? shadowRegistry(exports, sink, group) : undefined)); const rich = richText(sink.resolve);
mapChunkRequires(chunk, exports => {
if (isRegistry(exports)) return shadowRegistry(exports, sink, group, rich);
rich.seen(exports);
return undefined;
});
}); });
}, },
}; };
@ -121,7 +138,7 @@ export function installXStringPacks(win: Window, delivery: StringPackDelivery |
if (marker && delivery) { if (marker && delivery) {
const rev = String(delivery.rev); const rev = String(delivery.rev);
installTranslateUi(win, { installTranslateUi(win, {
inventory: delivery.inventory, marker, site: X_SITE_ID, catalog: X_WEB_CATALOG, inventory: delivery.inventory, marker, site: X_SITE_ID, catalog: X_WEB_CATALOG, words: translateWords,
exit() { try { win.sessionStorage.setItem(X_TRANSLATE_OFF_KEY, rev); } catch { /* no storage */ } win.location.reload(); }, exit() { try { win.sessionStorage.setItem(X_TRANSLATE_OFF_KEY, rev); } catch { /* no storage */ } win.location.reload(); },
}); });
} }

View file

@ -103,7 +103,8 @@ const PROPERTY_ROLES: Record<string, AnyRole[]> = {
const INLINE_ROLES: Record<string, AnyRole[]> = { const INLINE_ROLES: Record<string, AnyRole[]> = {
'background-color': ['bg', 'surface', 'elevated', 'inverse', 'accent'], 'background-color': ['bg', 'surface', 'elevated', 'inverse', 'accent'],
color: ['text', 'muted', 'accent'], color: ['text', 'muted', 'accent'],
'border-color': ['border'], // X's outlined buttons (Edit profile, Follow back) draw their edge inline in its secondary-text gray (live 2026-10-02).
'border-color': ['border', 'muted'],
}; };
/** Verification badges keep X's exact colors under any palette or accent. */ /** Verification badges keep X's exact colors under any palette or accent. */

View file

@ -42,9 +42,14 @@ export const X_PARTS: PartMap = {
search: { sel: 'form[role="search"] > div > div', text: 'form[role="search"] input' }, search: { sel: 'form[role="search"] > div > div', text: 'form[role="search"] input' },
composer: { sel: '[data-testid="tweetTextarea_0"]', text: '[data-testid="tweetTextarea_0"] :is(span,div)' }, composer: { sel: '[data-testid="tweetTextarea_0"]', text: '[data-testid="tweetTextarea_0"] :is(span,div)' },
composerTool: { sel: '[data-testid="toolBar"] nav [role="button"]', text: '[data-testid="toolBar"] nav [role="button"] svg' }, composerTool: { sel: '[data-testid="toolBar"] nav [role="button"]', text: '[data-testid="toolBar"] nav [role="button"] svg' },
sidebarCard: { sel: '[data-testid="sidebarColumn"] div:has(> :is(aside[role="complementary"],section[role="region"]))' }, // Live 2026-10-01: the painted, bordered card is the grandparent of X's aside/section (a plain div sits
// between), or the parent of a `*_sidebar` module (news, scores).
sidebarCard: { sel: '[data-testid="sidebarColumn"] div:has(> div > :is(aside[role="complementary"],section[role="region"])),[data-testid="sidebarColumn"] div:has(> [data-testid$="_sidebar"])' },
menu: { sel: '#layers [role="menu"]' }, menu: { sel: '#layers [role="menu"]' },
hoverCard: { sel: '#layers [data-testid="HoverCard"]' }, hoverCard: { sel: '#layers [data-testid="HoverCard"]' },
// The compose dialog's painted sheet (the child of the modal that has a composer toolbar). Never every modal: the photo
// viewer shares X's dialog attributes and its scrim must stay dark. Fixture markup; not read live.
dialog: { sel: '#layers [role="dialog"][aria-modal="true"]:has([data-testid="toolBar"]) > div' },
}; };
/** Where X's decoration goes. */ /** Where X's decoration goes. */
@ -135,20 +140,40 @@ export const X_SKINS: VariantSkins<XSkinContext> = {
function bar(edge: 'top' | 'bottom', colors: RoleColors): string { function bar(edge: 'top' | 'bottom', colors: RoleColors): string {
const inner = `${RAIL} > div > div`; const inner = `${RAIL} > div > div`;
return `${WIDE}{ return `${WIDE}{
${NOT_CHAT} ${RAIL}{position:fixed !important;${edge}:0;left:0;right:0;z-index:30;height:56px;width:auto !important;flex-grow:0 !important;align-items:stretch !important;background-color:${colors.surface};border-${edge === 'top' ? 'bottom' : 'top'}:1px solid ${colors.border};box-shadow:0 ${edge === 'top' ? '1px' : '-1px'} 6px rgba(0, 0, 0, 0.12)} ${NOT_CHAT} ${RAIL}{position:fixed !important;${edge}:0;left:0;right:0;z-index:30;height:56px;width:auto !important;flex-grow:0 !important;align-items:stretch !important;background-color:var(--wb-part-nav-fill, ${colors.surface});background-image:var(--wb-part-nav-fill-1, none);box-shadow:var(--wb-part-nav-bevel, 0 ${edge === 'top' ? '1px' : '-1px'} 0 ${colors.border}, 0 ${edge === 'top' ? '1px' : '-1px'} 6px rgba(0, 0, 0, 0.12))}
/* The bar is the nav's surface: its fill and edge move from the nav (a box inside the bar) to the whole bar. */
${NOT_CHAT} ${NAV}{--wb-part-nav-fill:transparent;--wb-part-nav-fill-1:none;--wb-part-nav-bevel:none}
${NOT_CHAT} ${RAIL} > div{width:100% !important;height:56px !important} ${NOT_CHAT} ${RAIL} > div{width:100% !important;height:56px !important}
${NOT_CHAT} ${inner}{position:static !important;width:100% !important;height:56px !important;max-width:1280px;margin:0 auto !important} ${NOT_CHAT} ${inner}{position:static !important;width:100% !important;height:56px !important;${edge === 'top' ? 'max-width:1280px;' : ''}margin:0 auto !important}
${NOT_CHAT} ${inner} > div{flex-direction:row !important;align-items:center !important;justify-content:space-between !important;height:56px !important;width:100% !important;padding:0 16px !important;overflow:visible !important} ${NOT_CHAT} ${inner} > div{flex-direction:row !important;align-items:center !important;justify-content:space-between !important;gap:8px;height:56px !important;width:100% !important;padding:0 8px !important;overflow:visible !important;box-sizing:border-box}
${NOT_CHAT} ${inner} > div > div{flex-direction:row !important;align-items:center !important;height:56px !important;gap:4px} ${NOT_CHAT} ${inner} > div > div{flex-direction:row !important;align-items:center !important;height:56px !important;gap:4px;min-width:0 !important}
/* The group with the logo, the items and the Post button takes the row; the account stays whole at the end. */
${NOT_CHAT} ${inner} > div > div:first-child{flex:1 1 auto !important}
${NOT_CHAT} ${inner} > div > div:last-child{flex:0 0 auto !important}
/* The same for the groups inside the row (the nav and the Post button sit in full-width wrappers). */ /* The same for the groups inside the row (the nav and the Post button sit in full-width wrappers). */
${NOT_CHAT} ${inner} > div > div > div{width:auto !important;flex:0 1 auto !important;min-width:0 !important} ${NOT_CHAT} ${inner} > div > div > div{width:auto !important;flex:0 1 auto !important;min-width:0 !important}
${NOT_CHAT} ${NAV}{flex-direction:row !important;align-items:center !important;flex-wrap:nowrap !important;gap:2px} ${NOT_CHAT} ${NAV}{flex-direction:row !important;align-items:center !important;flex-wrap:nowrap !important;gap:2px}
/* X sizes each rail item to the rail (width:100%, flex-grow:1): in a row that is one window per item. */ ${NOT_CHAT} ${NAV}{min-width:0 !important;overflow:hidden}
${NOT_CHAT} ${NAV} > :is(a,button){width:auto !important;flex:0 1 auto !important;min-width:0 !important} /* Items share the bar like taskbar buttons: each up to 160px, all shrinking alike, the label ending in an
${NOT_CHAT} ${NAV} > :is(a,button) > div{padding:8px 10px !important} ellipsis and then only the icon (live 2026-10-02: X shows up to 12 items, more than a row of whole labels). */
${NOT_CHAT} ${NAV} > :is(a,button){width:auto !important;flex:0 1 176px !important;min-width:36px !important;overflow:hidden}
${NOT_CHAT} ${NAV} > :is(a,button) > div{padding:8px 8px !important;gap:0 !important;min-width:0 !important;max-width:100% !important;box-sizing:border-box;justify-content:flex-start !important}
${NOT_CHAT} ${NAV} > :is(a,button) > div > div:first-child{flex:none !important}
${NOT_CHAT} ${NAV} > :is(a,button) > div > div:last-child:not(:first-child){display:block !important;flex:0 1 auto !important;margin-left:8px !important;margin-right:0 !important;padding-right:0 !important;min-width:0 !important;overflow:hidden !important;text-overflow:ellipsis !important;white-space:nowrap !important}
${NOT_CHAT} ${NAV} > :is(a,button) > div > div:last-child:not(:first-child) span{display:inline !important;white-space:nowrap !important}
${NOT_CHAT} ${RAIL} [data-testid="SideNav_NewTweet_Button"]{margin:0 0 0 8px !important;width:auto !important;min-height:40px !important;padding:0 16px !important} ${NOT_CHAT} ${RAIL} [data-testid="SideNav_NewTweet_Button"]{margin:0 0 0 8px !important;width:auto !important;min-height:40px !important;padding:0 16px !important}
${NOT_CHAT} ${RAIL} [data-testid="SideNav_AccountSwitcher_Button"]{margin:0 !important} ${NOT_CHAT} ${RAIL} [data-testid="SideNav_AccountSwitcher_Button"]{margin:0 !important}
${NOT_CHAT} main[role="main"]{padding-${edge}:56px !important;align-items:center !important} ${NOT_CHAT} main[role="main"]{padding-${edge}:56px !important;align-items:center !important}
/* X's floating Grok and Chat buttons (bottom right) ride above a bottom bar instead of over its last items. */
${edge === 'bottom' ? `${NOT_CHAT} :is([data-testid="chat-drawer-root"],[data-testid="GrokDrawer"]){transform:translateY(-56px)}` : ''}
${NOT_CHAT} ${COLUMN} > div > div:first-child{${edge === 'top' ? 'top:56px !important' : ''}} ${NOT_CHAT} ${COLUMN} > div > div:first-child{${edge === 'top' ? 'top:56px !important' : ''}}
}
/* Too narrow for words: the items are icon buttons (a label cut to one letter reads as noise). */
@media (min-width:700px) and (max-width:1199px){
${NOT_CHAT} ${NAV} > :is(a,button){flex:0 1 48px !important}
${NOT_CHAT} ${NAV} > :is(a,button) > div{justify-content:center !important}
/* Only a label is hidden: below 1265px X itself renders the items with their icon alone (live 2026-10-02). */
${NOT_CHAT} ${NAV} > :is(a,button) > div > div:last-child:not(:first-child){display:none !important}
}`; }`;
} }

View file

@ -265,6 +265,8 @@ const STRUCTURE: Record<string, Partial<ThemeSpec>> = {
composerTool: { text: 'accent' }, composerTool: { text: 'accent' },
tab: { weight: 700 }, tab: { weight: 700 },
sidebarCard: { radius: 5, borderWidth: 1, borderStyle: 'solid', borderColor: 'border', fill: 'bg' }, sidebarCard: { radius: 5, borderWidth: 1, borderStyle: 'solid', borderColor: 'border', fill: 'bg' },
// Menus, hover cards and the compose dialog are the same white box with a hairline as the sidebar cards.
panel: { preset: 'sheet', radius: 5, fill: 'bg', shadow: 'soft' },
}, },
decor: { dividers: { style: 'hairline', color: 'border' }, links: { underline: 'hover' } }, decor: { dividers: { style: 'hairline', color: 'border' }, links: { underline: 'hover' } },
icons: { pack: 'wb-classic', symbols: { like: 'star' } }, icons: { pack: 'wb-classic', symbols: { like: 'star' } },
@ -282,7 +284,8 @@ const STRUCTURE: Record<string, Partial<ThemeSpec>> = {
tab: { case: 'lower' }, tab: { case: 'lower' },
navItem: { case: 'lower', radius: 0, hover: { fill: 'elevated' } }, navItem: { case: 'lower', radius: 0, hover: { fill: 'elevated' } },
sidebarCard: { radius: 0, borderWidth: 1, borderStyle: 'dashed', borderColor: 'border', fill: 'bg' }, sidebarCard: { radius: 0, borderWidth: 1, borderStyle: 'dashed', borderColor: 'border', fill: 'bg' },
menu: { radius: 0, borderWidth: 1, borderStyle: 'solid', borderColor: 'accent', fill: 'bg' }, // Every floating layer (menus, hover cards, the compose dialog) is the same phosphor-ruled box.
panel: { radius: 0, borderWidth: 1, borderStyle: 'solid', borderColor: 'accent', fill: 'bg', shadow: 'none' },
}, },
decor: { decor: {
dividers: { style: 'dashed', color: 'border', width: 1 }, chrome: { kind: 'prompt', title: 'guest@x' }, dividers: { style: 'dashed', color: 'border', width: 1 }, chrome: { kind: 'prompt', title: 'guest@x' },
@ -291,20 +294,32 @@ const STRUCTURE: Record<string, Partial<ThemeSpec>> = {
icons: { pack: 'wb-line', style: { stroke: 1.5, cap: 'square', join: 'miter' }, labels: { reply: 'reply', repost: 'rt', like: 'fav', bookmark: 'save' } }, icons: { pack: 'wb-line', style: { stroke: 1.5, cap: 'square', join: 'miter' }, labels: { reply: 'reply', repost: 'rt', like: 'fav', bookmark: 'save' } },
}, },
'windows-98': { 'windows-98': {
// The main column is a raised silver-framed window on the teal desktop (the outset edge of 98.css, MIT). // The main column is a raised silver-framed window on the teal desktop, and the logo is the
css: '[data-testid="primaryColumn"]{border:0 !important;box-shadow:inset -1px -1px #0a0a0a,inset 1px 1px #dfdfdf,inset -2px -2px #808080,inset 2px 2px #ffffff !important}', // taskbar's first raised button (the outset edges of 98.css, MIT).
css: [
'[data-testid="primaryColumn"]{border:0 !important;box-shadow:inset -1px -1px #0a0a0a,inset 1px 1px #dfdfdf,inset -2px -2px #808080,inset 2px 2px #ffffff !important}',
'header[role="banner"] h1[role="heading"] > a{border-radius:0 !important;background-color:#c0c0c0 !important;box-shadow:inset -1px -1px #0a0a0a,inset 1px 1px #ffffff,inset -2px -2px #808080,inset 2px 2px #dfdfdf !important}',
'header[role="banner"] h1[role="heading"] > a:active{box-shadow:inset -1px -1px #ffffff,inset 1px 1px #0a0a0a,inset -2px -2px #dfdfdf,inset 2px 2px #808080 !important}',
// Live 2026-10-01: the sidebar's fixed search strip is a raised silver toolbar (X paints it white over the desktop),
// and the compose dialog's app bar and sticky toolbar let the silver window show (X paints them its layer color).
'[data-testid="sidebarColumn"] div:has(> div > div > div > form[role="search"]){background-color:#c0c0c0 !important;box-shadow:inset -1px -1px #0a0a0a,inset 1px 1px #ffffff,inset -2px -2px #808080,inset 2px 2px #dfdfdf !important}',
'#layers [role="dialog"][aria-modal="true"]:has([data-testid="toolBar"]) div:has(:is([data-testid="app-bar-close"],[data-testid="toolBar"])){background-color:transparent !important}',
].join('\n'),
variants: { nav: 'bottom' }, variants: { nav: 'bottom' },
components: { components: {
// The rail is a taskbar: a silver bar with a raised edge, every item a raised button that presses in.
nav: { fill: 'page', borderStyle: 'bevel-out' }, nav: { fill: 'page', borderStyle: 'bevel-out' },
navItem: { radius: 0, text: 'text', hover: { fill: 'elevated' }, active: { shadow: 'inset' } }, navItem: { radius: 0, text: 'text', fill: 'page', borderStyle: 'bevel-out', fontSize: 13, active: { shadow: 'inset' } },
avatar: { shape: 'square' }, avatar: { shape: 'square' },
buttonPrimary: { preset: 'bevel', fill: 'page', text: 'text', weight: 700 }, buttonPrimary: { preset: 'bevel', fill: 'page', text: 'text', weight: 700 },
buttonSecondary: { preset: 'bevel', fill: 'page', text: 'text' }, buttonSecondary: { preset: 'bevel', fill: 'page', text: 'text' },
search: { preset: 'sunken', radius: 0 }, search: { preset: 'sunken', radius: 0 },
sidebarCard: { preset: 'window', fill: 'page' }, sidebarCard: { preset: 'window', fill: 'page' },
// Every floating layer is a window: menus, hover cards, the compose dialog.
menu: { preset: 'window', fill: 'page' }, menu: { preset: 'window', fill: 'page' },
hoverCard: { preset: 'window', fill: 'page' }, hoverCard: { preset: 'window', fill: 'page' },
tab: { radius: 0 }, dialog: { preset: 'window', fill: 'page' },
tab: { radius: 0, fontSize: 13 },
composerTool: { text: 'text' }, composerTool: { text: 'text' },
}, },
decor: { decor: {
@ -325,6 +340,8 @@ const STRUCTURE: Record<string, Partial<ThemeSpec>> = {
buttonSecondary: { radius: 0, borderWidth: 1, borderStyle: 'solid', borderColor: 'text', fill: 'transparent', text: 'text' }, buttonSecondary: { radius: 0, borderWidth: 1, borderStyle: 'solid', borderColor: 'text', fill: 'transparent', text: 'text' },
search: { radius: 0, borderWidth: 1, borderStyle: 'solid', borderColor: 'text', fill: 'bg' }, search: { radius: 0, borderWidth: 1, borderStyle: 'solid', borderColor: 'text', fill: 'bg' },
sidebarCard: { radius: 0, borderWidth: 1, borderStyle: 'solid', borderColor: 'text', fill: 'bg' }, sidebarCard: { radius: 0, borderWidth: 1, borderStyle: 'solid', borderColor: 'text', fill: 'bg' },
// Menus, hover cards and the compose dialog: boxed in a printed rule like the sidebar.
panel: { radius: 0, borderWidth: 1, borderStyle: 'solid', borderColor: 'text', fill: 'bg', shadow: 'soft' },
tab: { case: 'small-caps', tracking: 0.06 }, tab: { case: 'small-caps', tracking: 0.06 },
}, },
decor: { chrome: { kind: 'masthead', title: 'The Daily Timeline' }, links: { underline: 'always' } }, decor: { chrome: { kind: 'masthead', title: 'The Daily Timeline' }, links: { underline: 'always' } },
@ -343,50 +360,60 @@ const STRUCTURE: Record<string, Partial<ThemeSpec>> = {
buttonSecondary: { preset: 'gloss', fill: { from: 'surface', to: 'elevated', angle: 180 }, borderColor: 'border', text: 'accent' }, buttonSecondary: { preset: 'gloss', fill: { from: 'surface', to: 'elevated', angle: 180 }, borderColor: 'border', text: 'accent' },
search: { preset: 'pill', fill: 'glass' }, search: { preset: 'pill', fill: 'glass' },
sidebarCard: { preset: 'glass' }, sidebarCard: { preset: 'glass' },
// Menus and hover cards stay opaque over the timeline (a menu must read whatever is under it); the bars and cards are glass. // Menus, hover cards and the compose dialog stay opaque over the timeline (a menu must read whatever is under it); the bars and cards are glass.
menu: { preset: 'sheet', radius: 16 }, panel: { preset: 'sheet', radius: 16 },
hoverCard: { preset: 'sheet', radius: 16 },
}, },
decor: { motion: { duration: 220, curve: 'spring', press: 0.97 } }, decor: { motion: { duration: 220, curve: 'spring', press: 0.97 } },
icons: { pack: 'wb-aero' }, icons: { pack: 'wb-aero' },
}, },
// The other eight: tokens and line icons (stroke, caps and size per theme), no layout variant yet. // The other eight: tokens and line icons (stroke, caps and size per theme), no layout variant yet.
'night-ink': { 'night-ink': {
components: { navItem: { radius: 10 }, buttonPrimary: { radius: 10 }, post: { hover: { fill: 'surface' } } }, components: { navItem: { radius: 10 }, buttonPrimary: { radius: 10 }, post: { hover: { fill: 'surface' } }, panel: { preset: 'sheet', radius: 12, shadow: 'deep' } },
decor: { focusRing: { width: 2, color: 'accent', offset: 2 } }, decor: { focusRing: { width: 2, color: 'accent', offset: 2 } },
icons: { pack: 'wb-line', style: { stroke: 1.5 } }, icons: { pack: 'wb-line', style: { stroke: 1.5 } },
}, },
dracula: { dracula: {
components: { buttonPrimary: { radius: 8, fill: 'inverse' }, tab: { radius: 6 }, count: { font: 'mono' } }, components: { buttonPrimary: { radius: 8, fill: 'inverse' }, tab: { radius: 6 }, count: { font: 'mono' }, panel: { preset: 'sheet', radius: 8, shadow: 'deep' } },
icons: { pack: 'wb-line', style: { stroke: 1.75 } }, icons: { pack: 'wb-line', style: { stroke: 1.75 } },
}, },
nord: { nord: {
variants: { actions: 'quiet' }, variants: { actions: 'quiet' },
components: { avatar: { shape: 'squircle' }, buttonPrimary: { radius: 'pill' }, sidebarCard: { radius: 14, borderWidth: 0 } }, components: { avatar: { shape: 'squircle' }, buttonPrimary: { radius: 'pill' }, panel: { preset: 'sheet', radius: 14, shadow: 'soft' }, sidebarCard: { radius: 14, borderWidth: 0 } },
icons: { pack: 'wb-line', style: { stroke: 2, cap: 'round' } }, icons: { pack: 'wb-line', style: { stroke: 2, cap: 'round' } },
}, },
'tokyo-night': { 'tokyo-night': {
variants: { post: 'compact' }, variants: { post: 'compact' },
components: { count: { font: 'numbers' }, buttonPrimary: { radius: 6 } }, components: { count: { font: 'numbers' }, buttonPrimary: { radius: 6 }, panel: { preset: 'sheet', radius: 6, shadow: 'deep' } },
icons: { pack: 'wb-line', style: { stroke: 1.5 } }, icons: { pack: 'wb-line', style: { stroke: 1.5 } },
}, },
'solarized-light': { 'solarized-light': {
components: { avatar: { shape: 'square' }, meta: { case: 'upper', tracking: 0.06, fontSize: 11 }, buttonPrimary: { preset: 'outline', radius: 3, text: 'accent', borderColor: 'accent' } }, components: {
avatar: { shape: 'square' }, meta: { case: 'upper', tracking: 0.06, fontSize: 11 }, buttonPrimary: { preset: 'outline', radius: 3, text: 'accent', borderColor: 'accent' },
panel: { preset: 'sheet', radius: 3, fill: 'bg', shadow: 'soft' },
},
decor: { dividers: { style: 'dotted', color: 'border', width: 1 } }, decor: { dividers: { style: 'dotted', color: 'border', width: 1 } },
icons: { pack: 'wb-line', style: { stroke: 1.75, cap: 'square', join: 'miter' } }, icons: { pack: 'wb-line', style: { stroke: 1.75, cap: 'square', join: 'miter' } },
}, },
vaporwave: { vaporwave: {
components: { displayName: { case: 'upper', tracking: 0.08 }, post: { shadow: 'hard' }, avatar: { shape: 'square' } }, components: {
displayName: { case: 'upper', tracking: 0.08 }, post: { shadow: 'hard' }, avatar: { shape: 'square' },
// Floating layers: neon-edged slabs with the same hard drop as the posts.
panel: { radius: 2, borderWidth: 1, borderStyle: 'solid', borderColor: 'accent', fill: 'surface', shadow: 'hard' },
},
icons: { pack: 'wb-classic' }, icons: { pack: 'wb-classic' },
}, },
'high-contrast': { 'high-contrast': {
components: { buttonPrimary: { borderWidth: 2, borderStyle: 'solid', borderColor: 'accent' }, action: { size: 44 } }, components: {
buttonPrimary: { borderWidth: 2, borderStyle: 'solid', borderColor: 'accent' }, action: { size: 44 },
// Floating layers carry the same 2px white rule as the column.
panel: { radius: 6, borderWidth: 2, borderStyle: 'solid', borderColor: 'border', fill: 'bg', shadow: 'none' },
},
decor: { focusRing: { width: 3, color: 'accent', offset: 2 }, links: { underline: 'always' } }, decor: { focusRing: { width: 3, color: 'accent', offset: 2 }, links: { underline: 'always' } },
icons: { pack: 'wb-line', style: { stroke: 2.25, scale: 1.1 } }, icons: { pack: 'wb-line', style: { stroke: 2.25, scale: 1.1 } },
}, },
'midnight-oled': { 'midnight-oled': {
variants: { actions: 'quiet' }, variants: { actions: 'quiet' },
components: { buttonPrimary: { radius: 'pill' }, navItem: { radius: 'pill' } }, components: { buttonPrimary: { radius: 'pill' }, navItem: { radius: 'pill' }, panel: { preset: 'sheet', radius: 18, shadow: 'none' } },
icons: { pack: 'wb-line', style: { stroke: 1.25 } }, icons: { pack: 'wb-line', style: { stroke: 1.25 } },
}, },
}; };
@ -408,6 +435,8 @@ const CELL = '[data-testid="cellInnerDiv"]';
const MAIN = 'main[role="main"]'; const MAIN = 'main[role="main"]';
const AVATAR = '[data-testid^="UserAvatar-Container"]'; const AVATAR = '[data-testid^="UserAvatar-Container"]';
const RADII = ['border-top-left-radius', 'border-top-right-radius', 'border-bottom-right-radius', 'border-bottom-left-radius']; const RADII = ['border-top-left-radius', 'border-top-right-radius', 'border-bottom-right-radius', 'border-bottom-left-radius'];
/** The radius tokens of X's chat (Tailwind 4 theme variables and shadcn's `--radius`). */
const TAILWIND_RADII = ['--radius', '--radius-xs', '--radius-sm', '--radius-md', '--radius-lg', '--radius-xl', '--radius-2xl', '--radius-3xl', '--radius-4xl'];
const DENSITY: Record<Density, { v: number; h: number; gap: number }> = { compact: { v: 8, h: 14, gap: 8 }, default: { v: 12, h: 16, gap: 12 }, comfortable: { v: 16, h: 20, gap: 14 } }; const DENSITY: Record<Density, { v: number; h: number; gap: number }> = { compact: { v: 8, h: 14, gap: 8 }, default: { v: 12, h: 16, gap: 12 }, comfortable: { v: 16, h: 20, gap: 14 } };
const px = (value: string) => { const m = /^(-?[\d.]+)px$/.exec(value.trim()); return m ? parseFloat(m[1]!) : null; }; const px = (value: string) => { const m = /^(-?[\d.]+)px$/.exec(value.trim()); return m ? parseFloat(m[1]!) : null; };
const round = (value: number) => Math.round(value * 10) / 10; const round = (value: number) => Math.round(value * 10) / 10;
@ -475,6 +504,26 @@ export function buildStructureCss(rules: Iterable<RuleLike>, theme: ThemeSpec, c
const height = px(style.getPropertyValue('line-height')); const height = px(style.getPropertyValue('line-height'));
if (height !== null && height >= 12 && height <= 72) decl.push(`line-height:${round(height * scale)}px !important`); if (height !== null && height >= 12 && height <= 72) decl.push(`line-height:${round(height * scale)}px !important`);
} }
// X's chat sets its radius scale on the rounded elements themselves (`:is(.rounded-md, …){--x-radius-m:1.8}`,
// read live 2026-10-01), so the `:root` value below never reaches them: scale it where X declares it.
if (radiusChanged) {
const scaleVar = parseFloat(style.getPropertyValue('--x-radius-m'));
if (Number.isFinite(scaleVar)) decl.push(`--x-radius-m:${+(scaleVar * shape.radius / 16).toFixed(3)} !important`);
// Its Tailwind radius tokens (`.rounded-3xl{border-radius:var(--radius-3xl)}`, the message box; read live
// 2026-10-01) are declared once on the root or host: scale them there, rem or px, pills kept.
if (/:root|:host/.test(selector)) {
for (const name of TAILWIND_RADII) {
const m = /^([\d.]+)(rem|px)$/.exec(style.getPropertyValue(name).trim());
if (!m) continue;
const size = parseFloat(m[1]!) * (m[2] === 'rem' ? 16 : 1);
if (size >= 2 && size < 100) decl.push(`${name}:${Math.round(size * shape.radius / 16)}px !important`);
}
}
}
// X brightens some dim glyphs with a filter (`.r-1jodnrb{filter:brightness(2.5)}` on the composer's tool
// icons, read live 2026-10-01): a theme already gives them their final, contrast-checked color, which the
// filter would wash out (Classic's blue rendered as cyan, any light theme's icons near white).
if (/^brightness\(/.test(style.getPropertyValue('filter').trim())) decl.push('filter:none !important');
if (radiusChanged || buttonChanged) { if (radiusChanged || buttonChanged) {
for (const property of RADII) { for (const property of RADII) {
const value = style.getPropertyValue(property); const value = style.getPropertyValue(property);
@ -572,7 +621,11 @@ export function buildStructureCss(rules: Iterable<RuleLike>, theme: ThemeSpec, c
// Canvas: the page behind the columns; sidebar modules get a solid backing when it is patterned. // Canvas: the page behind the columns; sidebar modules get a solid backing when it is patterned.
if (theme.background.kind !== 'none' || colors.page !== colors.bg) { if (theme.background.kind !== 'none' || colors.page !== colors.bg) {
out.push(...pageBackgroundCss(theme.background, colors.page)); out.push(...pageBackgroundCss(theme.background, colors.page));
out.push(`[data-testid="sidebarColumn"] div:has(> :is(aside[role="complementary"],section[role="region"],div[aria-label^="Timeline"])){background-color:${colors.bg} !important}`); // One writer per property: a theme whose sidebar cards (or all panels) carry a fill or a preset backs them itself
// (the v2 part is the painted card, live a level above this one, which would otherwise show a second box inside).
const parts = theme.components ?? {};
const cardsOwned = [parts.sidebarCard, parts.panel].some(part => part?.fill !== undefined || part?.preset !== undefined);
if (!cardsOwned) out.push(`[data-testid="sidebarColumn"] div:has(> :is(aside[role="complementary"],section[role="region"],div[aria-label^="Timeline"])){background-color:${colors.bg} !important}`);
out.push(`[data-testid="sidebarColumn"] form[role="search"]{background-color:transparent !important}`); out.push(`[data-testid="sidebarColumn"] form[role="search"]{background-color:transparent !important}`);
// A photo is not a known color, so text over it (the nav) gets a frosted backing. // A photo is not a known color, so text over it (the nav) gets a frosted backing.
if (theme.background.kind === 'image') out.push(`header[role="banner"] > div > div{background-color:${rgba(colors.page, 0.78)};backdrop-filter:blur(14px)}`); if (theme.background.kind === 'image') out.push(`header[role="banner"] > div > div{background-color:${rgba(colors.page, 0.78)};backdrop-filter:blur(14px)}`);

View file

@ -0,0 +1,107 @@
// X's rich-text sentences (a link or bold inside a sentence) for string packs. X renders them with a
// class registered in each language chunk as `_ActualI18NFormatMessage`: its getters (one per key
// id) return the text pieces, and `render` shows piece n followed by the caller's element n through
// `templateReducer`; the callers use `I18NFormatMessage`, an arrow function that creates an element
// of that class. A pack never touches the class or the getters. This adapter registers a subclass in
// its place whose `render` asks the engine for the key's pieces: a pack's replacement (pieces and
// the order of X's own elements, `RichTemplate`) is shown with the caller's real elements, a
// rewritten array goes through X's own reducer, anything else is X's own render. Every step fails
// open: an exception shows X's own sentence.
import type { RichTemplate } from '../../../../waybetter/packages/runtime/src/stringPacks.ts';
export const RICH_CLASS = '_ActualI18NFormatMessage';
export const RICH_ELEMENT = 'I18NFormatMessage';
/** The parts of React the renderer needs; found among what the language chunk itself requires. */
export type ReactLike = {
createElement: (...args: unknown[]) => unknown;
Fragment: unknown;
Children: { toArray(children: unknown): unknown[] };
};
export const isReact = (value: unknown): value is ReactLike => {
const react = value as Partial<ReactLike> | null;
return typeof react === 'object' && react !== null && typeof react.createElement === 'function' && react.Fragment !== undefined && typeof react.Children?.toArray === 'function';
};
type Props = { $i18n?: unknown; children?: unknown };
type Instance = { props: Props; templateReducer: (...args: never[]) => unknown } & Record<string, unknown>;
const isTemplate = (value: unknown): value is RichTemplate =>
typeof value === 'object' && value !== null && !Array.isArray(value) && Array.isArray((value as RichTemplate).pieces) && Array.isArray((value as RichTemplate).order);
/** The renderer for one language chunk. `resolve(id, pieces)` is the engine's answer for a key. */
export function richText(resolve: (id: string, original: unknown) => unknown) {
let react: ReactLike | null = null;
let original: (new (...args: never[]) => unknown) | null = null;
let replacement: unknown = null;
/** `_ActualI18NFormatMessage`: X's class, or a subclass that asks the engine. */
function theClass(value: unknown): unknown {
if (typeof value !== 'function' || !react) return value;
try {
const Base = value as new (...args: never[]) => { render(): unknown };
const React = react;
class Replaced extends Base {
render(): unknown {
try {
const self = this as unknown as Instance;
const id = self.props.$i18n;
if (typeof id !== 'string') return super.render();
const pieces = self[id];
const result = resolve(id, pieces);
if (isTemplate(result)) {
const elements = React.Children.toArray(self.props.children);
const out: unknown[] = [React.Fragment, null];
result.pieces.forEach((piece, index) => {
out.push(piece);
if (index < result.order.length) out.push(elements[result.order[index]!]);
});
return React.createElement(...out);
}
if (Array.isArray(result) && result !== pieces) {
return React.createElement(...(result.reduce(self.templateReducer as never, [React.Fragment, null]) as unknown[]));
}
} catch {
// X's own sentence below.
}
return super.render();
}
}
original = Base;
replacement = Replaced;
return Replaced;
} catch {
return value;
}
}
/** `I18NFormatMessage`: X's arrow, with the element of X's class made of the replacement instead. */
function theElement(value: unknown): unknown {
if (typeof value !== 'function' || !replacement || !react) return value;
const make = value as (props: unknown) => { type?: unknown; props?: unknown; key?: unknown } | null;
const React = react;
return function (this: unknown, props: unknown) {
const element = make.call(this, props);
try {
if (element && element.type === original) {
const own = (element.props ?? {}) as Record<string, unknown>;
return React.createElement(replacement, element.key == null ? own : { ...own, key: element.key });
}
} catch {
// X's own element below.
}
return element;
};
}
return {
/** Offered every module a language chunk requires: React is remembered, nothing is replaced. */
seen(exports: unknown): void { if (!react && isReact(exports)) react = exports; },
/** What to register for a key: the replacement for X's two rich-text entries, `undefined` for any other key. */
intercept(id: string, value: unknown): { value: unknown } | undefined {
if (id === RICH_CLASS) return { value: theClass(value) };
if (id === RICH_ELEMENT) return { value: theElement(value) };
return undefined;
},
};
}

View file

@ -11,8 +11,14 @@ export { CHROME_VAR_NAMES, SHELL_MONO_FONT, SHELL_UI_FONT } from '../../../../wa
/** An X theme as the chrome needs it: its colors (none for X default) and its chrome/mono fonts. */ /** An X theme as the chrome needs it: its colors (none for X default) and its chrome/mono fonts. */
export function chromeTheme(theme: ThemeSpec): ChromeTheme { export function chromeTheme(theme: ThemeSpec): ChromeTheme {
const fonts = resolveFontRoles(theme.font, SHELL_UI_FONT, SHELL_MONO_FONT); const fonts = resolveFontRoles(theme.font, SHELL_UI_FONT, SHELL_MONO_FONT);
const parts = theme.components ?? {};
// A theme built from raised and sunken edges (bevelled buttons, a bevelled rail) gets a bevelled window.
const bevel = [parts.button, parts.buttonPrimary, parts.buttonSecondary].some(part => part?.preset === 'bevel')
|| [parts.nav, parts.menu, parts.panel].some(part => part?.borderStyle === 'bevel-out' || part?.preset === 'window');
return { return {
colors: theme.colors, colors: theme.colors,
radius: theme.shape?.radius ?? null,
edges: bevel ? 'bevel' : null,
// The chrome inherits the theme's interface font (X's Chirp is not available here: then Geist). // The chrome inherits the theme's interface font (X's Chirp is not available here: then Geist).
chromeFont: fonts.chrome.stack !== SHELL_UI_FONT ? fonts.chrome.stack : null, chromeFont: fonts.chrome.stack !== SHELL_UI_FONT ? fonts.chrome.stack : null,
monoFont: fonts.mono.inherited ? null : fonts.mono.stack, monoFont: fonts.mono.inherited ? null : fonts.mono.stack,

View file

@ -54,6 +54,15 @@ export const installController: InstallController<ThemeSpec> = createInstallCont
return { enabled: !keepCurrent, fonts: missingFonts(installed) }; return { enabled: !keepCurrent, fonts: missingFonts(installed) };
}, },
}, },
// An icon pack the owner confirmed joins the theme choice's packs (as Appearance's import does) and is used when asked.
icons: {
async save(pack, { enable }) {
await loadThemes();
const choice = themeState().choice;
const packs = [...(choice.packs ?? []).filter(item => item.id !== pack.id), pack];
await setChoice(enable ? { ...choice, packs, icons: pack.id } : { ...choice, packs });
},
},
onPluginsChanged: () => window.dispatchEvent(new CustomEvent('bt-plugins-changed')), onPluginsChanged: () => window.dispatchEvent(new CustomEvent('bt-plugins-changed')),
onThemesChanged: () => window.dispatchEvent(new CustomEvent('bt-store-changed')), onThemesChanged: () => window.dispatchEvent(new CustomEvent('bt-store-changed')),
onStringsChanged: stringsChanged, onStringsChanged: stringsChanged,

View file

@ -81,8 +81,11 @@ const handlers: Record<string, Handler> = {
mode_get: () => state.modes, mode_get: () => state.modes,
mode_set: ({ mode, onboarded, preset }) => (state.modes = { mode: (mode as string | null) ?? null, onboarded: !!onboarded, existing: true, preset: (preset as Record<string, boolean> | undefined) ?? (mode === state.modes.mode ? state.modes.preset : null) }), mode_set: ({ mode, onboarded, preset }) => (state.modes = { mode: (mode as string | null) ?? null, onboarded: !!onboarded, existing: true, preset: (preset as Record<string, boolean> | undefined) ?? (mode === state.modes.mode ? state.modes.preset : null) }),
// The global theme (the app menu's Theme submenu picks one; the chrome follows). // The global theme (the app menu's Theme submenu picks one; the chrome follows).
x_theme_get: () => state.theme, theme_get: () => state.theme,
x_set_theme: ({ theme }) => { state.theme = theme; return null; }, theme_set: ({ theme }) => { state.theme = theme; return null; },
// Account and pane themes: none saved; `panetheme` sets one after the tabs exist.
theme_scopes_get: () => ({ chrome: 'theme', profiles: {}, panes: {} }),
theme_scopes_set: () => null,
tabs_sync: ({ items }) => { state.sync = items as unknown[]; state.tabProfiles = (items as Array<{ profile: string }>).map(item => item.profile); return null; }, tabs_sync: ({ items }) => { state.sync = items as unknown[]; state.tabProfiles = (items as Array<{ profile: string }>).map(item => item.profile); return null; },
column_configure: ({ id, config }) => { if (config) state.columns[String(id)] = config; else delete state.columns[String(id)]; return null; }, column_configure: ({ id, config }) => { if (config) state.columns[String(id)] = config; else delete state.columns[String(id)]; return null; },
tab_action: () => null, tab_action: () => null,
@ -241,6 +244,8 @@ export async function mountShellHarness(root: HTMLElement) {
api.addPanel({ id: 'right0', component: 'web', title: 'Messages / X', params: { kind: 'web', url: 'https://x.com/messages', title: 'Messages / X', favicon: X_ICON, profile: 'default' }, position: { referencePanel: 'tab0', direction: 'right' } }); api.addPanel({ id: 'right0', component: 'web', title: 'Messages / X', params: { kind: 'web', url: 'https://x.com/messages', title: 'Messages / X', favicon: X_ICON, profile: 'default' }, position: { referencePanel: 'tab0', direction: 'right' } });
api.addPanel({ id: 'right1', component: 'web', title: 'Lists / X', params: { kind: 'web', url: 'https://x.com/i/lists', title: 'Lists / X', favicon: X_ICON, profile: profiles[1]?.id ?? 'default' }, position: { referencePanel: 'right0', direction: 'within' }, inactive: true }); api.addPanel({ id: 'right1', component: 'web', title: 'Lists / X', params: { kind: 'web', url: 'https://x.com/i/lists', title: 'Lists / X', favicon: X_ICON, profile: profiles[1]?.id ?? 'default' }, position: { referencePanel: 'right0', direction: 'within' }, inactive: true });
} }
// `panetheme=<id>` (with `split`): the right pane gets its own theme once it exists (scopes name open tabs only).
if (params.has('split') && params.get('panetheme')) { const { setScopes } = await import('../themes'); await setScopes({ chrome: 'theme', profiles: {}, panes: { right0: params.get('panetheme')! } }); }
store.shell.closed.push( store.shell.closed.push(
{ url: 'https://x.com/TauriApps', profile: 'default', title: 'Tauri (@TauriApps) / X' }, { url: 'https://x.com/TauriApps', profile: 'default', title: 'Tauri (@TauriApps) / X' },
{ url: 'https://github.com/features/copilot', profile: 'default', title: 'GitHub Copilot' }, { url: 'https://github.com/features/copilot', profile: 'default', title: 'GitHub Copilot' },

View file

@ -48,7 +48,7 @@ export function storeHandlers(plugins: { list: Plugin[] }, options: { offline?:
const seed = async () => { const seed = async () => {
for (const item of catalog.items) { for (const item of catalog.items) {
if (item.kind !== 'plugin' || !item.file) continue; if (item.kind !== 'plugin' || !item.file) continue;
const text = textFor(item.url); const text = textFor(item.url ?? '');
if (!text) continue; if (!text) continue;
if (item.id === 'thread-reader' && !plugins.list.some(p => p.file === item.file)) plugins.list.push({ ...pluginMeta(item.file, text), enabled: true }); if (item.id === 'thread-reader' && !plugins.list.some(p => p.file === item.file)) plugins.list.push({ ...pluginMeta(item.file, text), enabled: true });
if (item.id === 'hide-blue-checks' && !plugins.list.some(p => p.file === item.file)) plugins.list.push({ ...pluginMeta(item.file, text), version: '1.1.0', enabled: false }); if (item.id === 'hide-blue-checks' && !plugins.list.some(p => p.file === item.file)) plugins.list.push({ ...pluginMeta(item.file, text), version: '1.1.0', enabled: false });
@ -85,7 +85,7 @@ export function storeHandlers(plugins: { list: Plugin[] }, options: { offline?:
for (const plugin of plugins.list) { for (const plugin of plugins.list) {
const item = catalog.items.find(i => i.file === plugin.file); const item = catalog.items.find(i => i.file === plugin.file);
if (!item) continue; if (!item) continue;
const hash = hashes.get(plugin.file) ?? (plugin.version === item.version ? item.sha256 : 'f'.repeat(64)); const hash = hashes.get(plugin.file) ?? (plugin.version === item.version ? item.sha256 ?? '' : 'f'.repeat(64));
hashes.set(plugin.file, hash); hashes.set(plugin.file, hash);
out[plugin.file] = { version: plugin.version, sha256: hash, enabled: plugin.enabled }; out[plugin.file] = { version: plugin.version, sha256: hash, enabled: plugin.enabled };
} }
@ -93,6 +93,8 @@ export function storeHandlers(plugins: { list: Plugin[] }, options: { offline?:
}; };
return { return {
install_pending: () => [], install_pending: () => [],
// A file the OS hands over has no counterpart in the browser preview.
install_stage_opened: () => { throw new Error('INSTALL: this file is no longer waiting; open it again'); },
install_records: () => ({ items: records }), install_records: () => ({ items: records }),
install_forget: ({ kind, name }) => { delete records[`${kind}:${name}`]; return null; }, install_forget: ({ kind, name }) => { delete records[`${kind}:${name}`]; return null; },
install_cancel: ({ token: id }) => { staged.delete(String(id)); return null; }, install_cancel: ({ token: id }) => { staged.delete(String(id)); return null; },
@ -103,15 +105,15 @@ export function storeHandlers(plugins: { list: Plugin[] }, options: { offline?:
store_stage: async ({ item }) => { store_stage: async ({ item }) => {
const ref = item as { kind: string; id: string }; const ref = item as { kind: string; id: string };
const entry = catalog.items.find(i => i.kind === ref.kind && i.id === ref.id); const entry = catalog.items.find(i => i.kind === ref.kind && i.id === ref.id);
const text = entry && textFor(entry.url); const text = entry && textFor(entry.url ?? '');
if (!entry || !text) throw new Error('STORE: not in the catalog; refresh the store'); if (!entry || !text) throw new Error('STORE: not in the catalog; refresh the store');
await new Promise(resolve => setTimeout(resolve, 250)); await new Promise(resolve => setTimeout(resolve, 250));
// The preview stages themes and plugins; string packs are not mocked here. // The preview stages themes and plugins; string packs are not mocked here.
return stage(entry.kind as 'theme' | 'plugin', entry.file ?? null, text, 'store', entry.url, entry); return stage(entry.kind as 'theme' | 'plugin', entry.file ?? null, text, 'store', entry.url ?? null, entry);
}, },
install_stage_link: async ({ kind, url }) => { install_stage_link: async ({ kind, url }) => {
const entry = catalog.items.find(i => i.url === url); const entry = catalog.items.find(i => i.url === url);
const text = entry && textFor(entry.url); const text = entry && textFor(entry.url ?? '');
await new Promise(resolve => setTimeout(resolve, 250)); await new Promise(resolve => setTimeout(resolve, 250));
if (!text) throw new Error('NETWORK: the server answered 404'); if (!text) throw new Error('NETWORK: the server answered 404');
return stage(kind as 'theme' | 'plugin', entry!.file ?? (String(url).split('/').pop() ?? null), text, 'link', String(url), null); return stage(kind as 'theme' | 'plugin', entry!.file ?? (String(url).split('/').pop() ?? null), text, 'link', String(url), null);

View file

@ -26,7 +26,13 @@ import { PRODUCT, X_PALETTE } from './paletteModel';
import { isXUrl } from './paneModel'; import { isXUrl } from './paneModel';
import { HOME_URL, LOGIN_URL, LOGOUT_URL, X_ACCOUNT_RULES } from './profileModel'; import { HOME_URL, LOGIN_URL, LOGOUT_URL, X_ACCOUNT_RULES } from './profileModel';
import { xSearchUrl } from './searchInput'; import { xSearchUrl } from './searchInput';
import { themes } from './themes'; import { syncWording } from './stringPacks';
import { areaFlag, normalizeFlags, sparseFlags } from '../../../../waybetter/packages/runtime/src/featureTable.ts';
import { flagsChanged } from '../../../../waybetter/packages/shell/src/panel/PluginFeatures.tsx';
import { X_AREAS, X_TABLE } from '../areas/table';
import { X_ICON_PACKS } from '../inject/themeStructure';
import { installController } from './installStore';
import { setChoice, themeState, themes } from './themes';
import { X_DECK, searchCompleter } from './xColumns'; import { X_DECK, searchCompleter } from './xColumns';
const X = 'https://x.com'; const X = 'https://x.com';
@ -52,6 +58,8 @@ function readWording() {
siteChanged(); siteChanged();
}) })
.catch(() => {}); .catch(() => {});
// The wording is also a string pack: the tabs get it (or lose it) when the setting changed.
void syncWording();
} }
export const X_SITE: ShellSite = { export const X_SITE: ShellSite = {
@ -86,15 +94,56 @@ export const X_SITE: ShellSite = {
version: getVersion, version: getVersion,
// "Report a problem": the public repo's new-issue page, and which features paused themselves. // "Report a problem": the public repo's new-issue page, and which features paused themselves.
report: { issueUrl: 'https://git.crt.fyi/CRT/waybetter-for-x/issues/new', details: reportDetails }, report: { issueUrl: 'https://git.crt.fyi/CRT/waybetter-for-x/issues/new', details: reportDetails },
// The macOS menu bar (waybetter-host menu.rs): the eight area plugins, the icon packs and the app's own File and Help items.
native: {
plugins: {
async list() {
const flags = normalizeFlags(X_TABLE, await invoke('features_get'));
return X_AREAS.map(area => ({ id: area.id, label: area.name, checked: flags[areaFlag(area.id)] !== false }));
},
async set(id, on) {
const flags = normalizeFlags(X_TABLE, await invoke('features_get'));
await invoke('features_set', { features: sparseFlags(X_TABLE, { ...flags, [areaFlag(id)]: on }) });
flagsChanged();
},
subscribe: listener => { window.addEventListener('wb-features-changed', listener); return () => window.removeEventListener('wb-features-changed', listener); },
},
iconPacks: {
list() {
const choice = themeState().choice;
const current = choice.icons ?? 'theme';
const packs = [...X_ICON_PACKS.packs, ...(choice.packs ?? []).filter(pack => !X_ICON_PACKS.packs.some(item => item.id === pack.id))];
return [
{ id: 'theme', label: t('wb.appearance.icons.theme'), checked: current === 'theme' },
{ id: 'site', label: t('wb.appearance.icons.site'), checked: current === 'site' },
...packs.map(pack => ({ id: pack.id, label: pack.name, checked: current === pack.id })),
];
},
async set(id) { const choice = themeState().choice; await setChoice({ ...choice, icons: id === 'theme' ? undefined : id }); },
subscribe: listener => themes.subscribe(listener),
},
// A file picked here goes through the same install screen as a dropped one: nothing installs without it.
installFromFile() {
const input = document.createElement('input');
input.type = 'file';
input.accept = '.json,.js';
input.addEventListener('change', () => { const file = input.files?.[0]; if (file) void installController.requestFile(file); });
input.click();
},
shareSetup: () => shell.openPanelSection('backup'),
docs: () => shell.openPanelSection('make'),
website: { label: 'waybetter.fyi', url: 'https://waybetter.fyi' },
},
}, },
overlays: [DraftPickerHost, InstallHost], overlays: [DraftPickerHost, InstallHost],
start() { start() {
// The tweak is set in the wayBetter panel; coming back to the window picks up a change. // The tweak is set in the wayBetter panel; coming back to the window picks up a change.
readWording(); readWording();
window.addEventListener('focus', readWording); window.addEventListener('focus', readWording);
window.addEventListener('wb-features-changed', readWording);
// The first-run screen (Basic / Advanced / Power User) is the panel's: open it when it is due. // The first-run screen (Basic / Advanced / Power User) is the panel's: open it when it is due.
openOnboardingWhenDue(); openOnboardingWhenDue();
return () => window.removeEventListener('focus', readWording); return () => { window.removeEventListener('focus', readWording); window.removeEventListener('wb-features-changed', readWording); };
}, },
}; };

View file

@ -1,17 +1,36 @@
// String packs in the shell of wayBetter for X (waybetter/docs/STRING-PACKS.md): X's inventory in // String packs in the shell of wayBetter for X (waybetter/docs/STRING-PACKS.md): X's inventory in
// its compact form (ids and shapes, none of X's text), what the install screen says about a pack, // its compact form (ids and shapes, none of X's text), what the install screen says about a pack,
// and handing the X tabs the packs that are on (the framework's Languages section does the same). // and handing the X tabs the packs that are on (the framework's Languages section does the same).
import { invoke } from '@tauri-apps/api/core';
import page from '../../strings/x.web.page.json' with { type: 'json' }; import page from '../../strings/x.web.page.json' with { type: 'json' };
import wording from '../../strings/packs/twitter-wording.strings.json' with { type: 'json' };
import type { PageInventory } from '../../../../waybetter/packages/runtime/src/stringPacks.ts'; import type { PageInventory } from '../../../../waybetter/packages/runtime/src/stringPacks.ts';
import { packSummary } from '../../../../waybetter/packages/shell/src/stringPacksModel.ts'; import { packSummary } from '../../../../waybetter/packages/shell/src/stringPacksModel.ts';
import { applyStringPacks } from '../../../../waybetter/packages/shell/src/panel/StringPacks.tsx'; import { applyStringPacks, syncStringPacks, type BuiltInPacks } from '../../../../waybetter/packages/shell/src/panel/StringPacks.tsx';
export const X_WEB_PAGE_INVENTORY: PageInventory = page; export const X_WEB_PAGE_INVENTORY: PageInventory = page;
export const stringsSummary = (text: string) => packSummary(text, X_WEB_PAGE_INVENTORY); export const stringsSummary = (text: string) => packSummary(text, X_WEB_PAGE_INVENTORY);
/**
* The packs the app provides itself: the Twitter wording (Post -> Tweet, Repost -> Retweet; a rewording
* pack that only applies while X is in English) while the `twitterWording` setting is on, which is
* the default. Replaces the older rewriting of a few labels in the page.
*/
export const builtInPacks: BuiltInPacks = async () => {
try {
const features = await invoke<{ twitterWording?: boolean }>('features_get');
return features?.twitterWording === false ? [] : [JSON.stringify(wording)];
} catch {
return [];
}
};
/** At start and when settings change: the X tabs get the built-in and installed packs if that differs from what they have. */
export const syncWording = () => syncStringPacks(X_WEB_PAGE_INVENTORY, builtInPacks).catch(() => false);
/** After an install: the X tabs get the packs that are on; the Languages section reloads its list. */ /** After an install: the X tabs get the packs that are on; the Languages section reloads its list. */
export async function stringsChanged(): Promise<void> { export async function stringsChanged(): Promise<void> {
await applyStringPacks(X_WEB_PAGE_INVENTORY); await applyStringPacks(X_WEB_PAGE_INVENTORY, undefined, builtInPacks);
window.dispatchEvent(new CustomEvent('bt-strings-changed')); window.dispatchEvent(new CustomEvent('bt-strings-changed'));
} }

View file

@ -1,7 +1,7 @@
// X's themes in the wayBetter shell: the framework's theme store (frame/themeStore.ts: global // X's themes in the wayBetter shell: the framework's theme store (frame/themeStore.ts: global
// choice, account/pane scopes, Google fonts, the Theme Builder's preview, the chrome) over X's theme // choice, account/pane scopes, Google fonts, the Theme Builder's preview, the chrome) over X's theme
// documents (src/inject/theme.ts, themeSpec.ts) and X's native commands (`x_theme_get`, // documents (src/inject/theme.ts, themeSpec.ts) and X's native commands (`theme_get`,
// `x_set_theme`, `x_preview_theme`). Appearance, the Theme Builder, font pickers and pane menus // `theme_set`, `theme_preview`). Appearance, the Theme Builder, font pickers and pane menus
// use these; the frame gets the same store as `site.themes`. // use these; the frame gets the same store as `site.themes`.
import { useThemeState as useThemeStateCore } from '../../../../waybetter/packages/shell/src/frame/hooks.ts'; import { useThemeState as useThemeStateCore } from '../../../../waybetter/packages/shell/src/frame/hooks.ts';
@ -18,9 +18,9 @@ export type { InstalledFont, Weights } from '../../../../waybetter/packages/shel
export const themes = createThemeStore<ThemeChoice, ThemeSpec>({ export const themes = createThemeStore<ThemeChoice, ThemeSpec>({
defaultChoice: THEME_DEFAULT, defaultChoice: THEME_DEFAULT,
load: () => invoke<unknown>('x_theme_get').then(normalizeTheme), load: () => invoke<unknown>('theme_get').then(normalizeTheme),
commit: async choice => { await invoke('x_set_theme', { theme: serializeChoice(choice) }); }, commit: async choice => { await invoke('theme_set', { theme: serializeChoice(choice) }); },
preview: async theme => { await invoke('x_preview_theme', { theme: theme ? { preset: theme.id, accent: null, themes: [theme] } : null }); }, preview: async theme => { await invoke('theme_preview', { theme: theme ? { preset: theme.id, accent: null, themes: [theme] } : null }); },
resolve: resolveTheme, resolve: resolveTheme,
preset: choice => choice.preset, preset: choice => choice.preset,
choiceForId, choiceForId,

View file

@ -6,6 +6,7 @@ import { Row, Section, Segmented, Toggle } from '../../../../waybetter/packages/
import { useFlags } from '../../../../waybetter/packages/shell/src/panel/PluginFeatures.tsx'; import { useFlags } from '../../../../waybetter/packages/shell/src/panel/PluginFeatures.tsx';
import type { SectionProps } from '../../../../waybetter/packages/shell/src/panel/site.ts'; import type { SectionProps } from '../../../../waybetter/packages/shell/src/panel/site.ts';
import { X_TABLE } from '../areas/table'; import { X_TABLE } from '../areas/table';
import { syncWording } from '../shell/stringPacks';
import { useT } from '../i18n/index.ts'; import { useT } from '../i18n/index.ts';
const LOGO = { brush: { logoBrush: true, replaceLogo: false }, bird: { logoBrush: false, replaceLogo: true }, x: { logoBrush: false, replaceLogo: false } } as const; const LOGO = { brush: { logoBrush: true, replaceLogo: false }, bird: { logoBrush: false, replaceLogo: true }, x: { logoBrush: false, replaceLogo: false } } as const;
@ -22,7 +23,7 @@ export function Branding({ notify }: SectionProps) {
options={[{ value: 'brush', label: 'wayBetter for X' }, { value: 'bird', label: t('tweaks.logo.bird') }, { value: 'x', label: 'X' }]}/> options={[{ value: 'brush', label: 'wayBetter for X' }, { value: 'bird', label: t('tweaks.logo.bird') }, { value: 'x', label: 'X' }]}/>
</Row> </Row>
<Row label={t('tweaks.wording.label')} hint={t('tweaks.wording.hint')} keywords="tweet retweet post repost"> <Row label={t('tweaks.wording.label')} hint={t('tweaks.wording.hint')} keywords="tweet retweet post repost">
<Segmented label={t('tweaks.wording.label')} value={flags.twitterWording ? 'twitter' : 'x'} onChange={value => void choose({ twitterWording: value === 'twitter' })} <Segmented label={t('tweaks.wording.label')} value={flags.twitterWording ? 'twitter' : 'x'} onChange={value => void choose({ twitterWording: value === 'twitter' }).then(saved => saved && syncWording())}
options={[{ value: 'twitter', label: 'Twitter' }, { value: 'x', label: 'X' }]}/> options={[{ value: 'twitter', label: 'Twitter' }, { value: 'x', label: 'X' }]}/>
</Row> </Row>
</Section>; </Section>;

View file

@ -26,7 +26,7 @@ import { MEASURED_MB_PER_COLUMN, MEASURED_MB_RANGE } from '../shell/xColumns';
import { LOGO_PNG } from './logo-data'; import { LOGO_PNG } from './logo-data';
import { PLUGIN_EXAMPLES, THEME_EXAMPLE } from './makeExamples'; import { PLUGIN_EXAMPLES, THEME_EXAMPLE } from './makeExamples';
import { createStringPacksSection } from '../../../../waybetter/packages/shell/src/panel/StringPacks.tsx'; import { createStringPacksSection } from '../../../../waybetter/packages/shell/src/panel/StringPacks.tsx';
import { X_WEB_PAGE_INVENTORY } from '../shell/stringPacks'; import { X_WEB_PAGE_INVENTORY, builtInPacks } from '../shell/stringPacks';
type XMode = 'light' | 'dim' | 'dark'; type XMode = 'light' | 'dim' | 'dark';
@ -63,7 +63,7 @@ export const X_PANEL: PanelSite = {
}, },
sections: [ sections: [
{ id: 'drafts', label: () => t('panel.section.drafts'), icon: 'M3 13l.6-2.6L10.5 3.5l2 2-6.9 6.9zM9 5l2 2', component: Drafts }, { id: 'drafts', label: () => t('panel.section.drafts'), icon: 'M3 13l.6-2.6L10.5 3.5l2 2-6.9 6.9zM9 5l2 2', component: Drafts },
createStringPacksSection({ inventory: X_WEB_PAGE_INVENTORY }), createStringPacksSection({ inventory: X_WEB_PAGE_INVENTORY, builtIn: builtInPacks }),
], ],
order: ['home', 'themes', 'builder', 'plugins', 'store', 'languages', 'make', 'drafts', 'accounts', 'power', 'settings', 'backup', 'developer', 'updates'], order: ['home', 'themes', 'builder', 'plugins', 'store', 'languages', 'make', 'drafts', 'accounts', 'power', 'settings', 'backup', 'developer', 'updates'],
themes: { themes: {

Some files were not shown because too many files have changed in this diff Show more