This is an automated email from the git hooks/post-receive script.
git pushed a commit to branch reproducible-widget-previews
in repository efl.
View the commit online.
commit 3dfb3a994be112e316285d9312d19601d0067aa0
Author: Cedric BAIL <[email protected]>
AuthorDate: Wed Mar 18 21:46:19 2026 -0600
cocoa: set application icon for Dock and Command+Tab on macOS
On macOS, non-bundled EFL applications have no icon in the Dock or
the Command+Tab app switcher, showing only a generic blank icon.
On Linux this is handled via ICCCM/NETWM icon properties, but the
Cocoa backend had no equivalent.
Add ecore_cocoa_app_icon_set() which loads an image file and sets it
as the NSApplication icon via [NSApp setApplicationIconImage:].
Hook it into elm_win_icon_name_set: when running on the Cocoa backend,
resolve the icon name through efreet_icon_path_find, with a fallback
that constructs the path relative to the EFL library directory
(<libdir>/../share/icons/hicolor/128x128/apps/<name>.png) since
XDG_DATA_DIRS may not include the Homebrew prefix on macOS.
Made-with: Cursor
---
src/lib/ecore_cocoa/Ecore_Cocoa.h | 8 ++++++++
src/lib/ecore_cocoa/ecore_cocoa.m | 21 +++++++++++++++++++++
src/lib/elementary/efl_ui_win.c | 21 +++++++++++++++++++++
3 files changed, 50 insertions(+)
diff --git a/src/lib/ecore_cocoa/Ecore_Cocoa.h b/src/lib/ecore_cocoa/Ecore_Cocoa.h
index 396ac7e8df..58e35956b3 100644
--- a/src/lib/ecore_cocoa/Ecore_Cocoa.h
+++ b/src/lib/ecore_cocoa/Ecore_Cocoa.h
@@ -541,6 +541,14 @@ EAPI double ecore_cocoa_window_backing_scale_get(const Ecore_Cocoa_Window *windo
EAPI void ecore_cocoa_terminate_cb_set(Ecore_Cocoa_Terminate_Cb cb)
EINA_ARG_NONNULL(1);
+/**
+ * Sets the application icon shown in the Dock and Command+Tab switcher.
+ * @param path Absolute path to a PNG or other image file
+ * @return EINA_TRUE on success, EINA_FALSE on failure
+ */
+EAPI Eina_Bool ecore_cocoa_app_icon_set(const char *path)
+ EINA_ARG_NONNULL(1);
+
/*
* The clipboard API is still BETA
diff --git a/src/lib/ecore_cocoa/ecore_cocoa.m b/src/lib/ecore_cocoa/ecore_cocoa.m
index 000ea592d2..dc544ac23b 100644
--- a/src/lib/ecore_cocoa/ecore_cocoa.m
+++ b/src/lib/ecore_cocoa/ecore_cocoa.m
@@ -495,3 +495,24 @@ ecore_cocoa_terminate_cb_set(Ecore_Cocoa_Terminate_Cb cb)
EINA_SAFETY_ON_NULL_RETURN(cb);
[NSApp setTerminateCb: cb];
}
+
+EAPI Eina_Bool
+ecore_cocoa_app_icon_set(const char *path)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(path, EINA_FALSE);
+
+ @autoreleasepool {
+ NSString *ns_path = [NSString stringWithUTF8String:path];
+ NSImage *icon = [[NSImage alloc] initWithContentsOfFile:ns_path];
+ if (!icon)
+ {
+ ERR("Failed to load icon from: %s", path);
+ return EINA_FALSE;
+ }
+ [NSApp setApplicationIconImage:icon];
+#if !__has_feature(objc_arc)
+ [icon release];
+#endif
+ }
+ return EINA_TRUE;
+}
diff --git a/src/lib/elementary/efl_ui_win.c b/src/lib/elementary/efl_ui_win.c
index 23d2ed3a38..fefaa40165 100644
--- a/src/lib/elementary/efl_ui_win.c
+++ b/src/lib/elementary/efl_ui_win.c
@@ -8542,6 +8542,27 @@ elm_win_icon_name_set(Evas_Object *obj, const char *icon_name)
#ifdef HAVE_ELEMENTARY_X
_elm_win_xwin_update(sd);
#endif
+#ifdef HAVE_ELEMENTARY_COCOA
+ if (sd->cocoa.win)
+ {
+ const char *path;
+ char buf[PATH_MAX];
+
+ elm_need_efreet();
+ path = efreet_icon_path_find(elm_config_icon_theme_get(),
+ icon_name, 128);
+ if (!path && _elm_lib_dir)
+ {
+ snprintf(buf, sizeof(buf),
+ "%s/../share/icons/hicolor/128x128/apps/%s.png",
+ _elm_lib_dir, icon_name);
+ if (access(buf, R_OK) == 0)
+ path = buf;
+ }
+ if (path)
+ ecore_cocoa_app_icon_set(path);
+ }
+#endif
}
EAPI const char*
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.