Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

chore: files changed crates/openhuman-app/capabilities/ptt-overlay.json,crates/openhuman-app/src/dic

Steven Enamakela54faa6a416e
diff --git a/crates/openhuman-app/capabilities/ptt-overlay.json b/crates/openhuman-app/capabilities/ptt-overlay.json
deleted file mode 100644
index 08748d55b1..0000000000
--- a/crates/openhuman-app/capabilities/ptt-overlay.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "$schema": "../gen/schemas/desktop-schema.json",
- "identifier": "ptt-overlay",
- "description": "Push-to-talk overlay window: listens for `ptt-overlay://active` and nothing else",
- "platforms": ["linux", "macOS", "windows"],
- "windows": ["ptt-overlay"],
- "permissions": ["core:event:default"]
-}
diff --git a/crates/openhuman-app/src/dictation_hotkeys.rs b/crates/openhuman-app/src/dictation_hotkeys.rs
deleted file mode 100644
index 4686cd1a15..0000000000
--- a/crates/openhuman-app/src/dictation_hotkeys.rs
+++ /dev/null
@@ -1,36 +0,0 @@
-use std::sync::Mutex;
-
-/// Tracks the currently registered dictation hotkey string so we can unregister it later.
-pub(crate) struct DictationHotkeyState(pub(crate) Mutex<Vec<String>>);
-
-pub(crate) fn expand_dictation_shortcuts(shortcut: &str) -> Vec<String> {
- let trimmed = shortcut.trim();
- if trimmed.is_empty() {
- return vec![];
- }
-
- #[cfg(target_os = "macos")]
- {
- if trimmed.contains("CmdOrCtrl") {
- let cmd_variant = trimmed.replace("CmdOrCtrl", "Cmd");
- let ctrl_variant = trimmed.replace("CmdOrCtrl", "Ctrl");
- if cmd_variant == ctrl_variant {
- return vec![cmd_variant];
- }
- return vec![cmd_variant, ctrl_variant];
- }
- }
-
- #[cfg(not(target_os = "macos"))]
- {
- if trimmed.contains("CmdOrCtrl") {
- return vec![trimmed.replace("CmdOrCtrl", "Ctrl")];
- }
- }
-
- vec![trimmed.to_string()]
-}
-
-#[cfg(test)]
-#[path = "dictation_hotkeys_tests.rs"]
-mod tests;
diff --git a/crates/openhuman-app/src/dictation_hotkeys_tests.rs b/crates/openhuman-app/src/dictation_hotkeys_tests.rs
deleted file mode 100644
index 14151a413d..0000000000
--- a/crates/openhuman-app/src/dictation_hotkeys_tests.rs
+++ /dev/null
@@ -1,50 +0,0 @@
-use super::expand_dictation_shortcuts;
-
-#[test]
-fn expand_dictation_shortcuts_cmd_or_ctrl_expansion() {
- #[cfg(target_os = "macos")]
- {
- let result = expand_dictation_shortcuts("CmdOrCtrl+Shift+D");
- assert_eq!(result.len(), 2);
- assert!(result.contains(&"Cmd+Shift+D".to_string()));
- assert!(result.contains(&"Ctrl+Shift+D".to_string()));
- }
-
- #[cfg(not(target_os = "macos"))]
- {
- let result = expand_dictation_shortcuts("CmdOrCtrl+Shift+D");
- assert_eq!(result.len(), 1);
- assert_eq!(result[0], "Ctrl+Shift+D");
- }
-}
-
-#[test]
-fn expand_dictation_shortcuts_plain_shortcut() {
- let result = expand_dictation_shortcuts("Ctrl+Alt+T");
- assert_eq!(result.len(), 1);
- assert_eq!(result[0], "Ctrl+Alt+T");
-}
-
-#[test]
-fn expand_dictation_shortcuts_empty_input() {
- let result = expand_dictation_shortcuts("");
- assert!(result.is_empty());
-
- let result = expand_dictation_shortcuts(" ");
- assert!(result.is_empty());
-}
-
-#[test]
-#[cfg(target_os = "macos")]
-fn expand_dictation_shortcuts_macos_cmd_only() {
- let result = expand_dictation_shortcuts("CmdOrCtrl+Space");
- assert!(result.contains(&"Cmd+Space".to_string()));
-}
-
-#[test]
-#[cfg(not(target_os = "macos"))]
-fn expand_dictation_shortcuts_non_macos_ctrl_only() {
- let result = expand_dictation_shortcuts("CmdOrCtrl+Space");
- assert_eq!(result.len(), 1);
- assert_eq!(result[0], "Ctrl+Space");
-}
diff --git a/crates/openhuman-app/src/lib.rs b/crates/openhuman-app/src/lib.rs
index 17168f0449..9458b116d2 100644
--- a/crates/openhuman-app/src/lib.rs
+++ b/crates/openhuman-app/src/lib.rs
@@ -81,7 +81,6 @@ mod remote_ws_relay;
// the parsing helpers compile (and test) everywhere so `cargo test` on the
// developer host covers them.
mod deep_link_registration_check;
-mod dictation_hotkeys;
mod directory_picker;
mod external_navigation;
mod file_logging;
@@ -103,8 +102,6 @@ mod native_notifications;
mod notch_window;
mod process_kill;
mod process_recovery;
-mod ptt_hotkeys;
-mod ptt_overlay;
#[cfg(target_os = "windows")]
mod reset_reboot_schedule;
mod session;
@@ -122,21 +119,14 @@ use tauri::{
menu::{Menu, MenuItem},
tray::{MouseButton, MouseButtonState, TrayIconBuilder, TrayIconEvent},
};
-use tauri::{AppHandle, Emitter, Manager, PhysicalPosition, RunEvent, WebviewWindow};
-use tauri_plugin_global_shortcut::{GlobalShortcutExt, ShortcutState};
+use tauri::{AppHandle, Emitter, Manager, RunEvent, WebviewWindow};
use tauri_plugin_notification::NotificationExt;
#[cfg(any(windows, target_os = "linux"))]
use tauri_plugin_deep_link::DeepLinkExt;
#[cfg(target_os = "macos")]
-use objc2::runtime::{AnyClass, AnyObject};
-#[cfg(target_os = "macos")]
-use objc2::ClassType;
-#[cfg(target_os = "macos")]
-use objc2_app_kit::{
- NSPanel, NSWindow, NSWindowCollectionBehavior, NSWindowStyleMask, NSWindowTitleVisibility,
-};
+use objc2_app_kit::NSWindowTitleVisibility;
// Use Tauri's upstream native WebView runtime on every desktop platform.
pub(crate) type AppRuntime = tauri::Wry;
@@ -222,16 +212,6 @@ async fn active_rpc_endpoint(desktop: &core_process::CoreProcessHandle) -> (Stri
)
}
-#[tauri::command]
-fn overlay_parent_rpc_url() -> Option<String> {
- let url = std::env::var("OPENHUMAN_CORE_RPC_URL").ok()?;
- let trimmed = url.trim();
- if trimmed.is_empty() {
- return None;
- }
- Some(trimmed.to_string())
-}
-
#[tauri::command]
fn process_diagnostics_list_owned() -> Result<Vec<process_recovery::ProcessInfo>, String> {
match process_recovery::enumerate_openhuman_processes() {
@@ -249,112 +229,6 @@ fn process_diagnostics_list_owned() -> Result<Vec<process_recovery::ProcessInfo>
}
}
-#[allow(dead_code)] // Overlay disabled in tauri.conf.json; helper kept for future re-enable.
-fn pin_overlay_bottom_right(window: &WebviewWindow<AppRuntime>) {
- let Ok(Some(monitor)) = window.current_monitor() else {
- log::warn!("[overlay] could not resolve current monitor for positioning");
- return;
- };
- let Ok(size) = window.outer_size() else {
- log::warn!("[overlay] could not resolve overlay size for positioning");
- return;
- };
-
- let margin = 20i32;
- let x = monitor.position().x + monitor.size().width as i32 - size.width as i32 - margin;
- let y = monitor.position().y + monitor.size().height as i32 - size.height as i32 - margin;
-
- if let Err(err) = window.set_position(PhysicalPosition::new(x, y)) {
- log::warn!("[overlay] failed to pin overlay bottom-right: {err}");
- } else {
- log::info!("[overlay] pinned overlay bottom-right at {},{}", x, y);
- }
-}
-
-#[cfg(target_os = "macos")]
-#[allow(dead_code)] // Overlay disabled in tauri.conf.json; helper kept for future re-enable.
-fn configure_overlay_window_macos(window: &WebviewWindow<AppRuntime>) {
- // Standard NSWindow cannot float above fullscreen apps on macOS because
- // fullscreen apps run in a separate Space. Only NSPanel can do this.
- //
- // Tauri/tao hardcodes NSWindow as the window class, so we use
- // object_setClass() to reclass the existing NSWindow into an NSPanel
- // at runtime. This avoids creating a new window (which crashes because
- // Tao's window delegate is tightly coupled to the original NSWindow).
- //
- // After reclassing, we set the NonactivatingPanel style mask and
- // Transient collection behavior — matching the working Swift overlay
- // helper (accessibility/helper.rs OverlayController) which is confirmed
- // to float above fullscreen apps on macOS Sonoma.
- //
- // Previous attempts that FAILED:
- // 1. CGShieldingWindowLevel + CanJoinAllSpaces + FullScreenAuxiliary → hidden
- // 2. Window level i32::MAX-17 + Stationary → hidden
- // 3. CGS private API CGSSetWindowTags sticky bit → hidden
- // 4. object_setClass WITHOUT NonactivatingPanel style mask → hidden
- // 5. Create new NSPanel + reparent webview → CRASH (Tao delegate panic)
- //
- // See: https://github.com/tauri-apps/tauri/issues/11488
-
- match window.ns_window() {
- Ok(ns_window_raw) => unsafe {
- let ns_window = ns_window_raw as *mut AnyObject;
-
- // ── Reclass NSWindow → NSPanel ──────────────────────────
- let panel_class: *const AnyClass = NSPanel::class();
- objc2::ffi::object_setClass(ns_window, panel_class);
- log::info!("[overlay] reclassed NSWindow → NSPanel via object_setClass");
-
- // Cast to NSPanel for method calls
- let panel: &NSPanel = &*(ns_window as *const NSPanel);
-
- // ── Style mask: add NonactivatingPanel ──────────────────
- // This is the KEY piece the Swift helper uses. Without it,
- // the panel doesn't behave as a proper non-activating panel
- // and won't float above fullscreen Spaces.
- let current_style = panel.styleMask();
- panel.setStyleMask(current_style | NSWindowStyleMask::NonactivatingPanel);
-
- // ── Collection behavior ─────────────────────────────────
- // The Swift helper uses .canJoinAllSpaces + .transient
- // (NOT .stationary or .fullScreenAuxiliary alone).
- // Transient means the panel follows the active Space and
- // appears above fullscreen apps.
- panel.setCollectionBehavior(
- NSWindowCollectionBehavior::CanJoinAllSpaces
- | NSWindowCollectionBehavior::Transient
- | NSWindowCollectionBehavior::FullScreenAuxiliary
- | NSWindowCollectionBehavior::IgnoresCycle,
- );
-
- // ── Window level: status bar tier ───────────────────────
- // NSStatusWindowLevel = 25. The Swift helper uses .statusBar
- // which is the same value.
- panel.setLevel(25);
-
- // ── Panel-specific properties ───────────────────────────
- panel.setFloatingPanel(true);
- panel.setHidesOnDeactivate(false);
- panel.setBecomesKeyOnlyIfNeeded(true);
- panel.setWorksWhenModal(true);
-
- // Make sure it's ordered front
- panel.orderFrontRegardless();
-
- log::info!(
- "[overlay] NSPanel configured — level=25, \
- NonactivatingPanel+canJoinAllSpaces+transient, \
- floatingPanel={}, hidesOnDeactivate={}",
- panel.isFloatingPanel(),
- panel.hidesOnDeactivate(),
- );
- },
- Err(err) => {
- log::warn!("[overlay] failed to access native NSWindow handle: {err}");
- }
- }
-}
-
/// Core update is handled by the Tauri shell auto-updater (`tauri-plugin-updater`)
/// since the core ships in-process with the app. This command is kept as a
/// no-op stub so the frontend's `checkCoreUpdate` keeps working without errors;
@@ -924,308 +798,6 @@ async fn install_app_update(
/// Register (or re-register) the global dictation toggle hotkey.
/// Emits `dictation://toggle` to all webviews when the shortcut is pressed.
-#[tauri::command]
-async fn register_dictation_hotkey(
- app: AppHandle<AppRuntime>,
- shortcut: String,
-) -> Result<(), String> {
- log::info!("[dictation] register_dictation_hotkey: shortcut={shortcut}");
-
- let old_shortcuts = {
- let state = app.state::<dictation_hotkeys::DictationHotkeyState>();
- let guard = state.0.lock().unwrap();
- guard.clone()
- };
-
- let expanded_shortcuts = dictation_hotkeys::expand_dictation_shortcuts(&shortcut);
- if expanded_shortcuts.is_empty() {
- return Err("Shortcut cannot be empty".to_string());
- }
- log::info!(
- "[dictation] expanded shortcuts: {}",
- expanded_shortcuts.join(", ")
- );
-
- // Reject overlap with the currently-registered PTT hotkey.
- let ptt_current = {
- let state = app.state::<ptt_hotkeys::PttHotkeyState>();
- let guard = state.shortcut.lock().unwrap();
- guard.clone()
- };
- if let Some(conflict) = ptt_hotkeys::first_conflict_with(&expanded_shortcuts, &ptt_current) {
- return Err(format!(
- "dictation shortcut '{conflict}' conflicts with the push-to-talk hotkey"
- ));
- }
-
- let register_shortcut = |shortcut_variant: &str| -> Result<(), String> {
- let app_clone = app.clone();
- app.global_shortcut()
- .on_shortcut(shortcut_variant, move |_app, _sc, event| {
- if event.state == ShortcutState::Pressed {
- log::debug!("[dictation] hotkey pressed — emitting dictation://toggle");
- if let Err(e) = app_clone.emit("dictation://toggle", ()) {
- log::warn!("[dictation] emit failed: {e}");
- }
- }
- })
- .map_err(|e| format!("Failed to register shortcut '{shortcut_variant}': {e}"))
- };
-
- let mut unregistered_old: Vec<String> = Vec::new();
- for old in &old_shortcuts {
- log::debug!("[dictation] unregistering previous shortcut: {old}");
- if let Err(e) = app.global_shortcut().unregister(old.as_str()) {
- for restored in &unregistered_old {
- if let Err(restore_err) = register_shortcut(restored.as_str()) {
- log::warn!(
- "[dictation] rollback failed while restoring old shortcut '{restored}': {restore_err}"
- );
- }
- }
- return Err(format!(
- "Failed to unregister previous shortcut '{old}': {e}"
- ));
- }
- unregistered_old.push(old.clone());
- }
-
- let mut newly_registered: Vec<String> = Vec::new();
- for shortcut_variant in &expanded_shortcuts {
- if let Err(err) = register_shortcut(shortcut_variant.as_str()) {
- log::error!("[dictation] failed to register shortcut '{shortcut_variant}': {err}");
- for registered in &newly_registered {
- if let Err(unregister_err) = app.global_shortcut().unregister(registered.as_str()) {
- log::warn!(
- "[dictation] rollback failed while unregistering '{registered}': {unregister_err}"
- );
- }
- }
- for old in &old_shortcuts {
- if let Err(restore_err) = register_shortcut(old.as_str()) {
- log::warn!(
- "[dictation] rollback failed while restoring old shortcut '{old}': {restore_err}"
- );
- }
- }
- return Err(err);
- }
- newly_registered.push(shortcut_variant.clone());
- }
-
- // Persist all newly registered shortcuts.
- {
- let state = app.state::<dictation_hotkeys::DictationHotkeyState>();
- let mut guard = state.0.lock().unwrap();
- *guard = expanded_shortcuts.clone();
- }
-
- log::info!(
- "[dictation] shortcuts registered: {}",
- expanded_shortcuts.join(", ")
- );
- Ok(())
-}
-
-/// Unregister the global dictation hotkey (if any).
-#[tauri::command]
-async fn unregister_dictation_hotkey(app: AppHandle<AppRuntime>) -> Result<(), String> {
- log::info!("[dictation] unregister_dictation_hotkey: called");
- let state = app.state::<dictation_hotkeys::DictationHotkeyState>();
- let mut guard = state.0.lock().unwrap();
- if guard.is_empty() {
- log::debug!("[dictation] no shortcut registered — nothing to unregister");
- } else {
- let old_shortcuts = guard.clone();
- guard.clear();
- for old in old_shortcuts {
- log::debug!("[dictation] unregistering shortcut: {old}");
- app.global_shortcut()
- .unregister(old.as_str())
- .map_err(|e| {
- log::warn!("[dictation] failed to unregister '{old}': {e}");
- format!("Failed to unregister shortcut '{old}': {e}")
- })?;
- log::info!("[dictation] shortcut unregistered: {old}");
- }
- }
- Ok(())
-}
-
-/// Register (or re-register) the global push-to-talk hotkey. Emits
-/// `ptt://start { session_id }` on press and `ptt://stop { session_id }`
-/// on release.
-#[tauri::command]
-async fn register_ptt_hotkey(app: AppHandle<AppRuntime>, shortcut: String) -> Result<(), String> {
- log::info!("[ptt] register_ptt_hotkey: shortcut={shortcut}");
-
- let expanded = ptt_hotkeys::expand_ptt_shortcuts(&shortcut).map_err(|e| e.to_string())?;
-
- // Reject overlap with the currently-registered dictation hotkey.
- let dictation_current = {
- let state = app.state::<dictation_hotkeys::DictationHotkeyState>();
- let guard = state.0.lock().unwrap();
- guard.clone()
- };
- if let Some(conflict) = ptt_hotkeys::first_conflict_with(&expanded, &dictation_current) {
- return Err(ptt_hotkeys::PttError::ConflictsWithDictation(conflict).to_string());
- }
-
- let old_shortcuts = {
- let state = app.state::<ptt_hotkeys::PttHotkeyState>();
- let guard = state.shortcut.lock().unwrap();
- guard.clone()
- };
-
- // Lazy-instantiate the overlay window so it's ready before the first press.
- if let Err(e) = ptt_overlay::ensure_window(&app) {
- log::warn!("[ptt] overlay window create failed (continuing): {e}");
- }
-
- let register_shortcut = |variant: &str| -> Result<(), String> {
- let app_pressed = app.clone();
- let app_released = app.clone();
- let variant_owned = variant.to_string();
- app.global_shortcut()
- .on_shortcut(variant, move |app_inner, _sc, event| {
- let state = app_inner.state::<ptt_hotkeys::PttHotkeyState>();
- match event.state {
- ShortcutState::Pressed => {
- // Drop OS key-repeat events; only the first Pressed of a hold opens a session.
- if state
- .is_held
- .compare_exchange(
- false,
- true,
- std::sync::atomic::Ordering::AcqRel,
- std::sync::atomic::Ordering::Acquire,
- )
- .is_err()
- {
- log::trace!(
- "[ptt] press dropped (already held) shortcut={variant_owned}"
- );
- return;
- }
- let session_id = state
- .session_counter
- .fetch_add(1, std::sync::atomic::Ordering::Relaxed)
- + 1;
- log::debug!(
- "[ptt] pressed shortcut={variant_owned} session_id={session_id}"
- );
- if let Err(e) = app_pressed.emit(
- "ptt://start",
- serde_json::json!({
- "session_id": session_id,
- }),
- ) {
- log::warn!("[ptt] emit start failed: {e}");
- }
- }
- ShortcutState::Released => {
- if !state
- .is_held
- .swap(false, std::sync::atomic::Ordering::AcqRel)
- {
- // No corresponding Pressed in our state — stale event, drop.
- log::trace!(
- "[ptt] release dropped (not held) shortcut={variant_owned}"
- );
- return;
- }
- let session_id = state
- .session_counter
- .load(std::sync::atomic::Ordering::Relaxed);
- log::debug!(
- "[ptt] released shortcut={variant_owned} session_id={session_id}"
- );
- if let Err(e) = app_released.emit(
- "ptt://stop",
- serde_json::json!({
- "session_id": session_id,
- }),
- ) {
- log::warn!("[ptt] emit stop failed: {e}");
- }
- }
- }
- })
- .map_err(|e| format!("Failed to register ptt shortcut '{variant}': {e}"))
- };
-
- // Unregister previous PTT variants.
- let mut unregistered: Vec<String> = Vec::new();
- for old in &old_shortcuts {
- if let Err(e) = app.global_shortcut().unregister(old.as_str()) {
- // Rollback already-unregistered ones.
- for r in &unregistered {
- if let Err(re) = register_shortcut(r) {
- log::warn!("[ptt] rollback failed for '{r}': {re}");
- }
- }
- return Err(format!(
- "Failed to unregister previous ptt shortcut '{old}': {e}"
- ));
- }
- unregistered.push(old.clone());
- }
-
- // Register the new variants. Rollback on first failure.
- let mut newly_registered: Vec<String> = Vec::new();
- for v in &expanded {
- if let Err(e) = register_shortcut(v) {
- for r in &newly_registered {
- if let Err(re) = app.global_shortcut().unregister(r.as_str()) {
- log::warn!("[ptt] rollback failed for '{r}': {re}");
- }
- }
- for old in &old_shortcuts {
- if let Err(re) = register_shortcut(old) {
- log::warn!("[ptt] rollback failed for '{old}': {re}");
- }
- }
- return Err(e);
- }
- newly_registered.push(v.clone());
- }
-
- {
- let state = app.state::<ptt_hotkeys::PttHotkeyState>();
- let mut guard = state.shortcut.lock().unwrap();
- *guard = expanded.clone();
- }
-
- log::info!("[ptt] registered: {}", expanded.join(", "));
- Ok(())
-}
-
-/// Unregister the global PTT hotkey (if any).
-#[tauri::command]
-async fn unregister_ptt_hotkey(app: AppHandle<AppRuntime>) -> Result<(), String> {
- log::info!("[ptt] unregister_ptt_hotkey: called");
- let state = app.state::<ptt_hotkeys::PttHotkeyState>();
- let old = {
- let guard = state.shortcut.lock().unwrap();
- guard.clone()
- };
- let mut still_registered: Vec<String> = Vec::new();
- for s in &old {
- if let Err(e) = app.global_shortcut().unregister(s.as_str()) {
- log::warn!("[ptt] unregister '{s}' failed: {e}");
- still_registered.push(s.clone());
- }
- }
- // Only retain variants that genuinely failed to unregister; the rest are gone.
- {
- let mut guard = state.shortcut.lock().unwrap();
- *guard = still_registered;
- }
- // Destroy the overlay window so resources are released.
- ptt_overlay::destroy_window(&app);
- Ok(())
-}
-
fn is_daemon_mode() -> bool {
std::env::args().any(|arg| arg == "daemon" || arg == "--daemon")
}
@@ -1314,13 +886,6 @@ fn set_titlebar_for_sidebar(app: AppHandle<AppRuntime>, collapsed: bool) -> Resu
}
}
-/// Tauri command: bring the main window to front from any webview (e.g. overlay orb click).
-#[tauri::command]
-fn activate_main_window(app: AppHandle<AppRuntime>) -> Result<(), String> {
- log::debug!("[window] activate_main_window called from overlay");
- show_main_window(&app)
-}
-
/// Show the floating mascot. macOS: native NSPanel + WKWebView (so the
/// window is actually transparent — vendored tauri-cef can't render
/// transparent windowed-mode browsers). Loads the Vite dev URL in
@@ -2883,16 +2448,11 @@ pub fn run() {
.register_asynchronous_uri_scheme_protocol(widget_scheme::SCHEME, widget_scheme::handle)
.plugin(tauri_plugin_deep_link::init())
.plugin(tauri_plugin_notification::init())
- .plugin(tauri_plugin_global_shortcut::Builder::new().build())
// Auto-updater for the Tauri shell. Endpoint and minisign pubkey live
// in `tauri.conf.json` under `plugins.updater`. Releases are signed at
// build time with `TAURI_SIGNING_PRIVATE_KEY` (+ `_PASSWORD`); see
// docs/gitbooks/en/overview/auto-update.md for the full pipeline.
.plugin(tauri_plugin_updater::Builder::new().build())
- .manage(dictation_hotkeys::DictationHotkeyState(
- std::sync::Mutex::new(Vec::new()),
- ))
- .manage(ptt_hotkeys::PttHotkeyState::new())
.manage(PendingAppUpdateState::default());
let builder = builder.manage(std::sync::Arc::new(imessage_scanner::ScannerRegistry::new()));
builder
@@ -3222,24 +2782,6 @@ pub fn run() {
}
}
- // Overlay window is currently disabled in `tauri.conf.json` (the
- // `overlay` entry under `app.windows` was removed), so we skip
- // the macOS NSPanel reclass + bottom-right pin + initial show
- // here. The helpers (`configure_overlay_window_macos`,
- // `pin_overlay_bottom_right`) and the React entry point
- // (`src/overlay/OverlayApp.tsx`) are kept intact so the overlay
- // can be re-enabled by restoring the config entry and the two
- // setup blocks below.
- //
- // #[cfg(target_os = "macos")]
- // if let Some(window) = app.get_webview_window("overlay") {
- // configure_overlay_window_macos(&window);
- // }
- // if let Some(window) = app.get_webview_window("overlay") {
- // pin_overlay_bottom_right(&window);
- // let _ = window.show();
- // }
-
// Notch activity indicator: transparent pill at the top-centre of
// the primary screen. Shows live voice / agent state. macOS only
// (physical notch or menu-bar HUD on older hardware).
@@ -3298,7 +2840,6 @@ pub fn run() {
// cannot fetch directly (cleartext mixed content). See #3865.
core_rpc::relay_http_rpc,
remote_ws_relay::relay_remote_socket,
- overlay_parent_rpc_url,
process_diagnostics_list_owned,
// Artifact export — cross-platform. Previously macOS/Linux-gated,
// but the `directories` + `tokio::fs::copy` flow compiles on Windows
@@ -3330,14 +2871,8 @@ pub fn run() {
session::commands::auth_logout,
session::commands::auth_state,
session::commands::auth_current_user,
- register_dictation_hotkey,
- unregister_dictation_hotkey,
- register_ptt_hotkey,
- unregister_ptt_hotkey,
- ptt_overlay::show_ptt_overlay,
native_notifications::notification_permission_state,
native_notifications::notification_permission_request,
- activate_main_window,
set_titlebar_for_sidebar,
native_notifications::show_native_notification,
mascot_window_show,
diff --git a/crates/openhuman-app/src/ptt_hotkeys.rs b/crates/openhuman-app/src/ptt_hotkeys.rs
deleted file mode 100644
index c1ef745063..0000000000
--- a/crates/openhuman-app/src/ptt_hotkeys.rs
+++ /dev/null
@@ -1,133 +0,0 @@
-//! Global push-to-talk hotkey state + parsing.
-//!
-//!
-//! `expand_ptt_shortcuts` mirrors `dictation_hotkeys::expand_dictation_shortcuts`
-//! but rejects pure-modifier shortcuts (Ctrl, Cmd+Shift, etc.) because they
-//! would fire constantly during normal typing.
-
-use std::sync::atomic::{AtomicBool, AtomicU64};
-use std::sync::Mutex;
-
-#[derive(Debug, PartialEq, Eq)]
-pub(crate) enum PttError {
- EmptyShortcut,
- ModifierOnlyShortcut,
- ConflictsWithDictation(String),
-}
-
-impl std::fmt::Display for PttError {
- fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
- match self {
- PttError::EmptyShortcut => write!(f, "ptt shortcut cannot be empty"),
- PttError::ModifierOnlyShortcut => write!(
- f,
- "ptt shortcut cannot be only modifier keys (Ctrl/Cmd/Shift/Alt)"
- ),
- PttError::ConflictsWithDictation(s) => {
- write!(f, "ptt shortcut '{s}' conflicts with the dictation hotkey")
- }
- }
- }
-}
-
-impl std::error::Error for PttError {}
-
-/// Process-wide PTT state. Held in the Tauri-managed `State<PttHotkeyState>`.
-pub(crate) struct PttHotkeyState {
- /// Currently-registered shortcut variants (e.g. `["Cmd+F13", "Ctrl+F13"]` on macOS).
- pub(crate) shortcut: Mutex<Vec<String>>,
- /// Monotonic counter for session IDs.
- pub(crate) session_counter: AtomicU64,
- /// CAS-guarded: true iff a PTT session is currently mid-hold.
- /// Used to drop OS key-repeat Pressed events so each press/release pair
- /// produces exactly one session_id.
- pub(crate) is_held: AtomicBool,
-}
-
-impl PttHotkeyState {
- pub(crate) fn new() -> Self {
- Self {
- shortcut: Mutex::new(Vec::new()),
- session_counter: AtomicU64::new(0),
- is_held: AtomicBool::new(false),
- }
- }
-}
-
-const MODIFIER_TOKENS: &[&str] = &[
- "ctrl",
- "control",
- "cmd",
- "command",
- "meta",
- "super",
- "win",
- "windows",
- "alt",
- "option",
- "shift",
- "cmdorctrl",
-];
-
-fn is_modifier_token(token: &str) -> bool {
- let trimmed = token.trim();
- MODIFIER_TOKENS
- .iter()
- .any(|m| trimmed.eq_ignore_ascii_case(m))
-}
-
-/// Expand a user-typed shortcut into one or two OS-specific variants and
-/// validate it isn't empty / modifier-only.
-pub(crate) fn expand_ptt_shortcuts(shortcut: &str) -> Result<Vec<String>, PttError> {
- let trimmed = shortcut.trim();
- if trimmed.is_empty() {
- return Err(PttError::EmptyShortcut);
- }
-
- let parts: Vec<&str> = trimmed.split('+').map(str::trim).collect();
- if parts.iter().any(|p| p.is_empty()) {
- return Err(PttError::EmptyShortcut);
- }
- if parts.iter().all(|p| is_modifier_token(p)) {
- return Err(PttError::ModifierOnlyShortcut);
- }
-
- #[cfg(target_os = "macos")]
- {
- if trimmed.contains("CmdOrCtrl") {
- let cmd_variant = trimmed.replace("CmdOrCtrl", "Cmd");
- let ctrl_variant = trimmed.replace("CmdOrCtrl", "Ctrl");
- if cmd_variant == ctrl_variant {
- return Ok(vec![cmd_variant]);
- }
- return Ok(vec![cmd_variant, ctrl_variant]);
- }
- }
-
- #[cfg(not(target_os = "macos"))]
- {
- if trimmed.contains("CmdOrCtrl") {
- return Ok(vec![trimmed.replace("CmdOrCtrl", "Ctrl")]);
- }
- }
-
- Ok(vec![trimmed.to_string()])
-}
-
-/// Returns `Some(conflicting_variant)` if any expanded PTT variant overlaps
-/// any expanded dictation variant. Comparison is case-insensitive.
-pub(crate) fn first_conflict_with(ptt: &[String], dictation: &[String]) -> Option<String> {
- for p in ptt {
- let p_lc = p.to_ascii_lowercase();
- for d in dictation {
- if d.to_ascii_lowercase() == p_lc {
- return Some(p.clone());
- }
- }
- }
- None
-}
-
-#[cfg(test)]
-#[path = "ptt_hotkeys_tests.rs"]
-mod tests;
diff --git a/crates/openhuman-app/src/ptt_hotkeys_tests.rs b/crates/openhuman-app/src/ptt_hotkeys_tests.rs
deleted file mode 100644
index edc88bb5cc..0000000000
--- a/crates/openhuman-app/src/ptt_hotkeys_tests.rs
+++ /dev/null
@@ -1,133 +0,0 @@
-use super::*;
-use std::sync::atomic::Ordering;
-
-// -- from tests --
-
-#[test]
-fn empty_shortcut_is_rejected() {
- assert_eq!(expand_ptt_shortcuts(""), Err(PttError::EmptyShortcut));
- assert_eq!(expand_ptt_shortcuts(" "), Err(PttError::EmptyShortcut));
-}
-
-#[test]
-fn modifier_only_shortcut_is_rejected() {
- assert_eq!(
- expand_ptt_shortcuts("Ctrl"),
- Err(PttError::ModifierOnlyShortcut)
- );
- assert_eq!(
- expand_ptt_shortcuts("Cmd+Shift"),
- Err(PttError::ModifierOnlyShortcut)
- );
- assert_eq!(
- expand_ptt_shortcuts("Alt+Shift+Ctrl"),
- Err(PttError::ModifierOnlyShortcut)
- );
- assert_eq!(
- expand_ptt_shortcuts("CmdOrCtrl+Shift"),
- Err(PttError::ModifierOnlyShortcut)
- );
-}
-
-#[test]
-fn plain_function_key_is_accepted() {
- assert_eq!(expand_ptt_shortcuts("F13"), Ok(vec!["F13".to_string()]));
-}
-
-#[test]
-fn modifier_plus_letter_is_accepted() {
- assert_eq!(
- expand_ptt_shortcuts("Ctrl+Alt+T"),
- Ok(vec!["Ctrl+Alt+T".to_string()])
- );
-}
-
-#[test]
-#[cfg(target_os = "macos")]
-fn cmd_or_ctrl_expands_to_both_on_macos() {
- let result = expand_ptt_shortcuts("CmdOrCtrl+Shift+P").unwrap();
- assert_eq!(result.len(), 2);
- assert!(result.contains(&"Cmd+Shift+P".to_string()));
- assert!(result.contains(&"Ctrl+Shift+P".to_string()));
-}
-
-#[test]
-#[cfg(not(target_os = "macos"))]
-fn cmd_or_ctrl_expands_to_ctrl_off_macos() {
- let result = expand_ptt_shortcuts("CmdOrCtrl+Shift+P").unwrap();
- assert_eq!(result, vec!["Ctrl+Shift+P".to_string()]);
-}
-
-#[test]
-fn malformed_shortcut_with_empty_tokens_is_rejected() {
- assert_eq!(expand_ptt_shortcuts("+F13"), Err(PttError::EmptyShortcut));
- assert_eq!(expand_ptt_shortcuts("F13+"), Err(PttError::EmptyShortcut));
- assert_eq!(
- expand_ptt_shortcuts("Ctrl++T"),
- Err(PttError::EmptyShortcut)
- );
-}
-
-// -- from conflict_tests --
-
-#[test]
-fn no_conflict_returns_none() {
- let ptt = vec!["F13".into()];
- let dict = vec!["F14".into()];
- assert_eq!(first_conflict_with(&ptt, &dict), None);
-}
-
-#[test]
-fn case_insensitive_conflict_detected() {
- let ptt = vec!["ctrl+space".into()];
- let dict = vec!["Ctrl+Space".into()];
- assert_eq!(
- first_conflict_with(&ptt, &dict),
- Some("ctrl+space".to_string())
- );
-}
-
-#[test]
-fn only_one_variant_overlaps_returns_first() {
- let ptt = vec!["Cmd+P".into(), "Ctrl+P".into()];
- let dict = vec!["Ctrl+P".into()];
- assert_eq!(first_conflict_with(&ptt, &dict), Some("Ctrl+P".to_string()));
-}
-
-// -- from state_tests --
-
-#[test]
-fn new_state_is_not_held_and_counter_is_zero() {
- let s = PttHotkeyState::new();
- assert!(!s.is_held.load(Ordering::Relaxed));
- assert_eq!(s.session_counter.load(Ordering::Relaxed), 0);
-}
-
-#[test]
-fn cas_false_to_true_succeeds_then_repeat_fails() {
- let s = PttHotkeyState::new();
- // First press: false → true succeeds.
- assert!(
- s.is_held
- .compare_exchange(false, true, Ordering::AcqRel, Ordering::Acquire)
- .is_ok(),
- "first press CAS should succeed"
- );
- // Repeat press: false → true fails because we're already true.
- assert!(
- s.is_held
- .compare_exchange(false, true, Ordering::AcqRel, Ordering::Acquire)
- .is_err(),
- "repeat press CAS should fail (already held)"
- );
- // Release: swap true → false returns the old true.
- assert!(
- s.is_held.swap(false, Ordering::AcqRel),
- "swap should return prior true"
- );
- // Subsequent stale release: swap returns the current false.
- assert!(
- !s.is_held.swap(false, Ordering::AcqRel),
- "stale swap should return false"
- );
-}
diff --git a/crates/openhuman-app/src/ptt_overlay.rs b/crates/openhuman-app/src/ptt_overlay.rs
deleted file mode 100644
index 6cfb824e68..0000000000
--- a/crates/openhuman-app/src/ptt_overlay.rs
+++ /dev/null
@@ -1,94 +0,0 @@
-//! Borderless always-on-top PTT overlay window.
-//!
-//! Lazy-created on the first `register_ptt_hotkey` call (so the window is
-//! ready when the user hits the key for the first time), and destroyed by
-//! `unregister_ptt_hotkey`. The window's contents are rendered by the React
-//! route `/ptt-overlay` (see `app/src/pages/PttOverlayPage.tsx`).
-//!
-//! Cross-platform note: `focus(false)` ensures the window never steals focus
-//! from the user's active app. `skip_taskbar(true)` keeps it out of the
-//! Windows taskbar / macOS dock. `visible_on_all_workspaces(true)` makes it
-//! follow the user across macOS Spaces. DXGI exclusive-fullscreen on Windows
-//! still suppresses the overlay — documented in the settings panel as a
-//! limitation; chime audio remains the fallback signal.
-
-use tauri::{AppHandle, Emitter, Manager, Runtime, WebviewUrl, WebviewWindowBuilder};
-
-const OVERLAY_LABEL: &str = "ptt-overlay";
-
-/// Ensure the overlay window exists. Idempotent — if the window already
-/// exists, returns Ok without recreating it.
-pub(crate) fn ensure_window<R: Runtime>(app: &AppHandle<R>) -> Result<(), String> {
- if app.get_webview_window(OVERLAY_LABEL).is_some() {
- return Ok(());
- }
- let url = WebviewUrl::App("index.html#/ptt-overlay".into());
- let builder = WebviewWindowBuilder::new(app, OVERLAY_LABEL, url)
- .title("OpenHuman Push-to-Talk")
- .inner_size(160.0, 56.0)
- .decorations(false)
- .transparent(true)
- .always_on_top(true)
- .skip_taskbar(true)
- .focused(false)
- .resizable(false)
- // NOTE: .shadow(false) is a no-op under the project's CEF runtime
- // (tauri-runtime-cef has a TODO stub); harmless but won't actually
- // suppress the OS shadow until CEF wires it through.
- .shadow(false)
- .visible(false);
-
- #[cfg(target_os = "macos")]
- let builder = builder
- .visible_on_all_workspaces(true)
- .accept_first_mouse(false);
-
- let _window = builder
- .build()
- .map_err(|e| format!("create ptt overlay window: {e}"))?;
- log::info!("[ptt-overlay] window created (label={OVERLAY_LABEL})");
- Ok(())
-}
-
-/// Destroy the overlay window if it exists.
-pub(crate) fn destroy_window<R: Runtime>(app: &AppHandle<R>) {
- if let Some(w) = app.get_webview_window(OVERLAY_LABEL) {
- if let Err(e) = w.destroy() {
- log::warn!("[ptt-overlay] destroy failed: {e}");
- } else {
- log::info!("[ptt-overlay] window destroyed");
- }
- }
-}
-
-/// Show or hide the overlay. Emits `ptt-overlay://active` for the in-window
-/// React tree to drive its pulsing-dot animation.
-#[tauri::command]
-pub(crate) async fn show_ptt_overlay<R: Runtime>(
- app: AppHandle<R>,
- active: bool,
- session_id: u64,
-) -> Result<(), String> {
- let window = app.get_webview_window(OVERLAY_LABEL).ok_or_else(|| {
- "[ptt-overlay] window not ready (register_ptt_hotkey must succeed before show_ptt_overlay)"
- .to_string()
- })?;
-
- if active {
- window.show().map_err(|e| format!("show overlay: {e}"))?;
- } else {
- window.hide().map_err(|e| format!("hide overlay: {e}"))?;
- }
-
- if let Err(e) = window.emit(
- "ptt-overlay://active",
- serde_json::json!({
- "active": active,
- "session_id": session_id,
- }),
- ) {
- log::warn!("[ptt-overlay] emit active failed: {e}");
- }
-
- Ok(())
-}