Skip to content

A tiny friend in your Mac's notch and on your iPhone that keeps an eye on your AI coding agents: Claude Code, Codex, Cursor, Gemini CLI, Antigravity and more. Approve from the notch or your Lock Screen.

Windows & Linux: open on hover, and your own sounds

Claude226133482dc7
diff --git a/NotchBuddy/Resources/Localizable.xcstrings b/NotchBuddy/Resources/Localizable.xcstrings
index 548563bb..80b0adb4 100644
--- a/NotchBuddy/Resources/Localizable.xcstrings
+++ b/NotchBuddy/Resources/Localizable.xcstrings
@@ -65,6 +65,70 @@
}
}
},
+ "%lld custom": {
+ "localizations": {
+ "ar": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "%lld مخصّص"
+ }
+ },
+ "bn": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "%lld কাস্টম"
+ }
+ },
+ "en": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "%lld custom"
+ }
+ },
+ "es": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "%lld personalizados"
+ }
+ },
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "%lld personnalisés"
+ }
+ },
+ "hi": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "%lld कस्टम"
+ }
+ },
+ "id": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "%lld kustom"
+ }
+ },
+ "pt-BR": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "%lld personalizados"
+ }
+ },
+ "ru": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "своих: %lld"
+ }
+ },
+ "zh-Hans": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "%lld 个自定义"
+ }
+ }
+ }
+ },
"AUTO": {
"localizations": {
"ar": {
@@ -2625,6 +2689,70 @@
}
}
},
+ "Drop a file named like one of Mochi's sounds (finish.wav, approval.mp3, greet.m4a…) in the sounds folder to replace it, then Reload.": {
+ "localizations": {
+ "ar": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "ضع في مجلد الأصوات ملفًا يحمل اسم أحد أصوات Mochi (finish.wav وapproval.mp3 وgreet.m4a…) ليحل محله، ثم أعد التحميل."
+ }
+ },
+ "bn": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Mochi-র কোনো সাউন্ডের নামে একটি ফাইল (finish.wav, approval.mp3, greet.m4a…) সাউন্ড ফোল্ডারে রাখুন, সেটি বদলে যাবে; তারপর Reload করুন।"
+ }
+ },
+ "en": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Drop a file named like one of Mochi's sounds (finish.wav, approval.mp3, greet.m4a…) in the sounds folder to replace it, then Reload."
+ }
+ },
+ "es": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Deja en la carpeta de sonidos un archivo con el nombre de uno de los sonidos de Mochi (finish.wav, approval.mp3, greet.m4a…) para reemplazarlo y luego recarga."
+ }
+ },
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Déposez dans le dossier des sons un fichier nommé comme l'un des sons de Mochi (finish.wav, approval.mp3, greet.m4a…) pour le remplacer, puis rechargez."
+ }
+ },
+ "hi": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Mochi की किसी साउंड के नाम वाली फ़ाइल (finish.wav, approval.mp3, greet.m4a…) साउंड फ़ोल्डर में रखें, वह उसकी जगह ले लेगी; फिर Reload करें।"
+ }
+ },
+ "id": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Taruh file bernama seperti salah satu suara Mochi (finish.wav, approval.mp3, greet.m4a…) di folder suara untuk menggantinya, lalu muat ulang."
+ }
+ },
+ "pt-BR": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Coloque na pasta de sons um arquivo com o nome de um dos sons do Mochi (finish.wav, approval.mp3, greet.m4a…) para substituí-lo e depois recarregue."
+ }
+ },
+ "ru": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Положите в папку звуков файл с именем одного из звуков Mochi (finish.wav, approval.mp3, greet.m4a…), чтобы заменить его, затем перезагрузите."
+ }
+ },
+ "zh-Hans": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "在声音文件夹中放入与 Mochi 某个声音同名的文件(finish.wav、approval.mp3、greet.m4a…)即可替换它,然后重新载入。"
+ }
+ }
+ }
+ },
"Drop a file or window, or ask me anything.": {
"localizations": {
"ar": {
@@ -3457,6 +3585,70 @@
}
}
},
+ "Hovering the island opens it; it folds again shortly after the pointer leaves. Click inside to keep it open.": {
+ "localizations": {
+ "ar": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "يفتح التمرير فوق الجزيرة ويُطوى بعد مغادرة المؤشر بقليل. انقر داخلها لإبقائها مفتوحة."
+ }
+ },
+ "bn": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "আইল্যান্ডের উপর পয়েন্টার রাখলে খোলে; পয়েন্টার সরালে একটু পরে আবার গুটিয়ে যায়। খোলা রাখতে ভিতরে ক্লিক করুন।"
+ }
+ },
+ "en": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Hovering the island opens it; it folds again shortly after the pointer leaves. Click inside to keep it open."
+ }
+ },
+ "es": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Pasar el cursor por la isla la abre; se pliega poco después de que el cursor salga. Haz clic dentro para dejarla abierta."
+ }
+ },
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Survoler l'île l'ouvre ; elle se replie peu après que le pointeur la quitte. Cliquez dedans pour la garder ouverte."
+ }
+ },
+ "hi": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "आइलैंड पर पॉइंटर ले जाने से वह खुलता है; पॉइंटर हटने के कुछ देर बाद फिर सिमट जाता है। खुला रखने के लिए अंदर क्लिक करें।"
+ }
+ },
+ "id": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Mengarahkan kursor ke pulau akan membukanya; pulau menutup lagi sesaat setelah kursor pergi. Klik di dalamnya agar tetap terbuka."
+ }
+ },
+ "pt-BR": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Passar o cursor pela ilha a abre; ela se fecha logo depois que o cursor sai. Clique dentro para mantê-la aberta."
+ }
+ },
+ "ru": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Наведение открывает остров; он сворачивается вскоре после того, как указатель уходит. Щёлкните внутри, чтобы он остался открытым."
+ }
+ },
+ "zh-Hans": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "将指针悬停在岛上即可打开;指针离开后不久会再次收起。在其中点按可保持打开。"
+ }
+ }
+ }
+ },
"Integrations": {
"localizations": {
"ar": {
@@ -5441,6 +5633,134 @@
}
}
},
+ "Open on hover": {
+ "localizations": {
+ "ar": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "الفتح عند التمرير"
+ }
+ },
+ "bn": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "হোভারে খুলুন"
+ }
+ },
+ "en": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Open on hover"
+ }
+ },
+ "es": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Abrir al pasar el cursor"
+ }
+ },
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Ouvrir au survol"
+ }
+ },
+ "hi": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "होवर पर खोलें"
+ }
+ },
+ "id": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Buka saat kursor di atasnya"
+ }
+ },
+ "pt-BR": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Abrir ao passar o cursor"
+ }
+ },
+ "ru": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Открывать при наведении"
+ }
+ },
+ "zh-Hans": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "悬停时打开"
+ }
+ }
+ }
+ },
+ "Open sounds folder": {
+ "localizations": {
+ "ar": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "فتح مجلد الأصوات"
+ }
+ },
+ "bn": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "সাউন্ড ফোল্ডার খুলুন"
+ }
+ },
+ "en": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Open sounds folder"
+ }
+ },
+ "es": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Abrir la carpeta de sonidos"
+ }
+ },
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Ouvrir le dossier des sons"
+ }
+ },
+ "hi": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "साउंड फ़ोल्डर खोलें"
+ }
+ },
+ "id": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Buka folder suara"
+ }
+ },
+ "pt-BR": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Abrir a pasta de sons"
+ }
+ },
+ "ru": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Открыть папку звуков"
+ }
+ },
+ "zh-Hans": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "打开声音文件夹"
+ }
+ }
+ }
+ },
"Open terminal": {
"localizations": {
"ar": {
@@ -6017,6 +6337,70 @@
}
}
},
+ "Reload sounds": {
+ "localizations": {
+ "ar": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "إعادة تحميل الأصوات"
+ }
+ },
+ "bn": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "সাউন্ড আবার লোড করুন"
+ }
+ },
+ "en": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Reload sounds"
+ }
+ },
+ "es": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Recargar sonidos"
+ }
+ },
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Recharger les sons"
+ }
+ },
+ "hi": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "साउंड फिर से लोड करें"
+ }
+ },
+ "id": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Muat ulang suara"
+ }
+ },
+ "pt-BR": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Recarregar sons"
+ }
+ },
+ "ru": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Перезагрузить звуки"
+ }
+ },
+ "zh-Hans": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "重新载入声音"
+ }
+ }
+ }
+ },
"Reply in terminal": {
"localizations": {
"ar": {
@@ -12993,7 +13377,6 @@
}
}
},
-
"plugin.install": {
"localizations": {
"ar": {
@@ -16770,7 +17153,6 @@
}
}
},
-
"status.codex-hooks-installed": {
"localizations": {
"ar": {
diff --git a/windows/README.md b/windows/README.md
index cf48b882..1b96423f 100644
--- a/windows/README.md
+++ b/windows/README.md
@@ -51,7 +51,7 @@ You can also [build it yourself](#build-it-yourself).
| What you do | What happens |
|---|---|
| Move the mouse to the very top-centre of the screen | Mochi peeks out |
-| Click the small island | It opens |
+| Click the small island | It opens. With **Settings → General → Open on hover**, resting the pointer on it is enough, and it folds again shortly after the pointer leaves (click inside to keep it open) |
| Click Mochi | It gets annoyed. Three times in a row and it goes dizzy |
| Rest the pointer on Mochi for two seconds | Hearts |
| Right-click Mochi | The wardrobe: rest the pointer on an outfit to try it on, click to keep it. **Auto** dresses him for the season (witch hat in October, Santa hat in December…) |
@@ -60,6 +60,7 @@ You can also [build it yourself](#build-it-yourself).
| Drag a file onto the island | Mochi turns into a box, swallows it, then offers to answer questions about it |
| Click a file in the session ticker | Its diff opens in the island; ↗ opens the file in VS Code, ‹ or `Esc` goes back |
| `Esc` | Closes the island |
+| Put a file named like one of Mochi's sounds (`finish.wav`, `approval.mp3`, `greet.m4a`…) in the sounds folder | It replaces that sound after **Settings → General → Reload sounds**. **Open sounds folder** shows the folder: `~/.config/coucou/sounds` on Linux, `%APPDATA%\Coucou\sounds` on Windows |
| Tray icon | Open, Weekly recap, Wardrobe…, Settings…, Pause, Quit |
| `Ctrl+Alt+Space` | Opens the chat, from any app |
| `Ctrl+Alt+A` | Jumps to the waiting permission or question |
diff --git a/windows/src-tauri/src/lib.rs b/windows/src-tauri/src/lib.rs
index 3667b5e8..75cd2ebb 100644
--- a/windows/src-tauri/src/lib.rs
+++ b/windows/src-tauri/src/lib.rs
@@ -25,6 +25,7 @@ mod secrets;
mod session_window;
mod settings;
mod shortcuts;
+mod sounds;
mod tray;
#[cfg(windows)]
mod webview_drop;
@@ -710,6 +711,10 @@ pub fn run() {
desktop::desktop_mochi_fly_out,
desktop::desktop_mochi_fly_home,
desktop::desktop_mochi_set_asleep,
+ sounds::custom_sounds,
+ sounds::custom_sound,
+ sounds::reveal_sounds_folder,
+ sounds::reload_sounds,
])
.setup(move |app| {
let handle = app.handle().clone();
diff --git a/windows/src-tauri/src/settings.rs b/windows/src-tauri/src/settings.rs
index 2eec83fc..26590ef8 100644
--- a/windows/src-tauri/src/settings.rs
+++ b/windows/src-tauri/src/settings.rs
@@ -16,6 +16,9 @@ pub struct Settings {
pub sound_enabled: bool,
pub sound_volume: f64,
pub auto_close_interval: f64,
+ /// Hovering the island opens it all the way, and it folds again shortly
+ /// after the pointer leaves (the Mac's "Open on hover"). Off by default.
+ pub open_on_hover: bool,
pub absence_interval: f64,
pub active_integrations: Vec<String>,
/// The always-on workspace pill (src/core/pills.ts checks it is one).
@@ -95,6 +98,7 @@ impl Default for Settings {
sound_enabled: true,
sound_volume: 0.12,
auto_close_interval: 15.0,
+ open_on_hover: false,
absence_interval: 180.0,
active_integrations: vec![
"integration_resend".into(),
@@ -376,6 +380,7 @@ mod tests {
"soundEnabled": false,
"soundVolume": 0.5,
"autoCloseInterval": 30.0,
+ "openOnHover": true,
"absenceInterval": 60.0,
"activeIntegrations": ["integration_notion"],
"mainPill": "agent_cursor",
@@ -778,6 +783,7 @@ mod tests {
"soundEnabled",
"soundVolume",
"autoCloseInterval",
+ "openOnHover",
"absenceInterval",
"activeIntegrations",
"mainPill",
diff --git a/windows/src-tauri/src/sounds.rs b/windows/src-tauri/src/sounds.rs
new file mode 100644
index 00000000..a4179ebc
--- /dev/null
+++ b/windows/src-tauri/src/sounds.rs
@@ -0,0 +1,100 @@
+// Your own sounds: a file named like one of Mochi's sounds in the sounds folder
+// replaces it (finish.wav, approval.mp3, greet.m4a…), as on the Mac
+// (SoundEngine.customFolder). The folder is platform::config_dir()/sounds:
+// ~/.config/coucou/sounds on Linux, %APPDATA%\Coucou\sounds on Windows.
+//
+// The page decodes the bytes itself; a file it can't decode falls back to the
+// built-in sound there (src/core/sound.ts).
+
+use crate::platform;
+use std::path::{Path, PathBuf};
+use tauri::{AppHandle, Emitter};
+
+/// Formats a webview can usually decode, looked for in this order.
+const EXTENSIONS: [&str; 10] = ["wav", "mp3", "ogg", "oga", "m4a", "aac", "flac", "aiff", "aif", "caf"];
+/// A sound effect, not an album: anything bigger is left alone.
+const MAX_BYTES: u64 = 8 * 1024 * 1024;
+
+pub fn folder() -> PathBuf {
+ platform::config_dir().join("sounds")
+}
+
+/// A sound name is a bare lowercase word ("finish"): nothing that could leave the folder.
+fn valid_name(name: &str) -> bool {
+ !name.is_empty() && name.len() <= 32 && name.bytes().all(|b| b.is_ascii_lowercase())
+}
+
+/// The user's file for `name` in `dir`, if there is a usable one.
+fn custom_file(dir: &Path, name: &str) -> Option<PathBuf> {
+ if !valid_name(name) {
+ return None;
+ }
+ EXTENSIONS.iter().map(|ext| dir.join(format!("{name}.{ext}"))).find(|p| {
+ std::fs::metadata(p).map(|m| m.is_file() && m.len() > 0 && m.len() <= MAX_BYTES).unwrap_or(false)
+ })
+}
+
+/// Which of `names` have a file of the user's own.
+#[tauri::command]
+pub fn custom_sounds(names: Vec<String>) -> Vec<String> {
+ let dir = folder();
+ names.into_iter().filter(|n| custom_file(&dir, n).is_some()).collect()
+}
+
+/// The bytes of the user's file for `name`, sent as they are.
+#[tauri::command]
+pub fn custom_sound(name: String) -> Result<tauri::ipc::Response, String> {
+ let path = custom_file(&folder(), &name).ok_or_else(|| format!("no custom sound for {name}"))?;
+ std::fs::read(&path).map(tauri::ipc::Response::new).map_err(|e| e.to_string())
+}
+
+/// Settings → Open sounds folder: creates it if needed and shows it.
+#[tauri::command]
+pub fn reveal_sounds_folder() {
+ let dir = folder();
+ let _ = std::fs::create_dir_all(&dir);
+ platform::reveal_folder(&dir.to_string_lossy());
+}
+
+/// Settings → Reload sounds: the island reads the folder again.
+#[tauri::command]
+pub fn reload_sounds(app: AppHandle) {
+ let _ = app.emit("sounds-changed", ());
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+
+ fn scratch(tag: &str) -> PathBuf {
+ let dir = std::env::temp_dir().join(format!("coucou-sounds-{tag}-{}", std::process::id()));
+ let _ = std::fs::remove_dir_all(&dir);
+ std::fs::create_dir_all(&dir).unwrap();
+ dir
+ }
+
+ #[test]
+ fn a_file_named_like_a_sound_replaces_it_in_the_first_format_found() {
+ let dir = scratch("pick");
+ std::fs::write(dir.join("finish.mp3"), b"mp3").unwrap();
+ std::fs::write(dir.join("finish.wav"), b"wav").unwrap();
+ assert_eq!(custom_file(&dir, "finish"), Some(dir.join("finish.wav")));
+ std::fs::write(dir.join("greet.m4a"), b"m4a").unwrap();
+ assert_eq!(custom_file(&dir, "greet"), Some(dir.join("greet.m4a")));
+ assert_eq!(custom_file(&dir, "approval"), None);
+ }
+
+ #[test]
+ fn nothing_outside_the_folder_or_unusable_is_read() {
+ let dir = scratch("guard");
+ std::fs::write(dir.join("empty.wav"), b"").unwrap();
+ std::fs::create_dir_all(dir.join("folder.wav")).unwrap();
+ std::fs::write(dir.join("notes.txt"), b"x").unwrap();
+ assert_eq!(custom_file(&dir, "empty"), None);
+ assert_eq!(custom_file(&dir, "folder"), None);
+ assert_eq!(custom_file(&dir, "notes"), None);
+ for bad in ["../finish", "Finish", "fin ish", "", "a/b", "finish.wav"] {
+ assert!(!valid_name(bad), "{bad}");
+ }
+ }
+}
diff --git a/windows/src/core/bridge.ts b/windows/src/core/bridge.ts
index 1bbf25fc..9db704fa 100644
--- a/windows/src/core/bridge.ts
+++ b/windows/src/core/bridge.ts
@@ -58,6 +58,14 @@ export const Bridge = {
openUrl: (url: string) => call<void>("open_url", { url }),
+ /** Which of these sounds have a file of the user's own in the sounds folder. */
+ customSounds: (names: readonly string[]) => call<string[]>("custom_sounds", { names }),
+ /** The user's file for one sound, as raw bytes. */
+ customSound: (name: string) => call<ArrayBuffer>("custom_sound", { name }),
+ revealSoundsFolder: () => call<void>("reveal_sounds_folder"),
+ /** Tells the island to read the sounds folder again ("sounds-changed"). */
+ reloadSounds: () => call<void>("reload_sounds"),
+
/** "Open terminal" → opens the folder in VS Code when `code` is on PATH. */
openInVSCode: (path: string | null) => call<boolean>("open_in_vscode", { path }),
diff --git a/windows/src/core/sound.ts b/windows/src/core/sound.ts
index afe9342a..ed0701af 100644
--- a/windows/src/core/sound.ts
+++ b/windows/src/core/sound.ts
@@ -2,6 +2,10 @@
// The 29 WAVs are the macOS app's own files (see SOUNDS_DIR in vite.config.ts);
// they are served at /sounds/<name>.wav. Default volume 0.12, slider range 0–0.2,
// exactly like the Mac player, and several sounds may overlap.
+// A file of the user's own in the sounds folder (src-tauri/src/sounds.rs)
+// replaces a sound; one that doesn't decode falls back to the built-in one.
+
+import { Bridge } from "./bridge";
export const SOUND_NAMES = [
"peek", "open", "close", "hover", "blip", "slap", "annoyed", "dizzy", "greet",
@@ -21,6 +25,8 @@ class SoundEngine {
private buffers = new Map<string, AudioBuffer>();
private loading: Promise<void> | null = null;
private idleTimer: number | null = null;
+ /** The sounds a file of the user's own replaces, as last loaded. */
+ customized = new Set<string>();
/** Sounds still playing, by name, so one can be faded out (the greeting). */
private playing = new Map<string, Set<{ src: AudioBufferSourceNode; gain: GainNode }>>();
@@ -36,20 +42,45 @@ class SoundEngine {
master.gain.value = this.volume;
master.connect(ctx.destination);
this.master = master;
- await Promise.all(
- SOUND_NAMES.map(async (name) => {
+ await this.loadAll(ctx);
+ })();
+ return this.loading;
+ }
+
+ /** Reads the sounds folder again (Settings → Reload sounds). */
+ async reload(): Promise<void> {
+ await this.preload();
+ if (this.ctx) await this.loadAll(this.ctx);
+ }
+
+ private async loadAll(ctx: AudioContext) {
+ const own = new Set((await Bridge.customSounds(SOUND_NAMES)) ?? []);
+ const customized = new Set<string>();
+ await Promise.all(
+ SOUND_NAMES.map(async (name) => {
+ if (own.has(name)) {
try {
- const res = await fetch(`/sounds/${name}.wav`);
- if (!res.ok) return;
- const buf = await ctx.decodeAudioData(await res.arrayBuffer());
- this.buffers.set(name, buf);
+ const bytes = await Bridge.customSound(name);
+ if (bytes && bytes.byteLength > 0) {
+ this.buffers.set(name, await ctx.decodeAudioData(bytes));
+ customized.add(name);
+ return;
+ }
} catch {
- /* a missing sound must never break the island */
+ /* not a format this webview decodes: the built-in sound stays */
}
- }),
- );
- })();
- return this.loading;
+ }
+ try {
+ const res = await fetch(`/sounds/${name}.wav`);
+ if (!res.ok) return;
+ const buf = await ctx.decodeAudioData(await res.arrayBuffer());
+ this.buffers.set(name, buf);
+ } catch {
+ /* a missing sound must never break the island */
+ }
+ }),
+ );
+ this.customized = customized;
}
/** WebView2 can hand us a suspended context; call after any user input. */
diff --git a/windows/src/core/state.ts b/windows/src/core/state.ts
index b395a4e3..6a851e65 100644
--- a/windows/src/core/state.ts
+++ b/windows/src/core/state.ts
@@ -100,6 +100,8 @@ export interface Settings {
soundEnabled: boolean;
soundVolume: number;
autoCloseInterval: number;
+ /** Hovering the island opens it all the way (off: hovering only peeks). */
+ openOnHover: boolean;
absenceInterval: number;
/** Declared pills next to the main one (at most 4), in the order they were added. */
activeIntegrations: string[];
@@ -154,6 +156,7 @@ export const DEFAULT_SETTINGS: Settings = {
soundEnabled: true,
soundVolume: 0.12,
autoCloseInterval: 15,
+ openOnHover: false,
absenceInterval: 180,
activeIntegrations: [
"integration_resend", "integration_n8n", "integration_vercel", "integration_github",
diff --git a/windows/src/i18n/strings.json b/windows/src/i18n/strings.json
index 12a8a375..e5a98f79 100644
--- a/windows/src/i18n/strings.json
+++ b/windows/src/i18n/strings.json
@@ -827,6 +827,17 @@
"ru": "Черновик",
"id": "Draf"
},
+ "Drop a file named like one of Mochi's sounds (finish.wav, approval.mp3, greet.m4a…) in the sounds folder to replace it, then Reload.": {
+ "zh-Hans": "在声音文件夹中放入与 Mochi 某个声音同名的文件(finish.wav、approval.mp3、greet.m4a…)即可替换它,然后重新载入。",
+ "hi": "Mochi की किसी साउंड के नाम वाली फ़ाइल (finish.wav, approval.mp3, greet.m4a…) साउंड फ़ोल्डर में रखें, वह उसकी जगह ले लेगी; फिर Reload करें।",
+ "es": "Deja en la carpeta de sonidos un archivo con el nombre de uno de los sonidos de Mochi (finish.wav, approval.mp3, greet.m4a…) para reemplazarlo y luego recarga.",
+ "ar": "ضع في مجلد الأصوات ملفًا يحمل اسم أحد أصوات Mochi (finish.wav وapproval.mp3 وgreet.m4a…) ليحل محله، ثم أعد التحميل.",
+ "fr": "Déposez dans le dossier des sons un fichier nommé comme l'un des sons de Mochi (finish.wav, approval.mp3, greet.m4a…) pour le remplacer, puis rechargez.",
+ "bn": "Mochi-র কোনো সাউন্ডের নামে একটি ফাইল (finish.wav, approval.mp3, greet.m4a…) সাউন্ড ফোল্ডারে রাখুন, সেটি বদলে যাবে; তারপর Reload করুন।",
+ "pt-BR": "Coloque na pasta de sons um arquivo com o nome de um dos sons do Mochi (finish.wav, approval.mp3, greet.m4a…) para substituí-lo e depois recarregue.",
+ "ru": "Положите в папку звуков файл с именем одного из звуков Mochi (finish.wav, approval.mp3, greet.m4a…), чтобы заменить его, затем перезагрузите.",
+ "id": "Taruh file bernama seperti salah satu suara Mochi (finish.wav, approval.mp3, greet.m4a…) di folder suara untuk menggantinya, lalu muat ulang."
+ },
"Drop a file or window, or ask me anything.": {
"zh-Hans": "拖入文件或窗口,或问我任何问题。",
"hi": "कोई फ़ाइल या विंडो ड्रॉप करें, या कुछ भी पूछें।",
@@ -1212,6 +1223,17 @@
"ru": "Горячая клавиша",
"id": "Tombol pintas"
},
+ "Hovering the island opens it; it folds again shortly after the pointer leaves. Click inside to keep it open.": {
+ "zh-Hans": "将指针悬停在岛上即可打开;指针离开后不久会再次收起。在其中点按可保持打开。",
+ "hi": "आइलैंड पर पॉइंटर ले जाने से वह खुलता है; पॉइंटर हटने के कुछ देर बाद फिर सिमट जाता है। खुला रखने के लिए अंदर क्लिक करें।",
+ "es": "Pasar el cursor por la isla la abre; se pliega poco después de que el cursor salga. Haz clic dentro para dejarla abierta.",
+ "ar": "يفتح التمرير فوق الجزيرة ويُطوى بعد مغادرة المؤشر بقليل. انقر داخلها لإبقائها مفتوحة.",
+ "fr": "Survoler l'île l'ouvre ; elle se replie peu après que le pointeur la quitte. Cliquez dedans pour la garder ouverte.",
+ "bn": "আইল্যান্ডের উপর পয়েন্টার রাখলে খোলে; পয়েন্টার সরালে একটু পরে আবার গুটিয়ে যায়। খোলা রাখতে ভিতরে ক্লিক করুন।",
+ "pt-BR": "Passar o cursor pela ilha a abre; ela se fecha logo depois que o cursor sai. Clique dentro para mantê-la aberta.",
+ "ru": "Наведение открывает остров; он сворачивается вскоре после того, как указатель уходит. Щёлкните внутри, чтобы он остался открытым.",
+ "id": "Mengarahkan kursor ke pulau akan membukanya; pulau menutup lagi sesaat setelah kursor pergi. Klik di dalamnya agar tetap terbuka."
+ },
"Install": {
"zh-Hans": "安装",
"hi": "इंस्टॉल करें",
@@ -1916,6 +1938,17 @@
"ru": "Открыть в n8n",
"id": "Buka di n8n"
},
+ "Open on hover": {
+ "zh-Hans": "悬停时打开",
+ "hi": "होवर पर खोलें",
+ "es": "Abrir al pasar el cursor",
+ "ar": "الفتح عند التمرير",
+ "fr": "Ouvrir au survol",
+ "bn": "হোভারে খুলুন",
+ "pt-BR": "Abrir ao passar o cursor",
+ "ru": "Открывать при наведении",
+ "id": "Buka saat kursor di atasnya"
+ },
"Open selected item": {
"zh-Hans": "打开选定项",
"hi": "चयनित आइटम खोलें",
@@ -1938,6 +1971,17 @@
"ru": "Открыть настройки",
"id": "Buka Pengaturan"
},
+ "Open sounds folder": {
+ "zh-Hans": "打开声音文件夹",
+ "hi": "साउंड फ़ोल्डर खोलें",
+ "es": "Abrir la carpeta de sonidos",
+ "ar": "فتح مجلد الأصوات",
+ "fr": "Ouvrir le dossier des sons",
+ "bn": "সাউন্ড ফোল্ডার খুলুন",
+ "pt-BR": "Abrir a pasta de sons",
+ "ru": "Открыть папку звуков",
+ "id": "Buka folder suara"
+ },
"Open terminal": {
"zh-Hans": "打开终端",
"hi": "टर्मिनल खोलें",
@@ -2202,6 +2246,17 @@
"ru": "Ретранслятор: не установлен",
"id": "Relay: belum terpasang"
},
+ "Reload sounds": {
+ "zh-Hans": "重新载入声音",
+ "hi": "साउंड फिर से लोड करें",
+ "es": "Recargar sonidos",
+ "ar": "إعادة تحميل الأصوات",
+ "fr": "Recharger les sons",
+ "bn": "সাউন্ড আবার লোড করুন",
+ "pt-BR": "Recarregar sons",
+ "ru": "Перезагрузить звуки",
+ "id": "Muat ulang suara"
+ },
"Remove from favorites": {
"zh-Hans": "取消收藏",
"hi": "पसंदीदा से हटाएँ",
@@ -3225,6 +3280,17 @@
"ru": "с {name}",
"id": "dengan {name}"
},
+ "{0} custom": {
+ "zh-Hans": "{0} 个自定义",
+ "hi": "{0} कस्टम",
+ "es": "{0} personalizados",
+ "ar": "{0} مخصّص",
+ "fr": "{0} personnalisés",
+ "bn": "{0} কাস্টম",
+ "pt-BR": "{0} personalizados",
+ "ru": "своих: {0}",
+ "id": "{0} kustom"
+ },
"{0} — open Spotify": {
"zh-Hans": "{0} — 打开 Spotify",
"hi": "{0} — Spotify खोलें",
diff --git a/windows/src/island/fsm.ts b/windows/src/island/fsm.ts
index 64ef4285..23b65eee 100644
--- a/windows/src/island/fsm.ts
+++ b/windows/src/island/fsm.ts
@@ -29,6 +29,17 @@ export class IslandStateMachine {
greetHoverCollapseDelay = 10;
/** An alert waiting for an answer stays open, even when the mouse leaves. */
pinned = false;
+ /**
+ * Hovering opens the island all the way instead of peeking (Settings →
+ * General → Open on hover, off by default), as IslandStateMachine.openOnHover.
+ */
+ openOnHover = false;
+ /** Grace period after the pointer leaves a hover-opened island, seconds. */
+ hoverCloseDelay = 0.6;
+ /** Open because of a hover, until the user clicks inside it. */
+ get openedByHover(): boolean {
+ return this.byHover;
+ }
/**
* When the open island will fold, on the performance.now() clock, while the
@@ -38,6 +49,7 @@ export class IslandStateMachine {
homeCollapseDueAt: number | null = null;
private homeDelay = 15;
+ private byHover = false;
private petitHide: number | null = null;
private homeCollapse: number | null = null;
private greetCollapse: number | null = null;
@@ -50,6 +62,12 @@ export class IslandStateMachine {
}
mouseEntered() {
+ if (this.openOnHover && (this.state === "hidden" || this.state === "petit") && !this.pinned) {
+ this.cancelTimers();
+ this.byHover = true;
+ this.transition("home");
+ return;
+ }
switch (this.state) {
case "hidden":
this.cancelTimers();
@@ -85,6 +103,7 @@ export class IslandStateMachine {
}
click() {
+ this.byHover = false;
if (this.state !== "petit") return;
this.cancelTimers();
this.transition("home");
@@ -104,19 +123,33 @@ export class IslandStateMachine {
this.schedulePetitHide();
}
+ /**
+ * The user clicked inside the island: a hover-opened island now stays like
+ * any open island (normal auto-close) instead of folding once the pointer leaves.
+ */
+ userInteracted() {
+ if (!this.byHover) return;
+ this.byHover = false;
+ // The short countdown already running becomes the normal one.
+ if (this.state === "home" && this.homeCollapse != null) this.scheduleHomeCollapse();
+ }
+
/** Alert or explicit request: open straight to expanded. */
forceHome() {
+ this.byHover = false;
this.cancelTimers();
this.transition("home");
}
/// Explicit close (OK button, Escape, an alert being answered).
forcePetit() {
+ this.byHover = false;
this.cancelTimers();
this.transition("petit");
}
forceHidden() {
+ this.byHover = false;
this.cancelTimers();
this.transition("hidden");
}
@@ -137,13 +170,16 @@ export class IslandStateMachine {
private scheduleHomeCollapse() {
this.clear("homeCollapse");
if (this.pinned) return;
- const ms = this.homeDelay * 1000;
+ const ms = (this.byHover ? this.hoverCloseDelay : this.homeDelay) * 1000;
this.homeCollapseDueAt = performance.now() + ms;
this.homeCollapse = window.setTimeout(() => {
this.homeCollapse = null;
this.homeCollapseDueAt = null;
// An alert pinned while the countdown ran keeps the island open.
- if (this.state === "home" && !this.pinned) this.transition("petit");
+ if (this.state === "home" && !this.pinned) {
+ this.byHover = false;
+ this.transition("petit");
+ }
}, ms);
}
diff --git a/windows/src/island/island.ts b/windows/src/island/island.ts
index 43279c29..be043df0 100644
--- a/windows/src/island/island.ts
+++ b/windows/src/island/island.ts
@@ -303,6 +303,7 @@ export class Island {
private wireFsm() {
this.fsm.homeToPetitDelay = State.settings.autoCloseInterval;
+ this.fsm.openOnHover = State.settings.openOnHover;
this.fsm.onTransition = (from, to) => {
// The greeting is over, however it ended: back to his desktop spot.
if (from === "coucou" && to !== "coucou") this.desktop.launch();
@@ -698,6 +699,8 @@ export class Island {
this.islandEl.addEventListener("mousedown", (e) => {
Sound.resume();
State.lastActivity = performance.now();
+ // A click makes a hover-opened island an ordinary open one.
+ this.fsm.userInteracted();
// A press on Mochi may become a drag out to the desktop.
if (e.button === 0 && this.isBotHit(e.clientX, e.clientY)) {
this.botPress = { x: e.clientX, y: e.clientY };
@@ -810,14 +813,18 @@ export class Island {
x >= rect.x - HIT_MARGIN && x <= rect.x + rect.w + HIT_MARGIN &&
y >= rect.y - HIT_MARGIN && y <= rect.y + rect.h + HIT_MARGIN;
- if (inIsland && !this.wasInIsland) {
+ // Recorded before the state machine hears of it: a transition it makes
+ // right away (open on hover) reads where the pointer is, and must not see
+ // the pointer as still outside.
+ const wasIn = this.wasInIsland;
+ this.wasInIsland = inIsland;
+ if (inIsland && !wasIn) {
if (this.fsm.state === "coucou") this.greeting.hover();
this.fsm.mouseEntered();
}
- if (!inIsland && this.wasInIsland) {
+ if (!inIsland && wasIn) {
this.fsm.mouseLeft();
}
- this.wasInIsland = inIsland;
// Bot hover → love
const overBot = State.mode === "expanded" && State.stateOverride == null && this.isBotHit(x, y);
@@ -1146,6 +1153,7 @@ export class Island {
Sound.setEnabled(State.settings.soundEnabled);
Sound.setVolume(State.settings.soundVolume);
this.fsm.homeToPetitDelay = State.settings.autoCloseInterval;
+ this.fsm.openOnHover = State.settings.openOnHover;
State.notify();
}
diff --git a/windows/src/main.ts b/windows/src/main.ts
index 36d446dc..0403264f 100644
--- a/windows/src/main.ts
+++ b/windows/src/main.ts
@@ -78,6 +78,11 @@ async function main() {
await onEvent<null>("screen-changed", () => void Bridge.reposition());
+ // Settings → Reload sounds: read the sounds folder again, and let them hear it.
+ await onEvent<null>("sounds-changed", () => {
+ void Sound.reload().then(() => Sound.play("pop"));
+ });
+
// The settings window writes preferences; apply them here without a restart.
await onEvent<Settings>("settings-changed", (s) => {
const previousMain = State.mainPillId;
diff --git a/windows/src/settings/main.ts b/windows/src/settings/main.ts
index 8571126a..c519f206 100644
--- a/windows/src/settings/main.ts
+++ b/windows/src/settings/main.ts
@@ -10,6 +10,7 @@ import {
recordPress, type Binding,
} from "../core/shortcuts";
import { DEFAULT_SETTINGS, type Settings } from "../core/state";
+import { SOUND_NAMES } from "../core/sound";
import {
MAX_DECLARED, PILL_CATEGORIES, availablePills, chooseMainPill, isComingSoon, mainPillChoices,
sanitizeDeclared, toggleDeclared, type PillDefinition,
@@ -870,6 +871,20 @@ function generalSection(): HTMLElement {
void save();
});
+ // Your own sounds: the folder, a reload, and how many are replaced.
+ const customCount = h("span", { class: "hint" });
+ const countCustom = () =>
+ void Bridge.customSounds(SOUND_NAMES).then((own) => {
+ const n = own?.length ?? 0;
+ customCount.textContent = n > 0 ? t("{0} custom", { 0: n }) : "";
+ });
+ countCustom();
+ const soundsFolder = h("button", { text: t("Open sounds folder"), onclick: () => void Bridge.revealSoundsFolder() });
+ const reloadSounds = h("button", {
+ text: t("Reload sounds"),
+ onclick: () => void Bridge.reloadSounds().then(() => window.setTimeout(countCustom, 300)),
+ });
+
const autoClose = h("input", {
type: "number", min: "5", max: "120", step: "1",
value: String(Math.round(settings.autoCloseInterval)),
@@ -916,6 +931,13 @@ function generalSection(): HTMLElement {
toggle(settings.soundEnabled, (v) => { settings.soundEnabled = v; void save(); }),
volume,
),
+ h("div", { class: "row" }, soundsFolder, reloadSounds, customCount),
+ h("div", { class: "hint", text: t("Drop a file named like one of Mochi's sounds (finish.wav, approval.mp3, greet.m4a…) in the sounds folder to replace it, then Reload.") }),
+ h("div", { class: "row" },
+ h("label", { text: t("Open on hover") }),
+ toggle(settings.openOnHover, (v) => { settings.openOnHover = v; void save(); }),
+ ),
+ h("div", { class: "hint", text: t("Hovering the island opens it; it folds again shortly after the pointer leaves. Click inside to keep it open.") }),
h("div", { class: "row" },
h("label", { text: t("Auto-close") }),
autoClose,
diff --git a/windows/tests/fsm.test.mjs b/windows/tests/fsm.test.mjs
index 9b51ae2f..f1685ddf 100644
--- a/windows/tests/fsm.test.mjs
+++ b/windows/tests/fsm.test.mjs
@@ -307,3 +307,73 @@ test("an unusable delay is ignored", () => {
for (const bad of [NaN, -1, Infinity]) fsm.homeToPetitDelay = bad;
assert.equal(fsm.homeToPetitDelay, 15);
});
+
+// ── Open on hover (IslandHoverTests.swift) ────────────────────────────────────
+
+test("open on hover off: hovering only peeks", () => {
+ fsm.mouseEntered();
+ assert.equal(fsm.state, "petit");
+ assert.equal(fsm.openedByHover, false);
+});
+
+test("open on hover: hovering opens, leaving folds after the short grace period", () => {
+ fsm.openOnHover = true;
+ fsm.mouseEntered();
+ assert.equal(fsm.state, "home");
+ assert.equal(fsm.openedByHover, true);
+ fsm.mouseLeft();
+ seconds(0.5);
+ assert.equal(fsm.state, "home");
+ seconds(0.1);
+ assert.equal(fsm.state, "petit");
+ assert.equal(fsm.openedByHover, false);
+ // From the compact island it opens again.
+ fsm.mouseEntered();
+ assert.equal(fsm.state, "home");
+});
+
+test("open on hover: coming back before the grace period keeps it open", () => {
+ fsm.openOnHover = true;
+ fsm.mouseEntered();
+ fsm.mouseLeft();
+ seconds(0.3);
+ fsm.mouseEntered();
+ seconds(5);
+ assert.equal(fsm.state, "home");
+});
+
+test("open on hover: a click inside makes it an ordinary open island", () => {
+ fsm.openOnHover = true;
+ fsm.homeToPetitDelay = 3;
+ fsm.mouseEntered();
+ fsm.mouseLeft();
+ fsm.userInteracted(); // the short countdown becomes the normal one
+ seconds(1);
+ assert.equal(fsm.state, "home");
+ seconds(2);
+ assert.equal(fsm.state, "petit");
+});
+
+test("open on hover: a waiting card holds the island, hover neither opens nor folds it", () => {
+ fsm.openOnHover = true;
+ fsm.pinned = true;
+ fsm.mouseEntered();
+ assert.equal(fsm.state, "petit");
+ assert.equal(fsm.openedByHover, false);
+ fsm.forceHome();
+ fsm.mouseLeft();
+ seconds(5);
+ assert.equal(fsm.state, "home");
+});
+
+test("open on hover: an island opened by an alert keeps the normal delay", () => {
+ fsm.openOnHover = true;
+ fsm.homeToPetitDelay = 3;
+ fsm.forceHome();
+ fsm.mouseEntered();
+ fsm.mouseLeft();
+ seconds(1);
+ assert.equal(fsm.state, "home");
+ seconds(2);
+ assert.equal(fsm.state, "petit");
+});