FYI, When I mention Session I always mean a UI Session (whether its prelogin or User's) - gotten used to saying just Session because of Windows. I'm working on a screen sharing app so that's why I'm interested in capturing the entire UI pre-login, lock, desktop etc.
[quote='803061022, DTS Engineer, /thread/763453?answerId=803061022#803061022']
That window server session is used for all GUI work related to that login session. This includes, for example, screen saver unlock.
[/quote]
So login screen runs in its own GUI Session (does it get its own GUI Session ID?) and for that Pre-Login Agent is launched and it runs in the context of user _securityagent. After Login the user's GUI session is created and user gets its own Window Server. Everything relative to that User's GUI is displayed in that GUI Session i.e. normal desktop, lock screen and screensaver?
[quote='803061022, DTS Engineer, /thread/763453?answerId=803061022#803061022']
For example, if you fast user switch from user A to user B, there may or may not be a pre-login session spun up in between.
[/quote]
Which GUI session is responsible for displaying UI in this scenario? First user A's GUI session or user B's?
This question is predicated on the assumption that there’s only a single GUI login session visible on screen at a time. That’s not true. With screen sharing it’s possible to have multiple GUI login sessions active simultaneously [2].
FYI, the best way to get the current console user from a daemon is SCDynamicStoreCopyConsoleUser.
AFAIK, there is only one Active GUI session possible on mac. What's the scenario in which multiple GUI login sessions are Active and displaying a UI?
I looked into SCDynamicStoreCopyConsoleUser it returns username, uid, and gid. How do I get GUI session ID for the console user? (for both cases, prelogin and user session)
[quote='803061022, DTS Engineer, /thread/763453?answerId=803061022#803061022']
This daemon-with-zero-or-more-helper-agents architecture has stood the test of time.
[/quote]
That's the approach I'm planning on taking now. My main concern with that is if a user keeps terminating one of the user agents, would the system keep restarting it? If not, my daemon would be blind to what's going on in that user's session - in terms of capturing screen etc.
Also, with this approach of Pre-login & user agents doing the work. Assuming each Agent notifies daemon of the active/current session. Would the system always be in correct 'state' i.e. is there a scenario where my application would miss out on screen capture e.g. fast user switching from user A to user B, etc basically the edge cases. Would at least one Agent (pre-login or User) always be in the Active Window server to capture screen?