bilelmoussaoui / Hardcode-Tray

Fixes Hardcoded tray icons in Linux
Other
863 stars 63 forks source link

Icons for applications located in /opt #619

Closed BlueManCZ closed 4 years ago

BlueManCZ commented 4 years ago

Specifications

Expected behavior and actual behavior

I'm trying to find default icons in mailspring directory according to this database file, but all I get is mailspring/resources/ directory:

tree resources -L 1

resources ├── app.asar ├── app.asar.unpacked └── electron.asar

There is nothing like internal_packages/system-tray/assets/linux/ in there.

I'm trying to run this command: sudo -E hardcode-tray --conversion-tool RSVGConvert --size 22 --theme Papirus --only mailspring --path /opt/mailspring-bin-1.7.2/resources

But it returns: No apps to fix!

Am I doing something wrong, or is Mailspring support currently broken?

varlesh commented 4 years ago

There is nothing like internal_packages/system-tray/assets/linux/ in there.

This path packed on app.asar: /opt/mailspring-bin-1.7.2/resources/app.asar/internal_packages/system-tray/assets/linux/

I think it's not worked, because script can not support --path with packed asar module. Temporary solution - create symlink: sudo ln -s /opt/mailspring-bin-1.7.2 /usr/share/mailspring and fix icon: sudo -E hardcode-tray --conversion-tool RSVGConvert --size 22 --theme Papirus --only mailspring

But it's not good way, because after update to next release symlink will be broken.

varlesh commented 4 years ago

after every update need fix icon, but in your case, you need remap symlink too: sudo ln -s /opt/mailspring-bin-1.7.3 /usr/share/mailspring sudo ln -s /opt/mailspring-bin-1.7.4 /usr/share/mailspring and etc... I think better solution for that write ebuild maintainer for remove release number from path

BlueManCZ commented 4 years ago

Thank you! Symlink did the trick. And I know that with ebuild it would be easier, but I haven't explored the creation of ebuilds much, maybe in the future.

BlueManCZ commented 4 years ago

But for example, I have Slack installed from official repository, and its default location is:

> ls /usr/bin/slack -l lrwxrwxrwx 1 root root 21 22. říj 14.27 /usr/bin/slack -> ../../opt/slack/slack

also /opt folder. So I guess, wouldn't be better implement something like $PATH environmental variable princip, which could contain multiple directories like: /usr/share:/opt and so on, and instead of putting absolute paths into json database files, use only relative and look for them in specified directories?

BlueManCZ commented 4 years ago

And when I mentioned Slack, in slack.json there is path slack/resources/app.asar.unpacked/static/ and in there icons as .png files. But in my system I found only slack/resources/app.asar.unpacked/dist/static and icons as .ico files.

Or does Slack still use base64 icons?

Snímek z 2020-02-25 11-23-14

varlesh commented 4 years ago

also /opt folder. So I guess, wouldn't be better implement something like $PATH environmental variable princip, which could contain multiple directories like: /usr/share:/opt and so on, and instead of putting absolute paths into json database files, use only relative and look for them in specified directories?

Usualy we set path from AUR & DEB packages. If ebuild maintainer change path for mailspring, we can add this path to database. For example:

"app_path": [
        "/usr/share/mailspring/",
        "/opt/mailspring-bin"
    ],
    "icons_path": [
        "/usr/share/mailspring/resources/",
        "/opt/mailspring-bin/resources/"
    ],

Or does Slack still use base64 icons?

Yes, Slack use Base64 icons and hardcode-tray not support that now.

PS: I'm not developer on this repo and don't know python ((

JoeJoeTV commented 4 years ago

Hello, i also have installed some applications in /opt, like Telegram, because there is only a .tar.gz version, so I made a new folder in /opt and put it there. Also whatsapp-desktop application is installed from the repository/software manager. Both of these still have their normal colored icons, but the whatsapp-desktop one is the one from my theme, but not the white tray version.

Specs:

EDIT: Telegram now shows the right tray icon after unning hardcode-tray multiple times and doing an app update

BlueManCZ commented 4 years ago

@JoeJoeTV Please check this file and make sure that a path where you placed your Whatsapp matches one of the mentioned in the file. It's case-sensitive.

JoeJoeTV commented 4 years ago

@BlueManCZ I installed whatsapp from then repository, so it installed itself in /opt/whatsapp-desktop/ and there are the right icons in /opt/whatsapp-desktop/resources/app/assets/icon, but hardcode-tray doesn't use those? image

Also, is there no support for telegram, because there is no file in the same folder as the whatsapp.json file you linked?

EDIT: When I run hardcode-tray, it shows me that it did process whatsapp-desktop.

BlueManCZ commented 4 years ago

@JoeJoeTV Well, this is probably not a problem of hardcode-tray, because icons are replaced correctly, but the problem of WhatsApp, that it doesn't use those icons. I don't know about Telegram, but maybe it has the same problem, so it's no longer supported.

JoeJoeTV commented 4 years ago

I looked over the code for a bit and saw, that whatsapp-desktop should be using the icons in the assets/icons directory, but somehow doesn't? I also tried reverting hardcode-tray, but there were only snapshots from today?

BlueManCZ commented 4 years ago

I'm afraid I can't help you. I'm out of ideas, I've never been even using Whatsapp. You can create a new issue if nobody response here.

varlesh commented 4 years ago

Telegram already use system icons for tray with environment options on ~/.profile KDE: export TDESKTOP_DISABLE_TRAY_COUNTER=1 Gnome:

export TDESKTOP_FORCE_PANEL_ICON=1
export TDESKTOP_DISABLE_TRAY_COUNTER=1

more info here

About Whatsapp Desktop - version 0.6.1 from Mint repo - worked image

JoeJoeTV commented 4 years ago

@varlesh I'm gonna try the env variables, although, telegram started doing it by itself after the last update. I'm on Mint 19.3 Cinnamon, so I already have v0.6.1 from the mint repo. Is there a way to revert the changes from hardcode-tray, because the command line option doesn't work and only allows me to reset to today morning. Can I reset the icons manually, does hardcode-tray change the theme files?

varlesh commented 4 years ago

reinstall package

BlueManCZ commented 4 years ago

@varlesh I tested that environmental variables, but It seems to have no effect at all in my Telegram 2.1.1. Strange.

varlesh commented 4 years ago

@BlueManCZ you reboot PC?

BlueManCZ commented 4 years ago

@varlesh Why would I do that? With environmental variables this should be enough:

killall telegram-desktop
export TDESKTOP_FORCE_PANEL_ICON=1
export TDESKTOP_DISABLE_TRAY_COUNTER=1
telegram-desktop

But it seems it isn't. Snímek z 2020-05-06 13-57-27

varlesh commented 4 years ago

Yes, if you start this as script

varlesh commented 4 years ago

image

varlesh commented 4 years ago

@BlueManCZ On your screenshot not Papirus icon theme

BlueManCZ commented 4 years ago

@varlesh You are right, that was it. No Papirus icon theme.

Snímek z 2020-05-06 14-22-54

nicolasmaia commented 4 years ago

Yes, if you start this as script

How?

BlueManCZ commented 4 years ago

@nicolasmaia He means you don't need to restart, if you run mentioned commands together.

varlesh commented 4 years ago
echo "export TDESKTOP_FORCE_PANEL_ICON=1" >> ~/.profile
echo "export TDESKTOP_DISABLE_TRAY_COUNTER=1" >> ~/.profile
reboot
nicolasmaia commented 4 years ago
echo "export TDESKTOP_FORCE_PANEL_ICON=1" >> ~/.profile
echo "export TDESKTOP_DISABLE_TRAY_COUNTER=1" >> ~/.profile
reboot

Thanks. I just tried this, to no avail.

varlesh commented 4 years ago

@nicolasmaia It's worked if this icons for tray available on current icon theme:

telegram-attention-panel
telegram-mute-panel
telegram-panel
varlesh commented 4 years ago

@nicolasmaia What you use DE & Icon Theme?

varlesh commented 4 years ago

Also i don't know how this worked with snap & flatpak. It's tested with only Telegram binary version from githab releases

nicolasmaia commented 4 years ago

Gnome Shell 3.30.2, Icon theme is ZorinBlue-Light.

BlueManCZ commented 4 years ago

@nicolasmaia Yea, that's the problem. I guess Zorin theme doesn't have Telegrams tray icons. Switch to Papirus icon theme and try it again. I also created this question to see, if there are any possibilities to force Telegram to use specific icon pack. Another way would be to create symlinks to Papirus icons in your selected icon theme.

BlueManCZ commented 4 years ago

Solution with symlinks did the trick for me.

nicolasmaia commented 4 years ago

Can you share how you did it with symlinks?

BlueManCZ commented 4 years ago

You need to have a Papirus theme installed. I will demonstrate it with Numix-Circle theme, but you should adapt it for yours.

# enter a folder of your icon theme
cd /usr/share/icons/Numix-Circle/16/panel

# and create three symlinks
sudo ln -s /usr/share/icons/Papirus/16x16/panel/telegram-attention-panel.svg telegram-attention-panel.svg
sudo ln -s /usr/share/icons/Papirus/16x16/panel/telegram-mute-panel.svg telegram-mute-panel.svg 
sudo ln -s /usr/share/icons/Papirus/16x16/panel/telegram-panel.svg telegram-panel.svg

That's all what I did.

mateushonorato commented 3 years ago
echo "export TDESKTOP_FORCE_PANEL_ICON=1" >> ~/.profile
echo "export TDESKTOP_DISABLE_TRAY_COUNTER=1" >> ~/.profile
reboot

this was working fine but on latest updates telegram seems to have changed something and now it doesn't work anymore

varlesh commented 3 years ago

This env droped. More info here: https://github.com/telegramdesktop/tdesktop/pull/9056