Posted By

iloveitaly on 12/03/09


Tagged

window cocoa mac server console screen gui os graphics user x active core carbon cg


Versions (?)

Check If Active Console / GUI User


 / Published in: C
 

URL: http://developer.apple.com/mac/library/documentation/MacOSX/Conceptual/BPMultipleUsers/Concepts/FastUserSwitching.html

  1. - (BOOL) isActiveUser {
  2. NSDictionary *sessionInfo = (NSDictionary *) CGSessionCopyCurrentDictionary();
  3.  
  4. NSString *shortUserName = [sessionInfo valueForKey:kCGSessionUserNameKey];
  5. NSString *userUID = [sessionInfo valueForKey:kCGSessionUserIDKey];
  6. BOOL userIsActive = [[sessionInfo valueForKey:kCGSessionOnConsoleKey] boolValue];
  7. NSString *loginCompleted = [sessionInfo valueForKey:kCGSessionLoginDoneKey];
  8.  
  9. NSLog(@"Session information: %@", sessionInfo);
  10.  
  11. return userIsActive;
  12. }

Report this snippet  

You need to login to post a comment.