Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for App Expose on Catalina? #7

Open
cotfas opened this issue May 17, 2020 · 2 comments
Open

Support for App Expose on Catalina? #7

cotfas opened this issue May 17, 2020 · 2 comments

Comments

@cotfas
Copy link

cotfas commented May 17, 2020

Very nice about the project, I was able to detect when the mission control is active.
Is there any support to check also when the App Expose is active?
Thank you.

@noah-nuebling
Copy link

Hi there @cotfas how did you manage to check whether Mission Control is active? It's something I'm also very interested in.

Thanks!

@cotfas
Copy link
Author

cotfas commented Sep 18, 2021

Hello!

This one worked https://gist.github.com/puffnfresh/4054059

Readapted for my case:

`static bool isMissionControlActiveParam(CGSSpaceMask type) {
printfSP("isMissionControlActiveParam %d\n", type);

CFArrayRef spaces = CGSCopySpaces(CGSDefaultConnection, type);
if (showSpacesLog) {
    NSLog(@"queried spaces: %@", spaces);
}

bool missionControlActive = false;

int i;
for(i = 0; i < CFArrayGetCount(spaces); i++) {
    
    NSNumber * val = (NSNumber *) CFArrayGetValueAtIndex(spaces, i);
    long long longValue = [val longLongValue];
    CGSSpace space = longValue;
    
    CFStringRef name = CGSSpaceCopyName(CGSDefaultConnection, space);
    if (showSpacesLog) {
        CFShow(name);
    }
    printfSP("Space ID: %lld\n", space);
    printfSP("Absolute level: %d\n", CGSSpaceGetAbsoluteLevel(CGSDefaultConnection, space));
    printfSP("Compat ID: %d\n", CGSSpaceGetCompatID(CGSDefaultConnection, space));
    printfSP("Type: %d\n", CGSSpaceGetType(CGSDefaultConnection, space));
    printfSP("\n");
    
    NSString *compareName = (NSString *)CFBridgingRelease(name);
    if ([compareName isEqualToString:@"mission-control"]) {
        printfSP("found mission-control returning true\n");
        missionControlActive = true;
    }
}
printfSP("-----------------\n");

return missionControlActive;

}`

//kCGSSpaceAll - onlyDesktop
//kCGSAllOSSpacesMask - returns mission-control on noMissionControl and also SpacesBarWindowController when yesMissionControl
//kCGSCurrentOSSpacesMask - returns mission-control/SpacesBarWindowController only on yesMissionControl

bool isActive = isMissionControlActiveParam(kCGSCurrentOSSpacesMask);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants