Switching activation policy from accessory to regular does not activate the app menu in the menu bar. User have switch to another app and back to make app menu to show in the menu bar.
Even the call to activate is successful:
the menu bar shows menu of the previously active app.
Filed feedback: FB7743313
Here is the project reproducing the issue with steps:
https://github.com/sparta-science/MacSwitchActivation
Below is README with step to reproduce to make it searchable in the developer forums:
When we click Show Window we instead see the app enter "Unexpected State" (See Reproduction Steps)
To workaround the user has to switch to another app temporarily and switch back to our app to get menu showing.
House Icon -> Show Window which should run
Even the call to activate is successful:
Code Block assert(NSApp.setActivationPolicy(.regular))
the menu bar shows menu of the previously active app.
Filed feedback: FB7743313
Here is the project reproducing the issue with steps:
https://github.com/sparta-science/MacSwitchActivation
Below is README with step to reproduce to make it searchable in the developer forums:
MacSwitchActivation
Demo of SetActivationPolicy bug on MacExpected behaviour
When we click Show Window we expect the app to enter "Active State"Actual behaviour
When we click Show Window we instead see the app enter "Unexpected State" (See Reproduction Steps)
To workaround the user has to switch to another app temporarily and switch back to our app to get menu showing.
App States
Active State:
App name appears in the menu bar
App Window is on top
App appears in dock
House Icon -> Show Window which should run
Code Block NSApp.activate(ignoringOtherApps: true) NSApp.setActivationPolicy(.regular)
Accessory State:
App name does not appear in the menu bar
No App Window is visible
App does not appear in dock
Unexpected State:
The previous active app name appears in the menu bar
App Window is on top
App does not appear in dock
Steps to reproduce
Launch the app to begin in "Active State"
Close app window to enter "Accessory State"
Restart the app to begin in "Accessory State"
Attempt to enter "Active State" by selecting Show Window in the menu dropdown
Notice the new "Unexpected State"
Cmd-tab to another app and back brings the menu and name in top left corner