Closed rauldipeas closed 2 years ago
This needs an update, i'm trying to do it here, but no lucky...
{
"name": "Mattermost",
"app_path": [
"/opt/Mattermost/",
"/usr/lib/mattermost/"
],
"icons_path": [
"/opt/Mattermost/resources/",
"/usr/lib/mattermost/resources/"
],
"binary": "app.asar",
"script": "electron",
"icons": {
"tray-light": {
"original": "assets/linux/top_bar_light_16.png",
"theme": "mattermost-tray"
},
"tray-light-unread": {
"original": "assets/linux/top_bar_unread_light_16.png",
"theme": "mattermost-unread"
},
"tray-light-mention": {
"original": "assets/linux/top_bar_mention_light_16.png",
"theme": "mattermost-mention"
},
"tray-light@2x": {
"original": "assets/linux/top_bar_light_16@2x.png",
"theme": "mattermost-tray"
},
"tray-light@2x-unread": {
"original": "assets/linux/top_bar_unread_light_16@2x.png",
"theme": "mattermost-unread"
},
"tray-light@2x-mention": {
"original": "assets/linux/top_bar_mention_light_16@2x.png",
"theme": "mattermost-mention"
},
"tray-dark": {
"original": "assets/linux/top_bar_dark_16.png",
"theme": "mattermost-tray"
},
"tray-dark-unread": {
"original": "assets/linux/top_bar_unread_dark_16.png",
"theme": "mattermost-unread"
},
"tray-dark-mention": {
"original": "assets/linux/top_bar_mention_dark_16.png",
"theme": "mattermost-mention"
},
"tray-dark@2x": {
"original": "assets/linux/top_bar_dark_16@2x.png",
"theme": "mattermost-tray"
},
"tray-dark@2x-unread": {
"original": "assets/linux/top_bar_unread_dark_16@2x.png",
"theme": "mattermost-unread"
},
"tray-dark@2x-mention": {
"original": "assets/linux/top_bar_mention_dark_16@2x.png",
"theme": "mattermost-mention"
}
}
}
rauldipeas@IdeaPad-320 ~ sudo hardcode-tray --apply --only mattermost.electron
Welcome to Hardcode-Tray!
Hardcode-Tray replaces some icons on the binary files of some applications.
Please close all the running applications before running Hardcode-Tray script.
Desktop Environment: Other
Scaling Factor: 1
Icon Size: 24
Icon Theme: Luv
Conversion Tool: RSVGConvert
To Do: Mattermost.Electron
Applying now..
Traceback (most recent call last):
File "/usr/bin/hardcode-tray", line 121, in <module>
App.execute()
File "/usr/lib/python3.7/site-packages/HardcodeTray/app.py", line 120, in execute
delta = app.do_action(action)
File "/usr/lib/python3.7/site-packages/HardcodeTray/modules/applications/application.py", line 148, in do_action
self.install()
File "/usr/lib/python3.7/site-packages/HardcodeTray/decorators.py", line 58, in wrapper
func(app)
File "/usr/lib/python3.7/site-packages/HardcodeTray/modules/applications/application.py", line 96, in install
self.execute(Action.APPLY)
File "/usr/lib/python3.7/site-packages/HardcodeTray/modules/applications/helpers/binary.py", line 50, in execute
self.install_icon(icon, icon_path)
File "/usr/lib/python3.7/site-packages/HardcodeTray/modules/applications/electron.py", line 41, in install_icon
self.set_icon(icon, icon_path, png_bytes, True)
File "/usr/lib/python3.7/site-packages/HardcodeTray/modules/applications/electron.py", line 66, in set_icon
asar.write(icon_to_replace, png_bytes)
File "/usr/lib/python3.7/site-packages/HardcodeTray/modules/applications/helpers/asar.py", line 106, in write
new_files = change_dict_vals(self._header, sizediff, offset0)
File "/usr/lib/python3.7/site-packages/HardcodeTray/utils.py", line 244, in change_dict_vals
d2 = {k: change_dict_vals(v, sizediff, offset) for k, v in d.items()}
File "/usr/lib/python3.7/site-packages/HardcodeTray/utils.py", line 244, in <dictcomp>
d2 = {k: change_dict_vals(v, sizediff, offset) for k, v in d.items()}
File "/usr/lib/python3.7/site-packages/HardcodeTray/utils.py", line 244, in change_dict_vals
d2 = {k: change_dict_vals(v, sizediff, offset) for k, v in d.items()}
File "/usr/lib/python3.7/site-packages/HardcodeTray/utils.py", line 244, in <dictcomp>
d2 = {k: change_dict_vals(v, sizediff, offset) for k, v in d.items()}
File "/usr/lib/python3.7/site-packages/HardcodeTray/utils.py", line 244, in change_dict_vals
d2 = {k: change_dict_vals(v, sizediff, offset) for k, v in d.items()}
File "/usr/lib/python3.7/site-packages/HardcodeTray/utils.py", line 244, in <dictcomp>
d2 = {k: change_dict_vals(v, sizediff, offset) for k, v in d.items()}
File "/usr/lib/python3.7/site-packages/HardcodeTray/utils.py", line 244, in change_dict_vals
d2 = {k: change_dict_vals(v, sizediff, offset) for k, v in d.items()}
File "/usr/lib/python3.7/site-packages/HardcodeTray/utils.py", line 244, in <dictcomp>
d2 = {k: change_dict_vals(v, sizediff, offset) for k, v in d.items()}
File "/usr/lib/python3.7/site-packages/HardcodeTray/utils.py", line 244, in change_dict_vals
d2 = {k: change_dict_vals(v, sizediff, offset) for k, v in d.items()}
File "/usr/lib/python3.7/site-packages/HardcodeTray/utils.py", line 244, in <dictcomp>
d2 = {k: change_dict_vals(v, sizediff, offset) for k, v in d.items()}
File "/usr/lib/python3.7/site-packages/HardcodeTray/utils.py", line 244, in change_dict_vals
d2 = {k: change_dict_vals(v, sizediff, offset) for k, v in d.items()}
File "/usr/lib/python3.7/site-packages/HardcodeTray/utils.py", line 244, in <dictcomp>
d2 = {k: change_dict_vals(v, sizediff, offset) for k, v in d.items()}
File "/usr/lib/python3.7/site-packages/HardcodeTray/utils.py", line 244, in change_dict_vals
d2 = {k: change_dict_vals(v, sizediff, offset) for k, v in d.items()}
File "/usr/lib/python3.7/site-packages/HardcodeTray/utils.py", line 244, in <dictcomp>
d2 = {k: change_dict_vals(v, sizediff, offset) for k, v in d.items()}
File "/usr/lib/python3.7/site-packages/HardcodeTray/utils.py", line 244, in change_dict_vals
d2 = {k: change_dict_vals(v, sizediff, offset) for k, v in d.items()}
File "/usr/lib/python3.7/site-packages/HardcodeTray/utils.py", line 244, in <dictcomp>
d2 = {k: change_dict_vals(v, sizediff, offset) for k, v in d.items()}
File "/usr/lib/python3.7/site-packages/HardcodeTray/utils.py", line 244, in change_dict_vals
d2 = {k: change_dict_vals(v, sizediff, offset) for k, v in d.items()}
File "/usr/lib/python3.7/site-packages/HardcodeTray/utils.py", line 244, in <dictcomp>
d2 = {k: change_dict_vals(v, sizediff, offset) for k, v in d.items()}
File "/usr/lib/python3.7/site-packages/HardcodeTray/utils.py", line 245, in change_dict_vals
if d2.get('offset') and int(d2.get('offset')) > offset:
TypeError: int() argument must be a string, a bytes-like object or a number, not 'dict'
Current release 4.7.2 and i'm not seen your icons on this location:
assets:
ough, it's 5.0.0 RC
I'm on version 5.0.0-rc1-13336.
similar bug #646
downgrade to 4.7.2 i don't know how solve this
I'm fixed Gitify manually, with a script that replace files.
and #637 to
I'm fixing Gitify like this...
npx asar e /opt/Gitify/resources/app.asar app
rsvg-convert /usr/share/icons/Papirus/24x24/panel/gitify-tray-active.svg -o app/assets/images/tray-active.png
rsvg-convert /usr/share/icons/Papirus/24x24@2x/panel/gitify-tray-active.svg -w 48 -o app/assets/images/tray-active@2x.png
rsvg-convert /usr/share/icons/Papirus/24x24/panel/gitify-tray.svg -o app/assets/images/tray-idleTemplate.png
rsvg-convert /usr/share/icons/Papirus/24x24@2x/panel/gitify-tray.svg -w 48 -o app/assets/images/tray-idleTemplate@2x.png
npx asar p app app.asar
sudo cp -rfv app.asar /opt/Gitify/resources/app.asar
@acarasimon96 Timothy you know python, maybe you can help solve this error?
I think asar module don't get header bytes for right work on some electron-apps.
TypeError: int() argument must be a string, a bytes-like object or a number, not 'dict'
For test you can use this app. Extract archives and found resources/app.asar file. This worked: https://releases.mattermost.com/desktop/4.7.2/mattermost-desktop-4.7.2-linux-x64.tar.gz This not worked: https://releases.mattermost.com/desktop/5.0.0-rc1/mattermost-desktop-5.0.0-rc1-linux-x64.tar.gz
I just successfully ran Hardcode Tray Git version on Mattermost desktop 5.0.0-rc1, but I'm not getting a TypeError
on my end. I'm not getting any useful hints either in the debug logs.
It appears that the tray icons in app.asar
matches those shown in this comment by the issue creator. If Hardcode Tray really did replace the icons as expected, the icons between light and dark variants in that same directory would be identical.
For comparison, here are the icons from Papirus that the script should've used to replace the above:
I don't think this looks like an easy fix for me, but it's possible to get it done. This will take a couple days for me to find out the cause and implement a fix since I also have school, chores at home, and other interests to deal with. I apologize for any inconvenience that may arise out of my life situation.
Also, thank you for the unexpected ping, @varlesh. I'm thrilled to be able to help you out with this issue!
Edit: I forgot to upload the debug logfile, so here you go: 2021-09-21 19:36:04.log
I'm temporarily using this solution to fix tray icons on my apt
repository.
https://gitlab.com/myawesomedistro/madrepo/-/blob/main/scripts/mkpkg/mattermost.sh
@acarasimon96 Thanks for your efforts... it's only your desire, I do not insist
I just successfully ran Hardcode Tray Git version on Mattermost desktop 5.0.0-rc1, but I'm not getting a TypeError on my end. I'm not getting any useful hints either in the debug logs
for 5.0.0 RC need use this config
Oh, I didn't realize to do that first. Now I'm getting the same exact error @rauldipeas got.
I was able to fix the crash, and it was a bit easier than I thought. It was caused by a directory that is literally called "offset" inside app.asar. I changed the code to where it makes sure that the value for "offset" is a string (that is, the real offset value of a file) before recalculating it. However, for some weird reason, I still couldn't get the script to replace the mention and unread icons. I would consider this issue solved once that new bug gets fixed and no other side effects come out of that.
@acarasimon96 glad to hear about success On logs backup only 16px and 16@2x icons:
[DEBUG] 2021-09-23 06:22:43 Create new backup folder for Mattermost
[DEBUG] 2021-09-23 06:22:43 Creating directory: /home/alex/.config/Hardcode-Tray/Mattermost/2021-09-23 06:22:43/
[DEBUG] 2021-09-23 06:22:43 Executing command: rsvg-convert -f png -o /tmp/tmp9jdsnztd -w 22 -h 22 /usr/share/icons/Papirus-Dark/22x22/panel/mattermost-tray.svg
[DEBUG] 2021-09-23 06:22:44 Backup file: /tmp/files|assets|files|linux|files|top_bar_light_16.png to: /home/alex/.config/Hardcode-Tray/Mattermost/2021-09-23 06:22:43/files|assets|files|linux|files|top_bar_light_16.png
[DEBUG] 2021-09-23 06:22:44 Executing command: rsvg-convert -f png -o /tmp/tmpx9blhr3j -w 22 -h 22 /usr/share/icons/Papirus-Dark/22x22/panel/mattermost-unread.svg
[DEBUG] 2021-09-23 06:22:44 Executing command: rsvg-convert -f png -o /tmp/tmpylubzicr -w 22 -h 22 /usr/share/icons/Papirus-Dark/22x22/panel/mattermost-mention.svg
[DEBUG] 2021-09-23 06:22:44 Executing command: rsvg-convert -f png -o /tmp/tmp3pcydgli -w 22 -h 22 /usr/share/icons/Papirus-Dark/22x22/panel/mattermost-tray.svg
[DEBUG] 2021-09-23 06:22:44 Backup file: /tmp/files|assets|files|linux|files|top_bar_light_16@2x.png to: /home/alex/.config/Hardcode-Tray/Mattermost/2021-09-23 06:22:43/files|assets|files|linux|files|top_bar_light_16@2x.png
[DEBUG] 2021-09-23 06:22:44 Executing command: rsvg-convert -f png -o /tmp/tmphyomnemk -w 22 -h 22 /usr/share/icons/Papirus-Dark/22x22/panel/mattermost-unread.svg
[DEBUG] 2021-09-23 06:22:44 Executing command: rsvg-convert -f png -o /tmp/tmpdc8i4nab -w 22 -h 22 /usr/share/icons/Papirus-Dark/22x22/panel/mattermost-mention.svg
[DEBUG] 2021-09-23 06:22:44 Executing command: rsvg-convert -f png -o /tmp/tmpaq7hwufl -w 22 -h 22 /usr/share/icons/Papirus-Dark/22x22/panel/mattermost-tray.svg
[DEBUG] 2021-09-23 06:22:44 Backup file: /tmp/files|assets|files|linux|files|top_bar_dark_16.png to: /home/alex/.config/Hardcode-Tray/Mattermost/2021-09-23 06:22:43/files|assets|files|linux|files|top_bar_dark_16.png
[DEBUG] 2021-09-23 06:22:44 Executing command: rsvg-convert -f png -o /tmp/tmp3wgx1tc2 -w 22 -h 22 /usr/share/icons/Papirus-Dark/22x22/panel/mattermost-unread.svg
[DEBUG] 2021-09-23 06:22:44 Executing command: rsvg-convert -f png -o /tmp/tmp_i3kucko -w 22 -h 22 /usr/share/icons/Papirus-Dark/22x22/panel/mattermost-mention.svg
[DEBUG] 2021-09-23 06:22:44 Executing command: rsvg-convert -f png -o /tmp/tmpxeukqnhp -w 22 -h 22 /usr/share/icons/Papirus-Dark/22x22/panel/mattermost-tray.svg
[DEBUG] 2021-09-23 06:22:44 Backup file: /tmp/files|assets|files|linux|files|top_bar_dark_16@2x.png to: /home/alex/.config/Hardcode-Tray/Mattermost/2021-09-23 06:22:43/files|assets|files|linux|files|top_bar_dark_16@2x.png
[DEBUG] 2021-09-23 06:22:44 Executing command: rsvg-convert -f png -o /tmp/tmpwmyv1ufh -w 22 -h 22 /usr/share/icons/Papirus-Dark/22x22/panel/mattermost-unread.svg
[DEBUG] 2021-09-23 06:22:44 Executing command: rsvg-convert -f png -o /tmp/tmptszjzw7e -w 22 -h 22 /usr/share/icons/Papirus-Dark/22x22/panel/mattermost-mention.svg
Other files not backuped
I still couldn't get the script to replace the mention and unread icons. I would consider this issue solved once that new bug gets fixed and no other side effects come out of that.
On logs backup only 16px and 16@2x icons
It turns out that a few typos in [this comment with the modified mattermost.electron.json
]() is what prevented the unread and mentioned tray icons from being replaced or backed up. I moved mention
and unread
after light
or dark
in the JSON, depending on the target filename, and it worked!
And below is the final result with the icons properly replaced
P.S. @rauldipeas, please remember to submit a new PR containing the new JSON file.
also i'm extract patched asar and selected files - it's Papirus files 100 %
@acarasimon96 Congratulations, you are cool!!! :1st_place_medal: I can merge PR?
Sure, go ahead, but make sure you test the PR first on your system before merging. I'm glad I was able to help out. 😊
@acarasimon96 Big thx!!! I'm also test it with other problem apps Franz #637 & Gitify #646 and merged
P.S. @rauldipeas, please remember to submit a new PR containing the new JSON file.
I'm doing this
Thank you so much @acarasimon96 and @varlesh, this fix help-me so much!
Franz & Gitify fixed too!
I'm on Mattermost 5.0.4, and hardcode-tray doesn't detect it. Does it work for others?
@rauldipeas Interesting... I do have app.asar
in /usr/lib
(same as this) but I don't know why it's not detecting.
It is detecting my apps just fine