bilelmoussaoui / Hardcode-Tray

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

Hardcoded icons remain despite script running successfully #709

Closed acarasimon96 closed 2 years ago

acarasimon96 commented 2 years ago

After I ran a system update, all hardcoded icons that were previously overridden reverted back to their originals as if it was done automatically. The hardcoded icons remained the same no matter how many times I ran the script. The last system update did not upgrade all of the apps that the script found, which are listed below.

I tried all SVG converters available on my system (RSVGConvert, Inkscape, CairoSVG, SVGExport) and different sizes, but the hardcoded icons are still not being replaced.

With some investigation, I found out that Hardcode-Tray isn't reading anything from the temp PNG file. The part of the script in question is line 92 in HardcodeTray/modules/svg/svg.py. However, the generated temp PNG files are perfectly readable outside Hardcode-Tray (for example, cat /tmp/tmpxxxxxxxx).

Specifications

Debug log

Edit: Added my Linux kernel version, since this bug deals with temporary files and /tmp.

varlesh commented 2 years ago

recommend use RSVGConvert. Try remove backup icons and start script again: sudo rm -rf ~/.config/Hardcode-Tray/*

acarasimon96 commented 2 years ago

That's what I did every single time before I ran sudo -E hardcode-tray --apply again. When I do run sudo -E hardcode-tray --clear-cache, everything in that directory is already removed not including itself.

varlesh commented 2 years ago

hangouts not support now, because does not pass the test On Chrome/Chromium... Also all other chrome-based distros need update. Discord 0.15 not fixed too?

varlesh commented 2 years ago

hangouts removed and chrome/chromium updated

acarasimon96 commented 2 years ago

Discord 0.15 not fixed too?

Discord has been on 0.15 for a while. Until now, replacing its hardcoded tray icons always worked, and those icons remain even after in-app updates are applied. I swear that this has nothing to do with the database, since Hardcode Tray still backs up the originals properly.

varlesh commented 2 years ago

it's impossible, discord have hardcoded path with release number for icons: {userhome}/.config/discord/0.0.15/modules/discord_desktop_core/ chrome/chromium & vivaldi updated. See previous commits

varlesh commented 2 years ago

I can't reproduce this. With latest commits: before Screenshot_20210918_111157 after Screenshot_20210918_111243

acarasimon96 commented 2 years ago

Does your debug logs still say "Couldn't find PNG file"? I think that's a sign that the script failed to copy the PNG data into the target apps.

varlesh commented 2 years ago

yes 2021-09-18 11:19:30.log

varlesh commented 2 years ago

Couldn't find a PNG file - it's previous icon files for previous versions Chrome.

    "icons": {
        "tray-NOT-USED-NOW": {
            "original": "8003",
            "theme": "google-chrome-tray"
        },
        "tray-56-NOT-USED-NOW": {
            "original": "10153",
            "theme": "google-chrome-tray"
        },
        "tray-60-dev-NOT-USED-NOW": {
            "original": "10154",
            "theme": "google-chrome-tray"
        },
        "tray-64-NOT-USED-NOW": {
            "original": "10156",
            "theme": "google-chrome-tray"
        },
        "tray-68-NOT-USED-NOW": {
            "original": "10158",
            "theme": "google-chrome-tray"
        },
        "tray-77-NOT-USED-NOW": {
            "original": "10151",
            "theme": "google-chrome-tray"
        },
        "tray-80-NOT-USED-NOW": {
            "original": "9151",
            "theme": "google-chrome-tray"
        },
        "tray-93-NOW-USED": {
            "original": "11151",
            "theme": "google-chrome-tray"
        }
varlesh commented 2 years ago

Screenshot_20210918_112939

acarasimon96 commented 2 years ago

Sorry for causing you confusion, but I was able to write a fix for this strange behavior. With that applied, the script replaces icons properly like it should.

This is caused by the temp file object (that is, temppng in SVG.to_bin) not picking up changes after the PNG conversion. Closing and reopening the file in code allowed Hardcode Tray to read the contents of the temp PNG. I have submitted a pull request that includes this fix, and I might possibly add in the future an exception when the script reads nothing out of the temp file.