Repository navigation
On macOS the desktop app opens the Mac app's data, linked, with its drafts and settings - #266
Conversation
Hush is one app now: the GPUI app's data folder is "Hush" and its key dev.pitis.hush/db-key on every system, which on macOS are the Mac app's own, so its linked device, chats and drafts open as they are. Its appearance, notification content and menu bar choices are taken once from its user defaults. A "Hush Desktop" folder and key from earlier runs move to the new names once, while there is no "Hush" folder, and are otherwise left alone. The app id, login item, Run value and device name become Hush's; an old login item is replaced.
…s an old login item's program - The Mac app's choices are taken inside the take-over, after the move, so a failed move makes no folder (and the import is used on every system). - A Hush folder that can't be looked at counts as there; a lock that can't be taken for another reason than an older copy says so; a move a launch at the same time made counts as done; failures say nothing was moved. - An old login item moves to Hush's name as it was, the copy it opens too. - An old Hush Desktop folder left alone is noted in the Core Log too. - "Hush is already running" says to quit it (on macOS maybe the Mac app). - menuBar.show takes only a Bool; the defaults test uses a domain of its own per run and tolerates cfprefsd removing its file. - Tests: exact contents (never merged), a refused rename, a key that can't be written, the key names, the login item's carry-over. - Docs: README, CLAUDE.md rule, key and home comments.
Review (
|
# Conflicts: # CLAUDE.md # README.md
… there For development and testing only: with the variable set, the data is in that folder and its key in dev-key (0600) beside it, made on first use; the keychain, the real Hush folder, the Hush Desktop move, the login item and the Mac app's settings are left alone. CLAUDE.md says agents and scripts that launch the app set it; make perf keeps measuring the owner's linked data.
|
New tests cover the choice with the variable set, empty or unset, using a fake keychain and folder step that fail the test if called, plus the key file. The ones for new behavior failed against stubs first. Merged with main (already current); the gate passes on the merged head (fmt, both clippy runs, tests: desktop 363, core 541). |
Hush is one app now (the owner's decision of 2026-11-29): on macOS the GPUI app opens the Mac app's own data folder and key, so its linked device, chats and drafts carry over without relinking.
What changed
core/desktop/src/app/home.rs, new): "Hush" in the OS's local app data folder on every system (was "Hush Desktop"). On macOS that is~/Library/Application Support/Hush, the Mac app'sAppStore.dataDirectory, opened as it is. It is settled once per launch, at the firstapp::folder()(whichmaincalls before any window)..lock: if an older copy is running, it stops and says so. Then it copies the key to the new name, renames the folder, and only then removes the old key. If any step before the move fails, the old folder stays where it was, no new "Hush" folder is made (not even for an imported setting), and the window shows the reason with "Nothing was moved: open Hush again to try again." ("Hush couldn't start"). A "Hush" folder that can't be looked at counts as there. When "Hush" already exists, the old folder and key are left alone, and every launch says so in the log and in the Core Log once the core is open.key.rs):dev.pitis.hush/db-key(wasdev.pitis.hush.desktop), i.e. the Mac app'sKeychain.swiftitem in the login keychain (keyring's macOS store is the login keychain).copy_old/forget_oldmove the old one with its folder. The new name overwrites any key already under it, because without its folder that key opens nothing.settings::adopt_mac, macOS only):appearance,notifications.contentandmenuBar.showfrom its user defaults (domaindev.pitis.hush, read through cfprefsd withNSUserDefaults.persistentDomainForName). Each one fills a setting this app hasn't saved yet, so each is taken once. Unknown values are skipped. The Mac app's user defaults are never written. The words match the Mac app's raw values, so the files keep them as they are.APP_IDdev.pitis.HushDesktop→dev.pitis.hush. That is the Windows AUMID, the Linux app id and launcher name, the tray id, the LaunchAgent label and file name, and the autostart file name (the Linux launcher's D-Bus path follows). The Windows Run value "Hush Desktop" → "Hush". The device name the phone shows for new links is "Hush" (the Mac app'sdeviceName). A login item under the old name moves to Hush's name as it was, so the copy of Hush it opens doesn't change (login::replace_old). The new one is written first, then the old one is removed. On macOS the LaunchAgent's label is renamed; on Linux the autostart file is renamed. On Windows the Run value is copied unless it was switched off in Startup settings, then the old Run and StartupApproved values are removed.CLAUDE.md's stack rule now says the desktop app's folder and key are Hush's own, the former Swift app's on macOS, and that renaming either orphans the data. (The README's desktop paragraph that said otherwise went with Hush is the Rust core and the GPUI app: the Swift Mac app and its build are gone #265.)HUSH_DATA_DIR(the owner's decision on this PR), for development and testing only. When it is set and not empty, the app uses that folder instead, and keeps the key indev-key(0600) inside it, made on first use. It never asks the keychain, and it skips the "Hush Desktop" move, the login item replacement and the Mac app's settings import (home::settle,key::file_key). The README and CLAUDE.md say the key sits next to the data. CLAUDE.md also says that agents and scripts that launch the app must set it to a throwaway folder.scripts/perf.shkeeps measuring the owner's linked data (a throwaway folder isn't linked, and its launch ends at the chat list); a caller's ownHUSH_DATA_DIRis used as set. When both "Hush" and "Hush Desktop" exist, "Hush" wins, as built (owner's decision).objc2-foundation(already a direct macOS dependency) gains theNSUserDefaults,NSDictionaryandNSValuefeatures.Cargo.lockis unchanged.Dropped from the issue
client.setDraft/drafts(),AppStore.saveDraft), the same store and keys (chat id) the desktop app reads (drafts.rs). They open with the folder. UserDefaults only holdsdraft.<chat id>keys from versions before drafts moved into the core. The Mac app moves those into the core and removes them at every launch, so none are left in practice.Known limits
Client::openruns (sig_core::loggingis private), as it already is for settings read at launch. The "left alone" note is logged after the core opens, so it shows.Software\Classes\AppUserModelId\dev.pitis.HushDesktop) stays behind. It is a name only: the old app clears its toasts when it quits.Switching on the owner's Mac (once)
main(make desktop), so its core is at least as new as the Mac app's database.make run). macOS asks once whetherhushmay use "dev.pitis.hush" in the keychain: enter the login password and choose Always Allow (Deny changes nothing; it asks again next launch). It opens linked, with chats, drafts, appearance, notification content and the menu bar choice.lsregister -u). Don't use its Unlink: that would unlink the shared device and delete the data.~/Library/Application Support/Hush Desktopfolder and adev.pitis.hush.desktopkeychain item from earlier GPUI runs are left alone. Delete them by hand if they're not needed.How it was tested
home::tests(temp local folders, key steps as closures). The Mac app's folder opens as is and an old one beside it is left alone. A computer with neither gets "Hush" and nothing is made early. The old folder moves with its key once (key copied before the rename, old key removed after). It stays put while its key doesn't copy, and while an older copy holds its.lock.key::tests(keyring's mock store). The old key is copied over any key under the new name and kept until removed. Without an old key, nothing is copied. An old key that can't be read stops the move.settings::tests. The Mac app's choices are taken once and settings saved here win. Unknown or missing values leave the defaults. Through cfprefsd, in a made-up domain (dev.pitis.hush.tests.desktop-defaults, written with/usr/bin/defaults, deleted after, file removed), a text reads as itself and a Bool asfalse.login::tests: an entry under the old name moves to Hush's as it was, and with none there, nothing is written.HUSH_DATA_DIR(these failed first against stubs): with it set, the folder and a key in a file there are used, and the keychain and this computer's folders aren't asked (a fake keychain and a folder step that fail the test if called). Without it, or empty, Hush's own folder and the keychain's key are used. The key file is made once (0600), kept, and made anew after it's forgotten; a key file that doesn't hold a key is never replaced.Keychain.swift's; the "never merged" checks compare exact contents.app::folder()runs only frommain, and no test calls it.core/:cargo fmt --checkpass;cargo clippy --all-targets -q -- -D warningspass;cargo clippy --all-targets --features hush-desktop/snapshot -q -- -D warningspass;cargo test --features hush-desktop/snapshot -qpass (desktop 363, core 541).login.rs: type-checked and clippy-clean (-D warnings) forx86_64-pc-windows-msvcin a scratch crate that includes the file as is. It was not built in the workspace (no cross C toolchain for the core).mainafter Hush is the Rust core and the GPUI app: the Swift Mac app and its build are gone #265 (the Swift app removed); the gate above was run again on the merged head (desktop 363, core 541: pass). No snapshots: nothing on screen changes (a failed move uses the existing "Hush couldn't start" screen). The app wasn't run against the real data, by design.Closes #263