Skip to content

Commit

Permalink
Merge pull request #20 from dado3212/Fullscreen
Browse files Browse the repository at this point in the history
Fix for desktop views with the expanding desktop views
  • Loading branch information
dado3212 authored May 23, 2018
2 parents 21e059e + 0f4909d commit c5415f2
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
Binary file modified build/spaces-renamer.zip
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion spaces-renamer/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>1.4.0</string>
<string>1.4.1</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
Expand Down
16 changes: 11 additions & 5 deletions spaces-renamer/spacesRenamer.m
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,10 @@ - (void)setBounds:(CGRect)arg1 {
NSArray<CALayer *> *unexpandedViews = self.sublayers[3].sublayers[0].sublayers;
NSArray<CALayer *> *expandedViews = self.sublayers[3].sublayers[1].sublayers;

int numMonitors = MAX(unexpandedViews.count, expandedViews.count);

// Get which of the spaces in the current dock is selected
int selected = getSelected(unexpandedViews);
int selected = getSelected((!unexpandedViews || !unexpandedViews.count) ? expandedViews : unexpandedViews);

// Get all of the names
NSMutableArray* names = getNamesFromPlist();
Expand All @@ -183,7 +185,7 @@ - (void)setBounds:(CGRect)arg1 {
NSMutableArray *possibleMonitors = [[NSMutableArray alloc] init];
for (int i = 0; i < names.count; i++) {
if (
((NSArray *)names[i]).count == unexpandedViews.count && // Same number of monitors
((NSArray *)names[i]).count == numMonitors && // Same number of monitors
[names[i][selected][@"selected"] boolValue] // Same index is selected
) {
[possibleMonitors addObject:[NSNumber numberWithInt:i]];
Expand All @@ -199,9 +201,13 @@ - (void)setBounds:(CGRect)arg1 {
monitorIndex = monitorIndex % names.count;

for (int i = 0; i < ((NSArray*)names[monitorIndex]).count; i++) {
if (names[monitorIndex][i][@"name"] != nil && ![names[monitorIndex][i][@"name"] isEqualToString:@""] && i < unexpandedViews.count) {
setTextLayer(expandedViews[i], names[monitorIndex][i][@"name"]);
setTextLayer(unexpandedViews[i], names[monitorIndex][i][@"name"]);
if (names[monitorIndex][i][@"name"] != nil && ![names[monitorIndex][i][@"name"] isEqualToString:@""]) {
if (i < expandedViews.count) {
setTextLayer(expandedViews[i], names[monitorIndex][i][@"name"]);
}
if (i < unexpandedViews.count) {
setTextLayer(unexpandedViews[i], names[monitorIndex][i][@"name"]);
}
}
}

Expand Down

0 comments on commit c5415f2

Please sign in to comment.