Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mako fails to load icons #239

Closed
lovesegfault opened this issue Mar 10, 2020 · 8 comments
Closed

Mako fails to load icons #239

lovesegfault opened this issue Mar 10, 2020 · 8 comments

Comments

@lovesegfault
Copy link

I'm on NixOS, which means the usual paths for things don't exist. In trying to use mako with icon support, by configuring it as such

background-color=#0a0e14
border-color=#53bdfa
default-timeout=30000
font=Hack 10
icon-path="/home/bemeurer/.nix-profile/share/icons/hicolor:/run/current-system/sw/share/icons/hicolor"
icons=1
max-visible=-1
sort=-time
text-color=#b3b1ad
width=500

I get the following logs:

Mar 10 02:12:22 foucault mako[9810]: Failed to load icon (Failed to open file “/usr/share/icons/hicolor/32x32/apps/weechat.png”: No such file or directory)
Mar 10 02:12:23 foucault mako[9810]: Failed to load icon (Failed to open file “/usr/share/icons/hicolor/32x32/apps/weechat.png”: No such file or directory)
Mar 10 02:14:15 foucault mako[9810]: Failed to load icon (Failed to open file “/usr/share/icons/hicolor/32x32/apps/weechat.png”: No such file or directory)

Inspecting the paths configured with icon-path though, I see the file

❯ stat /home/bemeurer/.nix-profile/share/icons/hicolor/32x32/apps/weechat.png
  File: /home/bemeurer/.nix-profile/share/icons/hicolor/32x32/apps/weechat.png -> /nix/store/6dpwvixxl7i6718y7d84iizgyj3g1pnf-weechat-bin-env-2.7.1/share/icons/hicolor/32x32/apps/weechat.png
  Size: 108       	Blocks: 0          IO Block: 4096   symbolic link
Device: fe00h/65024d	Inode: 1893039279  Links: 2
Access: (0777/lrwxrwxrwx)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2020-03-07 21:46:44.000000000 -0800
Modify: 1969-12-31 16:00:01.000000000 -0800
Change: 2020-03-08 00:29:19.041937354 -0800
 Birth: 2020-03-07 21:46:44.438904301 -0800

Does mako just give up when it doesn't find /usr/share/icons/hicolor or /usr/share/pixmaps?

@emersion
Copy link
Owner

You need to drop the double-quotes in the config file. See #107.

@lovesegfault
Copy link
Author

That seems to have had no effect. New configuration:

background-color=#0a0e14
border-color=#53bdfa
default-timeout=30000
font=Hack 10
icon-path=/home/bemeurer/.nix-profile/share/icons/hicolor:/run/current-system/sw/share/icons/hicolor
icons=1
max-visible=-1
sort=-time
text-color=#b3b1ad
width=500

Behavior and logs look the same:

Mar 10 02:27:49 foucault mako[16121]: Failed to load icon (Failed to open file “/usr/share/icons/hicolor/32x32/apps/weechat.png”: No such file or directory)

(yes I restarted the unit)

@emersion emersion reopened this Mar 10, 2020
@emersion
Copy link
Owner

Actually, are you sure the client sends the icon name and not an absolute path? What's the output of makoctl list?

@emersion
Copy link
Owner

@lovesegfault
Copy link
Author

❯ makoctl list
{
        "type" : "aa{sv}",
        "data" : [
                []
        ]
}

I'm adding the patches in a moment

@lovesegfault
Copy link
Author

lovesegfault commented Mar 10, 2020

Applying this patch

diff --git a/dbus/xdg.c b/dbus/xdg.c
index 81e115d..55fe4d0 100644
--- a/dbus/xdg.c
+++ b/dbus/xdg.c
@@ -116,6 +116,7 @@ static int handle_notify(sd_bus_message *msg, void *data,
 
 	notif->app_name = strdup(app_name);
 	notif->app_icon = strdup(app_icon);
+	fprintf(stderr, ">>>> L119:notif-app_icon=%s\n", notif->app_icon);
 	notif->summary = strdup(summary);
 	notif->body = strdup(body);
 
@@ -240,6 +241,7 @@ static int handle_notify(sd_bus_message *msg, void *data,
 			// will win over app_icon if provided.
 			free(notif->app_icon);
 			notif->app_icon = strdup(image_path);
+			fprintf(stderr, ">>>> L244:notif-app_icon=%s\n", notif->app_icon);
 		} else if (strcmp(hint, "image-data") == 0 ||
 				strcmp(hint, "image_data") == 0 ||  // Deprecated.
 				strcmp(hint, "icon_data") == 0) {  // Even more deprecated.

@lovesegfault
Copy link
Author

Mar 10 02:47:22 foucault mako[719]: >>>> L119:notif-app_icon=/usr/share/icons/hicolor/32x32/apps/weechat.png
Mar 10 02:47:22 foucault mako[719]: Failed to load icon (Failed to open file “/usr/share/icons/hicolor/32x32/apps/weechat.png”: No such file or directory)

@emersion
Copy link
Owner

Okay, so this means the app creating the notification provides an absolute path to a non-existent icon. We can't really do anything here, the client needs to be fixed to just send the icon name instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants