numixproject / numix-icon-theme

Official base icon theme from the Numix project.
http://numixproject.github.io
GNU General Public License v3.0
778 stars 86 forks source link

Tray icon for ElectronMail #1397

Closed Jvlsc closed 2 years ago

Jvlsc commented 4 years ago
Application name Icon name Desktop file name Original icon
ElectronMail electron-mail electron-mail original

Description: `ElectronMail is an Electron-based unofficial desktop client for ProtonMail. The app aims to provide enhanced desktop user experience enabling features that are not supported by the official in-browser web clients.

Website: https://github.com/vladimiry/ElectronMail

By default, the tray icon is being override by electron icon. Could you fix it?

palob commented 4 years ago

Could you please research the tray icon name or post a screenshot?

Jvlsc commented 4 years ago

I don't know exactly what you mean with research the tray icon name. If there is a way to check it, tell me, I'm happy to help. A workaround I'm using right now:

The problem is related to default electron icon (electron.svg): Screenshot from 2020-02-04 00-37-45

I don't need it right now, so removing it does the trick: $ sudo mv /usr/share/icons/Numix-Circle/48/apps/electron.svg /usr/share/icons/Numix-Circle/48/apps/electron.svg_backup $ sudo update-icon-caches /usr/share/icons/*

Screenshot from 2020-02-04 00-39-19

palob commented 4 years ago

Well, if it just uses electron as icon name we probably can't fix it without further ado. You'll probably need a fixing script, I don't know if there's a way to have it pick up a tray icon with electronmail-tray for instance. But then again I haven't got the slightest notion of how tray icon theming is done. Personally I try to get rid of tray icons as much as possible.

maxtron95 commented 4 years ago

The Papirus icon theme has a tray icon for this program. The tray icon for ElectronMail is hardcoded.

The tray icon was discussed in hardcode-tray here: https://github.com/bilelmoussaoui/Hardcode-Tray/issues/577

Jvlsc commented 4 years ago

The Papirus icon theme has a tray icon for this program. The tray icon for ElectronMail is hardcoded.

The tray icon was discussed in hardcode-tray here: bilelmoussaoui/Hardcode-Tray#577

Yes, I noticed this one yesterday. I tested Papirus icon theme and it's the same behaiviour, it needs a fixing script. About ElectronMail tray icon is hardcoded, I think that's how electron works. I'm not an expert, but if I'm not wrong, tray icon is created inside the BrowserWindow in running time and it forces you to specify a path for the icon.

Well, if it just uses electron as icon name we probably can't fix it without further ado. You'll probably need a fixing script, I don't know if there's a way to have it pick up a tray icon with electronmail-tray for instance. But then again I haven't got the slightest notion of how tray icon theming is done. Personally I try to get rid of tray icons as much as possible.

Excuse me for the late reply. I agree with you, I also try to avoid tray icons with Gnome (due to lack of official support), but in this machine I need Megasync app which expects tray support. The alternative is to keep the window opened and It's really annoying (a personal OCD haha).

If you can add at least a desktop icon for this app, I would be really grateful (if you add also tray icons, I don't mind applying a fixing script either). I love numix icon theme (circle version) and I'm using it for a long time, so thanks for the work.

Kind regards.

vladimiry commented 4 years ago

About ElectronMail tray icon is hardcoded, I think that's how electron works. I'm not an expert, but if I'm not wrong, tray icon is created inside the BrowserWindow in running time and it forces you to specify a path for the icon.

The icon is a static file packed into asar archive with the following path /opt/ElectronMail/resources/app.asar/app/assets/icons/icon.png (I guess base app path /opt/ElectronMail/ might differ depending on the system). The app loads that icon and caches it into memory for further processing. Then when needed the app programmatically renders an unread counter on top of the base icon. The app also supports configuring the colors of the tray icon and unread counter (background and font colors separately). Such configuring is possible since the app generates the icon programmatically based on the static image file. Think like the app replaces colors on the fly preserving the original icon shaping.

On Arch Linux system the desktop file location is /usr/share/applications/electron-mail.desktop and here is its content:

[Desktop Entry]
Name=ElectronMail
Exec=/opt/ElectronMail/electron-mail %U
Terminal=false
Type=Application
Icon=electron-mail
StartupWMClass=ElectronMail
Comment=Unofficial ProtonMail Desktop App
Categories=Office;

By the way, icon sources located in https://github.com/vladimiry/ElectronMail/tree/master/src/assets/icon.