WIP: Attempt to actually use the custom icons
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
This commit is contained in:
parent
a0b8b1ac56
commit
03526aaa44
2 changed files with 54 additions and 19 deletions
|
@ -28,6 +28,8 @@
|
||||||
|
|
||||||
NSImageView *imageView;
|
NSImageView *imageView;
|
||||||
NSProgressIndicator *progressIndicator;
|
NSProgressIndicator *progressIndicator;
|
||||||
|
|
||||||
|
NSGlassEffectContainerView *glassView API_AVAILABLE(macosx(26.0));
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -43,10 +43,18 @@ static NSString *CogCustomDockIconsReloadNotification = @"CogCustomDockIconsRelo
|
||||||
}
|
}
|
||||||
|
|
||||||
static NSString *getBadgeName(NSString *baseName, BOOL colorfulIcons) {
|
static NSString *getBadgeName(NSString *baseName, BOOL colorfulIcons) {
|
||||||
if(colorfulIcons) {
|
if(@available(macOS 26.0, *)) {
|
||||||
return [baseName stringByAppendingString:@"Colorful"];
|
if(colorfulIcons) {
|
||||||
|
return [@"Cog26" stringByAppendingString:[baseName stringByAppendingString:@"Colorful"]];
|
||||||
|
} else {
|
||||||
|
return [@"Cog26" stringByAppendingString:baseName];
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
return [baseName stringByAppendingString:@"Normal"];
|
if(colorfulIcons) {
|
||||||
|
return [baseName stringByAppendingString:@"Colorful"];
|
||||||
|
} else {
|
||||||
|
return [baseName stringByAppendingString:@"Normal"];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -137,6 +145,11 @@ static NSString *getCustomIconName(NSString *baseName) {
|
||||||
drawIcon = YES;
|
drawIcon = YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOL glassIcons = NO;
|
||||||
|
if(@available(macOS 26.0, *)) {
|
||||||
|
glassIcons = YES;
|
||||||
|
}
|
||||||
|
|
||||||
NSDockTile *dockTile = [NSApp dockTile];
|
NSDockTile *dockTile = [NSApp dockTile];
|
||||||
|
|
||||||
if(drawIcon) {
|
if(drawIcon) {
|
||||||
|
@ -154,20 +167,30 @@ static NSString *getCustomIconName(NSString *baseName) {
|
||||||
}
|
}
|
||||||
|
|
||||||
NSSize badgeSize = [badgeImage size];
|
NSSize badgeSize = [badgeImage size];
|
||||||
|
|
||||||
NSImage *newDockImage = (useCustomDockIcons && !useCustomDockIconsPlaque) ? [[NSImage alloc] initWithSize:NSMakeSize(1024, 1024)] : [dockImage copy];
|
if(!glassIcons || useCustomDockIcons) {
|
||||||
[newDockImage lockFocus];
|
NSImage *newDockImage = (useCustomDockIcons && !useCustomDockIconsPlaque) ? [[NSImage alloc] initWithSize:NSMakeSize(2048, 2048)] : [dockImage copy];
|
||||||
|
[newDockImage lockFocus];
|
||||||
[badgeImage drawInRect:NSMakeRect(0, 0, 1024, 1024)
|
|
||||||
fromRect:NSMakeRect(0, 0, badgeSize.width, badgeSize.height)
|
[badgeImage drawInRect:NSMakeRect(0, 0, 2048, 2048)
|
||||||
operation:NSCompositingOperationSourceOver
|
fromRect:NSMakeRect(0, 0, badgeSize.width, badgeSize.height)
|
||||||
fraction:1.0];
|
operation:NSCompositingOperationSourceOver
|
||||||
|
fraction:1.0];
|
||||||
[newDockImage unlockFocus];
|
|
||||||
|
[newDockImage unlockFocus];
|
||||||
imageView = [[NSImageView alloc] init];
|
|
||||||
[imageView setImage:newDockImage];
|
imageView = [[NSImageView alloc] init];
|
||||||
[dockTile setContentView:imageView];
|
[imageView setImage:newDockImage];
|
||||||
|
[dockTile setContentView:imageView];
|
||||||
|
} else {
|
||||||
|
if (@available(macOS 26.0, *)) {
|
||||||
|
glassView = [[NSGlassEffectContainerView alloc] initWithFrame:NSMakeRect(0, 0, badgeSize.width, badgeSize.height)];
|
||||||
|
}
|
||||||
|
imageView = [[NSImageView alloc] init];
|
||||||
|
[imageView setImage:badgeImage];
|
||||||
|
[glassView setContentView:imageView];
|
||||||
|
[dockTile setContentView:glassView];
|
||||||
|
}
|
||||||
|
|
||||||
progressIndicator = [[NSProgressIndicator alloc] initWithFrame:NSMakeRect(0.0, 0.0, dockTile.size.width, 10.0)];
|
progressIndicator = [[NSProgressIndicator alloc] initWithFrame:NSMakeRect(0.0, 0.0, dockTile.size.width, 10.0)];
|
||||||
[progressIndicator setStyle:NSProgressIndicatorStyleBar];
|
[progressIndicator setStyle:NSProgressIndicatorStyleBar];
|
||||||
|
@ -184,9 +207,19 @@ static NSString *getCustomIconName(NSString *baseName) {
|
||||||
|
|
||||||
if(displayProgress) {
|
if(displayProgress) {
|
||||||
if(!imageView) {
|
if(!imageView) {
|
||||||
|
NSImage *dockImage = [NSApp applicationIconImage];
|
||||||
|
NSSize size = [dockImage size];
|
||||||
|
if(@available(macOS 26.0, *)) {
|
||||||
|
glassView = [[NSGlassEffectContainerView alloc] initWithFrame:NSMakeRect(0, 0, size.width, size.height)];
|
||||||
|
}
|
||||||
imageView = [[NSImageView alloc] init];
|
imageView = [[NSImageView alloc] init];
|
||||||
[imageView setImage:[NSApp applicationIconImage]];
|
[imageView setImage:dockImage];
|
||||||
[dockTile setContentView:imageView];
|
if(@available(macOS 26.0, *)) {
|
||||||
|
[glassView setContentView:imageView];
|
||||||
|
[dockTile setContentView:glassView];
|
||||||
|
} else {
|
||||||
|
[dockTile setContentView:imageView];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!progressIndicator) {
|
if(!progressIndicator) {
|
||||||
|
|
Loading…
Reference in a new issue