I have a LaunchAgent with starts my app when loaded. This app will run on per user mode. When there are multiple users logged in using fast user switch, the app should run for each user.
So the binary loading the LaunchAgent is running as root. For loading I am giving the command as
launchctl bsexec 64 chroot -u <username> / launchctl load -w -F -s Aqua /Library/LaunchAgents/<name_launchagent>.plist
The number 64 is the PID of loginwindow.
This command is executed for each user logged in with PID of loginwindow for each user.
But all this app are appearing on the window of the currently logged in user. The app is a menubar app, when launchagent is loaded for each user, current active user's menubar fills with multiple icons of app loaded for each user. In activity monitor I could see that the user name for each app is correctly specified.
Can some help me on this. Why is the app for other users shown on the currently logged in screen?!.
Is there any other way to load app for all the users currently logged in to the system?