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

Initial notification icon support #710

Merged
merged 2 commits into from May 15, 2024
Merged

Conversation

MrPenguin07
Copy link
Contributor

As icon locations are platform dependent, iterate through paths & add to notification util.
Confirmed working well for linux(deb/rpm), AppImage & Windows platforms.

Todo:

  • Confirm mac & flatpak icon paths are correct (i'm unable to test)
    @aaronliu0130 appreciate if you're able to test.

Before and after shots:

Linux notifications:
upscayl-notif-linux
(bottom before, top after)

Windows:
upscayl-win-notif

Win.

As icon locations are platform dependent, iterate through paths & add to notifications
@aaronliu0130
Copy link
Member

aaronliu0130 commented Feb 12, 2024

Doesn't resources/128x128.png always exist regardless of system?

@NayamAmarshe NayamAmarshe marked this pull request as draft February 12, 2024 16:20
@MrPenguin07
Copy link
Contributor Author

MrPenguin07 commented Feb 12, 2024

Doesn't resources/128x128.png always exist regardless of system?

In my testing a relative path to resources/128x128.png definitely doesn't handle AppImage (eg. the appimage path seemingly requires the path prefixed __appImage-x64/.), and best practice for linux package managers is to move the icons to the /usr/share/icons standard dir during install which would then break reliance on this relative path.

This could be rewritten to search for the icon - though I find that to likely be less efficient than a handful of hardcoded locations. Sometimes it's upscayl.png, others 128x128.png, sometimes can use relative path, other times can't.... so in addition to efficiency I think reliability also reduced performing a lookup for it.

edit: more info

@aaronliu0130
Copy link
Member

Maybe it has to be a ./? I currently don't have access to my Arch laptop so I can't test it yet

@MrPenguin07
Copy link
Contributor Author

Maybe it has to be a ./? I currently don't have access to my Arch laptop so I can't test it yet

You mean as below?

  const iconPaths = [
    "./resources/128x128.png",
  ];

As much as i'd love that simplicity to be true, confirming this doesn't work for AppImage (and I suspect others).

@aaronliu0130
Copy link
Member

aaronliu0130 commented Feb 13, 2024

Hmm, maybe it's only an AppImage thing? AppImage/AppImageKit#1035

I'd suspect the ./ to have no actual effect here.

@MrPenguin07
Copy link
Contributor Author

MrPenguin07 commented Feb 13, 2024

Hmm, maybe it's only an AppImage thing? AppImage/AppImageKit#1035

I'd suspect the ./ to have no actual effect here.

There very well may be an appimage variable or some such to the icon however confirming that resources/128x128.png will not work it would require an extra path in the array regardless.
The path prefixed with __appImage-x64 works - and is unlikely to change? - so may not be worth the headache looking further :)

Can confirm the deb/rpm work simply with resources/128x128.png however again i'd hesitate to rely on that, package managers may not retain an otherwise redundant icon (especially since we fixed #680 ) in future.
So an extra path to the freedesktop icon spec location under /usr/share/icons is wise.

Windows I believe does use resources/128x128.png.

So this justifies my thought process in hardcoding a handful of paths, while not my favorite bit of code it oddly seems the simplest and can't imagine these paths changing anytime soon.

The flatpak and mac builds i'm curious about, would appreciate feedback from someone who can test these.

Copy link

This PR has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you are still working on this, please reply to indicate so.

@github-actions github-actions bot added the stale We lack your response. Please reply to re-start the issue label Mar 30, 2024
@aaronliu0130 aaronliu0130 removed the stale We lack your response. Please reply to re-start the issue label Mar 30, 2024
Copy link

This PR has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you are still working on this, please reply to indicate so.

@github-actions github-actions bot added the stale We lack your response. Please reply to re-start the issue label May 15, 2024
@MrPenguin07
Copy link
Contributor Author

So would appreciate some input on this;
What exactly needs be done to merge this?
Needs more emoji?!

I've confirmed this PR works on majority of builds - even if it didn't work, for eg., on the mac build the notification would still show same as without the PR.

@NayamAmarshe NayamAmarshe marked this pull request as ready for review May 15, 2024 10:17
@NayamAmarshe
Copy link
Member

So would appreciate some input on this; What exactly needs be done to merge this? Needs more emoji?!

I've confirmed this PR works on majority of builds - even if it didn't work, for eg., on the mac build the notification would still show same as without the PR.

The PR was in draft, I thought you were still working on it.

Copy link
Member

@NayamAmarshe NayamAmarshe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! We just need to update one thing :)

electron/utils/show-notification.ts Outdated Show resolved Hide resolved
@NayamAmarshe NayamAmarshe merged commit b2a3e54 into upscayl:main May 15, 2024
@NayamAmarshe NayamAmarshe changed the title [WIP] Initial notification icon support Initial notification icon support May 15, 2024
@MrPenguin07
Copy link
Contributor Author

The PR was in draft, I thought you were still working on it.

Just hoped someone could test it for mac/flatpak :)
Cheers

@aaronliu0130
Copy link
Member

Continuing discussion in b2a3e54

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale We lack your response. Please reply to re-start the issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants