diff --git a/src/image.c b/src/image.c index 73cff39..0331c1c 100644 --- a/src/image.c +++ b/src/image.c @@ -40,6 +40,7 @@ bool image_load(struct image* image, char* path, FILE* rsp) { if (app_kv.key && app_kv.value && strcmp(app_kv.key, "app") == 0) { CGImageRef app_icon = workspace_icon_for_app(app_kv.value); scale = workspace_get_scale(); + scale *= scale; if (app_icon) new_image_ref = app_icon; else { respond(rsp, "[!] Image: Invalid application name: '%s'\n", app_kv.value); diff --git a/src/workspace.m b/src/workspace.m index 45001d4..8c30a40 100644 --- a/src/workspace.m +++ b/src/workspace.m @@ -9,7 +9,14 @@ @end float workspace_get_scale() { - return [[NSScreen mainScreen] backingScaleFactor]; + float scale = 1.f; + NSArray* screens = [NSScreen screens]; + for (int i = 0; i < [screens count]; i++) { + NSScreen* screen = screens[i]; + float screen_scale = [screen backingScaleFactor]; + if (screen_scale > scale) scale = screen_scale; + } + return scale; } void workspace_event_handler_init(void **context) { @@ -74,7 +81,7 @@ CGImageRef workspace_icon_for_app(char* app) { if (!image) return NULL; float scale = workspace_get_scale(); - NSRect rect = NSMakeRect( 0, 0, 16 * scale, 16 * scale); + NSRect rect = NSMakeRect( 0, 0, 32 * scale, 32 * scale); return (CGImageRef)CFRetain([image CGImageForProposedRect: &rect context: NULL hints: NULL]);