On the first failed unlock attempt, save the current system volume and mute state then set volume to maximum unmuted; restore on g_module_unload. A lock file under XDG_RUNTIME_DIR prevents double-acquisition when multiple gtklock windows are active. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
13 lines
383 B
Rust
13 lines
383 B
Rust
#[test]
|
|
fn lock_file_created_and_prevents_second_acquisition() {
|
|
let dir = tempfile::tempdir().unwrap();
|
|
let lock_path = dir.path().join("ahfail.lock");
|
|
|
|
let acquired = ahfail_ui::volume::try_acquire_lock(&lock_path);
|
|
assert!(acquired);
|
|
assert!(lock_path.exists());
|
|
|
|
let acquired2 = ahfail_ui::volume::try_acquire_lock(&lock_path);
|
|
assert!(!acquired2);
|
|
}
|