forked from git-ecosystem/git-credential-manager
-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathMacOSSessionManager.cs
More file actions
31 lines (27 loc) · 1.01 KB
/
MacOSSessionManager.cs
File metadata and controls
31 lines (27 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
using GitCredentialManager.Interop.MacOS.Native;
using GitCredentialManager.Interop.Posix;
namespace GitCredentialManager.Interop.MacOS
{
public class MacOSSessionManager : PosixSessionManager
{
public MacOSSessionManager(ITrace trace, IEnvironment env, IFileSystem fs) : base(trace, env, fs)
{
PlatformUtils.EnsureMacOS();
}
public override bool IsDesktopSession
{
get
{
// Get information about the current session
int error = SecurityFramework.SessionGetInfo(SecurityFramework.CallerSecuritySession, out int id, out var sessionFlags);
// Check if the session supports Quartz
if (error == 0 && (sessionFlags & SessionAttributeBits.SessionHasGraphicAccess) != 0)
{
return true;
}
// Fall-through and check if X11 is available on macOS
return base.IsDesktopSession;
}
}
}
}