mirror of
https://github.com/block/buzz.git
synced 2026-11-09 02:41:57 +00:00
Signed-off-by: npub13fn4ahfnvaa2qwylvegdgeajqs0mph6v4qsw4jcqnw4mjh3hzh2quuucm5 <8a675edd33677aa0389f6650d467b2041fb0df4ca820eacb009babb95e3715d4@sprout-oss.stage.blox.sqprod.co> Co-authored-by: npub13fn4ahfnvaa2qwylvegdgeajqs0mph6v4qsw4jcqnw4mjh3hzh2quuucm5 <8a675edd33677aa0389f6650d467b2041fb0df4ca820eacb009babb95e3715d4@sprout-oss.stage.blox.sqprod.co>
23 lines
758 B
TypeScript
23 lines
758 B
TypeScript
import { invoke, isTauri } from "@tauri-apps/api/core";
|
|
|
|
/**
|
|
* Runs the window action that matches the OS "double-click a window's title
|
|
* bar to" preference (macOS `AppleActionOnDoubleClick`).
|
|
*
|
|
* The app uses a web-based title-bar drag region, so the OS does not act on a
|
|
* title-bar double-click on its own. The Rust `title_bar_double_click` command
|
|
* reads the preference and dispatches a single matching action (native
|
|
* `miniaturize:` for minimize, so the window genies into the Dock).
|
|
*/
|
|
export async function performTitleBarDoubleClickAction(): Promise<void> {
|
|
if (!isTauri()) {
|
|
return;
|
|
}
|
|
|
|
try {
|
|
await invoke("title_bar_double_click");
|
|
} catch {
|
|
// No-op on failure; a missed titlebar action is not worth surfacing.
|
|
}
|
|
}
|