Skip to content
This repository has been archived by the owner on Sep 29, 2023. It is now read-only.

Tray icon not displayed on macOS #668

Closed
cunneen opened this issue Aug 12, 2018 · 7 comments
Closed

Tray icon not displayed on macOS #668

cunneen opened this issue Aug 12, 2018 · 7 comments

Comments

@cunneen
Copy link

cunneen commented Aug 12, 2018

Description

Thanks for nativefier, it's very useful.

The tray icon on mac os is not displayed.

image

image

Details

  • nativefying the asana website.
  • nativefier https://app.asana.com ; I've also tried nativefier https://app.asana.com --icon ~/Downloads/asana.icns --tray ; it makes no difference.
  • Nativefier: 7.6.7
  • node.js: v8.11.3
  • OS: macOS High Sierra 10.13.6
@dvbii
Copy link

dvbii commented Aug 23, 2018

Not a fix, however, I believe I found the issue. It has to do with the function getAppIcon() in helpers.js where it is looking for a 'icon.png' (OSX) and that file isn't created by the Icon functions.

In trayIcon.js, it gets the iconPath from;
const iconPath = getAppIcon();
which is calling helpers.js;

function getAppIcon() {
  return path.join(__dirname, '../', `/icon.${isWindows() ? 'ico' : 'png'}`);
}

Which says to get the icon.png file one directory up from the final build 'main.js'.
If I manually put a 'icon.png' in the XX.app/Contents/Reources/app directory and then relaunch the app, it works.

@Kikobeats
Copy link

@dvbii feeling you're right, but I put an image there and doesn't work.

Maybe the image needs to have a specific dimension?

On the other hand, why not make this file configurable as flag?

nativefier -n Twitter --fast-quit --single-instance --tray twitter.png "https://m.twitter.com"

@dvbii
Copy link

dvbii commented Sep 7, 2018

Yes, I had to make the image 90pixels x 90 pixels. Then had to name it icon.png. Definitely agree it should either be a flag or at least add to the function that makes the icons to auto create this icon.png and put it where it needs to go. Or change the reference to where it is looking for it.

@ronjouch ronjouch changed the title Tray icon not displayed (mac os) Tray icon not displayed on macOS Nov 25, 2018
@fuzzy76
Copy link

fuzzy76 commented Jan 10, 2019

Using the optional imagemagick suite for resizing if needed would also be nice.

@fuzzy76
Copy link

fuzzy76 commented Jan 10, 2019

Or even using --icon (or the site favicon) as a default image.

@ronjouch
Copy link
Contributor

Hi everybody. I recently released Nativefier 8.0.4, which revamps and upgrades lots of things. I don't have a Mac to re-test this, can one of you tell me if this is still an issue with 8.0.4? Thanks.

@davidparsson
Copy link

I tried 8.0.4 but I'm unable to even create the app:

$ ./node_modules/.bin/nativefier \
  --internal-urls='^((?!/pattern/).)*$' \
  --fast-quit \
  --single-instance \
  --icon=headshot.png \
  --min-width=240 \
  --min-height=180 \
  http://my-web-page/

/path/to/node_modules/nativefier/lib/build/buildNativefierApp.js:39
async function copyIconsIfNecessary(options, appPath) {
      ^^^^^^^^
SyntaxError: Unexpected token function
    at Object.exports.runInThisContext (vm.js:76:16)
    at Module._compile (module.js:542:28)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/Users/dp/tools/native-jenkins-monitor/node_modules/nativefier/src/main.ts:3:1)

I'm not sure if I'm doing something wrong, but I've moved on from nativefier so I'm not really invested in putting a lot of effort into debugging.

TheCleric pushed a commit to TheCleric/nativefier that referenced this issue Apr 29, 2021
TheCleric added a commit that referenced this issue Apr 30, 2021
* Add ability to inject multiple css/js files

* API doc: Move misplaced macOS shortcuts doc (PR #1158)

When I added this documentation originally, I guess I placed it in the wrong location.

* README: use quotes in example, to divert users from shell globbing pitfalls

Follow-up of #1159 (comment)

* Support opening URLs passed as arg to Nativefied application (fix #405) (PR #1154)

Co-authored-by: Ronan Jouchet <ronan@jouchet.fr>

* macOS: Fix crash when using --tray (fix #527), and invisible icon (fix #942, fix #668) (#1156)

This fixes:

1. A startup crash on macOS when using the `--tray` option; see #527.
  ![image](https://user-images.githubusercontent.com/22625791/115987741-99544600-a5b6-11eb-866a-dadb5640eecb.png)
2. Invisible tray icon on macOS; see #942 and #668.  
   ![image](https://user-images.githubusercontent.com/22625791/115988276-24364000-a5b9-11eb-80c3-561a8a646754.png)

Co-authored-by: Ronan Jouchet <ronan@jouchet.fr>

* API.md / --widevine: document signing apps to make some sites like HBO Max & Udemy work (fix #1147)

* Prompt to confirm when page is attempting to prevent unload (#1163)

Should alleviate part of the issue in #1151

* Add an option to upgrade an existing app (fix #1131) (PR #1138)

This adds a `--upgrade` option to upgrade-in-place an old app, re-using its options it can.
Should help fix #1131

Co-authored-by: Ronan Jouchet <ronan@jouchet.fr>

* Bump to Electron 12.0.5 with Chrome 89.0.4389.128

* Add newly discovered Google internal login page (#1167)

* Fix Widevine by properly listening to widevine-... events, and update docs (fix #1153) (PR #1164)

As documented in #1153, for Widevine support to work properly, we need to listen for the Widevine ready event, and as well for certain sites the app must be signed.

This PR adds the events, and as well adds better documentation on the signing limitation.

This may also help resolve #1147

* Improve suffix creation + tests

* API: clarif in existing doc by the way

* Typo

Co-authored-by: Ronan Jouchet <ronan@jouchet.fr>
Co-authored-by: Ben Curtis <github@nosolutions.com>
Co-authored-by: Fabian Wolf <22625791+fabiwlf@users.noreply.github.com>
Adam777Z pushed a commit to Adam777Z/nativefier that referenced this issue Nov 9, 2022
Adam777Z pushed a commit to Adam777Z/nativefier that referenced this issue Nov 9, 2022
…1162)

* Add ability to inject multiple css/js files

* API doc: Move misplaced macOS shortcuts doc (PR nativefier#1158)

When I added this documentation originally, I guess I placed it in the wrong location.

* README: use quotes in example, to divert users from shell globbing pitfalls

Follow-up of nativefier#1159 (comment)

* Support opening URLs passed as arg to Nativefied application (fix nativefier#405) (PR nativefier#1154)

Co-authored-by: Ronan Jouchet <ronan@jouchet.fr>

* macOS: Fix crash when using --tray (fix nativefier#527), and invisible icon (fix nativefier#942, fix nativefier#668) (nativefier#1156)

This fixes:

1. A startup crash on macOS when using the `--tray` option; see nativefier#527.
  ![image](https://user-images.githubusercontent.com/22625791/115987741-99544600-a5b6-11eb-866a-dadb5640eecb.png)
2. Invisible tray icon on macOS; see nativefier#942 and nativefier#668.  
   ![image](https://user-images.githubusercontent.com/22625791/115988276-24364000-a5b9-11eb-80c3-561a8a646754.png)

Co-authored-by: Ronan Jouchet <ronan@jouchet.fr>

* API.md / --widevine: document signing apps to make some sites like HBO Max & Udemy work (fix nativefier#1147)

* Prompt to confirm when page is attempting to prevent unload (nativefier#1163)

Should alleviate part of the issue in nativefier#1151

* Add an option to upgrade an existing app (fix nativefier#1131) (PR nativefier#1138)

This adds a `--upgrade` option to upgrade-in-place an old app, re-using its options it can.
Should help fix nativefier#1131

Co-authored-by: Ronan Jouchet <ronan@jouchet.fr>

* Bump to Electron 12.0.5 with Chrome 89.0.4389.128

* Add newly discovered Google internal login page (nativefier#1167)

* Fix Widevine by properly listening to widevine-... events, and update docs (fix nativefier#1153) (PR nativefier#1164)

As documented in nativefier#1153, for Widevine support to work properly, we need to listen for the Widevine ready event, and as well for certain sites the app must be signed.

This PR adds the events, and as well adds better documentation on the signing limitation.

This may also help resolve nativefier#1147

* Improve suffix creation + tests

* API: clarif in existing doc by the way

* Typo

Co-authored-by: Ronan Jouchet <ronan@jouchet.fr>
Co-authored-by: Ben Curtis <github@nosolutions.com>
Co-authored-by: Fabian Wolf <22625791+fabiwlf@users.noreply.github.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants