diff --git a/openless-all/app/scripts/macos-capsule-spaces-contract.test.mjs b/openless-all/app/scripts/macos-capsule-spaces-contract.test.mjs index 0d48305a..f83684b6 100644 --- a/openless-all/app/scripts/macos-capsule-spaces-contract.test.mjs +++ b/openless-all/app/scripts/macos-capsule-spaces-contract.test.mjs @@ -26,6 +26,12 @@ assertMatch( 'macOS capsule should join all Spaces before showing without activation', ); +assertMatch( + macosNoActivateFunction, + /FULL_SCREEN_AUXILIARY[\s\S]*?1 << 8[\s\S]*?setCollectionBehavior[\s\S]*?orderFrontRegardless/, + 'macOS capsule should join fullscreen Spaces as an auxiliary window before showing without activation', +); + for (const forbidden of ['window.show()', 'set_focus', 'NSApp.activate', 'makeKeyAndOrderFront']) { if (executableMacosNoActivateFunction.includes(forbidden)) { throw new Error(`macOS capsule no-activate path must not call ${forbidden}`); diff --git a/openless-all/app/src-tauri/src/coordinator.rs b/openless-all/app/src-tauri/src/coordinator.rs index b7869133..abb01a28 100644 --- a/openless-all/app/src-tauri/src/coordinator.rs +++ b/openless-all/app/src-tauri/src/coordinator.rs @@ -4507,6 +4507,13 @@ fn show_capsule_window_no_activate( } unsafe { + const NS_WINDOW_COLLECTION_BEHAVIOR_CAN_JOIN_ALL_SPACES: usize = 1 << 0; + const NS_WINDOW_COLLECTION_BEHAVIOR_FULL_SCREEN_AUXILIARY: usize = 1 << 8; + let behavior: usize = msg_send![ns_window, collectionBehavior]; + let behavior = behavior + | NS_WINDOW_COLLECTION_BEHAVIOR_CAN_JOIN_ALL_SPACES + | NS_WINDOW_COLLECTION_BEHAVIOR_FULL_SCREEN_AUXILIARY; + let _: () = msg_send![ns_window, setCollectionBehavior: behavior]; let _: () = msg_send![ns_window, orderFrontRegardless]; } true