File tree Expand file tree Collapse file tree 1 file changed +18
-6
lines changed Expand file tree Collapse file tree 1 file changed +18
-6
lines changed Original file line number Diff line number Diff line change 6
6
// Copyright 2017 Alex Beals.
7
7
//
8
8
9
- @import AppKit ;
9
+ @import Foundation ;
10
10
#import " ZKSwizzle.h"
11
11
#import < QuartzCore/QuartzCore.h>
12
12
20
20
#define listOfSpacesPlist [@" ~/Library/Containers/com.alexbeals.spacesrenamer/com.alexbeals.spacesrenamer.currentspaces.plist" stringByExpandingTildeInPath ]
21
21
#define spacesPath [@" ~/Library/Preferences/com.apple.spaces.plist" stringByExpandingTildeInPath ]
22
22
23
+ // Maximum online or active displays.
24
+ //
25
+ // SpacesRenamer uses the core graphics API to get online/active
26
+ // displays by calling CGGetActiveDisplayList() and CGGetOnlineDisplayList(),
27
+ // this definition is the count that will be used when calling those functions.
28
+ //
29
+ // If you have more than 12 monitors, this tweak can't help you with organization, good luck.
30
+ #define kMaxDisplays 12
31
+
23
32
int monitorIndex = 0 ;
24
33
25
34
@interface ECMaterialLayer : CALayer
@@ -397,16 +406,19 @@ - (BOOL)probablyDesktopSwitcher:(CGRect)rect {
397
406
return false ;
398
407
}
399
408
409
+ // Get all of the monitors
410
+ CGDirectDisplayID displayArray[kMaxDisplays ];
411
+ uint32_t displayCount;
412
+ CGGetActiveDisplayList (kMaxDisplays , displayArray, &displayCount);
413
+
400
414
// Is the width of the full screen (one of them)
401
- NSArray *const screenArray = [NSScreen screens ];
402
- for (int i = 0 ; i < screenArray.count ; i++) {
403
- NSScreen *const screen = [screenArray objectAtIndex: i];
404
- if (screen.visibleFrame .size .width == rect.size .width ) {
415
+ for (int i = 0 ; i < displayCount; i++) {
416
+ if (CGDisplayPixelsWide (displayArray[i]) == rect.size .width ) {
405
417
return true ;
406
418
}
407
419
}
408
420
409
- // Default to NO
421
+ // Default to false
410
422
return false ;
411
423
}
412
424
You can’t perform that action at this time.
0 commit comments