mirror of
https://github.com/storytold/photocraft.git
synced 2026-12-02 06:20:48 +01:00
macOS: Beep When Done plays the system alert sound (NSBeep) instead of a terminal bell (#6537)
This commit is contained in:
1 parent
2a952f164c
commit
b4e0d2491d
2 files changed
+10
-5
No files matched your search
@@ -50,11 +50,12 @@ core-graphics2 = { version = "=0.6.1", default-features = false, features = ["di
|
||||
# safe API. Pinned exactly: review the diff before bumping.
|
||||
fmv-macos-events = "=0.1.0"
|
||||
# Safe AppKit calls only: turn off AppKit's title bar dragging (mac_window.rs) and find where the
|
||||
# pointer is when files are dropped (cursor.rs; winit 0.30 drops carry no position). Already in
|
||||
# pointer is when files are dropped (cursor.rs; winit 0.30 drops carry no position), and play the
|
||||
# system alert sound for Beep When Done (services.rs, NSBeep). Already in
|
||||
# Cargo.lock (winit, photocraft-tablet); pinned exactly to the same versions.
|
||||
objc2 = "=0.6.4"
|
||||
objc2-foundation = { version = "=0.3.2", default-features = false, features = ["std", "NSArray", "NSEnumerator", "NSGeometry"] }
|
||||
objc2-app-kit = { version = "=0.3.2", default-features = false, features = ["std", "NSApplication", "NSApplicationScripting", "NSEvent", "NSResponder", "NSView", "NSWindow"] }
|
||||
objc2-app-kit = { version = "=0.3.2", default-features = false, features = ["std", "NSApplication", "NSApplicationScripting", "NSEvent", "NSGraphics", "NSResponder", "NSView", "NSWindow"] }
|
||||
# The macOS menu bar (mac_menu.rs): a standalone native menu crate (from the tauri-apps org, but
|
||||
# not Tauri: no webview, no JS), AppKit menus behind a safe API (no GTK with default features off). Pinned exactly: review the diff before bumping.
|
||||
muda = { version = "=0.21.1", default-features = false }
|
||||
|
||||
@@ -574,10 +574,14 @@ fn platform_beep() {
|
||||
{
|
||||
let _ = winsafe::MessageBeep(winsafe::co::MBP::OK);
|
||||
}
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
// The user's alert sound, at the alert volume set in System Settings ▸ Sound. The terminal
|
||||
// bell below is silent for an app started from the Finder or the Dock.
|
||||
#[cfg(target_os = "macos")]
|
||||
objc2_app_kit::NSBeep();
|
||||
#[cfg(not(any(target_os = "windows", target_os = "macos")))]
|
||||
{
|
||||
// No beep API among this app's other platforms' dependencies: write the terminal bell
|
||||
// (audible when launched from a terminal, which is the same cue macOS terminals use).
|
||||
// No beep API among the other platforms' dependencies: write the terminal bell (audible
|
||||
// when launched from a terminal).
|
||||
use std::io::Write as _;
|
||||
let _ = std::io::stdout().write_all(b"\x07").and_then(|()| std::io::stdout().flush());
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user