[SOLVED] Program Icon is changing back to default after each update.

Questions about applications and software
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
Cobra99
Level 1
Level 1
Posts: 36
Joined: Thu Jan 05, 2023 10:51 am

[SOLVED] Program Icon is changing back to default after each update.

Post by Cobra99 »

Hello,
I changed the icon for Brave browser, but it is always forced back to default or to generic file icon after brave get new update.
I did change the icon by opening /usr/share/applications folder as a root. This is the setup inside that .desktop file

Code: Select all

[Desktop Entry]
Version=1.0
Name=Brave Web Browser
# Only KDE 4 seems to use GenericName, so we reuse the KDE strings.
# From Ubuntu's language-pack-kde-XX-base packages, version 9.04-20090413.
GenericName=Web Browser
# Not translated in KDE, from Epiphany 2.26.1-0ubuntu1.
# Gnome and KDE 3 uses Comment.
Comment=Access the Internet
Exec=/usr/bin/brave-browser-stable %U
StartupNotify=true
Terminal=false
Icon=/home/cobra/Downloads/Inštalačky/brave-release.svg
Type=Application
Categories=Network;WebBrowser;
MimeType=application/pdf;application/rdf+xml;application/rss+xml;application/xhtml+xml;application/xhtml_xml;application/xml;image/gif;image/jpeg;image/png;image/webp;text/html;text/xml;x-scheme-handler/http;x-scheme-handler/https;x-scheme-handler/ipfs;x-scheme-handler/ipns;
Actions=new-window;new-private-window;

[Desktop Action new-window]
Name=New Window
Exec=/usr/bin/brave-browser-stable

[Desktop Action new-private-window]
Name=New Incognito Window
Exec=/usr/bin/brave-browser-stable --incognito
So far it did change back to default 3 or 4 times; as flatpak app or now installed from brave.com source.

Any ideas? Thanks
I use Mint-Y-Dark icon theme and Mint-Y-Dark-Orange desktop theme, System:
Kernel: 5.15.0-58-generic x86_64 bits: 64 compiler: gcc v: 11.3.0 Desktop: Cinnamon 5.6.7
tk: GTK 3.24.33 wm: muffin dm: LightDM Distro: Linux Mint 21.1 Vera base: Ubuntu 22.04 jammy
Last edited by LockBot on Sat Aug 05, 2023 10:00 pm, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Wakatakakage
Level 3
Level 3
Posts: 154
Joined: Wed Apr 21, 2021 10:34 pm

Re: Program Icon is changing back to default after each update.

Post by Wakatakakage »

The files in system directories such as /usr/share/applications are part of software packages, and as you have observed, they may be replaced any time the software package is updated. If you want to modify a .desktop file, you should copy the file to your own directory space in ~/.local/share/applications (you may need to create the directory), and then modify that copy. Your local version of the .desktop file will take precedence over the version in /usr/share/applications, and your copy will not be touched by updates to the software package.
Cobra99
Level 1
Level 1
Posts: 36
Joined: Thu Jan 05, 2023 10:51 am

Re: Program Icon is changing back to default after each update.

Post by Cobra99 »

Wakatakakage wrote: Sun Feb 05, 2023 3:28 pm The files in system directories such as /usr/share/applications are part of software packages, and as you have observed, they may be replaced any time the software package is updated. If you want to modify a .desktop file, you should copy the file to your own directory space in ~/.local/share/applications (you may need to create the directory), and then modify that copy. Your local version of the .desktop file will take precedence over the version in /usr/share/applications, and your copy will not be touched by updates to the software package.
Thanks. Will try that.
Is it safe to store the icon file (svg) in this local directory too?

Code: Select all

~/.local/share/icons
I have it now in Downloads, but would like to move it somewhere else.
Wakatakakage
Level 3
Level 3
Posts: 154
Joined: Wed Apr 21, 2021 10:34 pm

Re: Program Icon is changing back to default after each update.

Post by Wakatakakage »

Just so you know, I have only played around a little bit with these things, and claim no expertise. I have mainly relied on XDG specification documents: The explanation for the Icon entry in the .desktop file states that
If the name is an absolute path, the given file will be used. If the name is not an absolute path, the algorithm described in the Icon Theme Specification will be used to locate the icon.
So I think that the icon file can be placed anywhere as long as you specify its location with an absolute path.

It may be a little "tidier" if you place the icon file in ~/.local/share/icons, but you may want to follow the Icon Theme Specification. This means that the file would have to be placed in a directory structure such as ~/.local/share/icons/hicolor/512x512/apps/brave-release.svg. (It mimics the structure under /usr/share/icons/.) Then in your .desktop file, you would no longer need to specify the icon file's absolute path; you could just have Icon=brave-release. The system will follow the algorithm and know where to look for the file.
Cobra99
Level 1
Level 1
Posts: 36
Joined: Thu Jan 05, 2023 10:51 am

Re: Program Icon is changing back to default after each update.

Post by Cobra99 »

SOLUTION

So I copied brave-browser.desktop file to ~/.local/share/applications and icon .svg image to ~/.local/share/icons/Brave-browser/brave-release.svg and changed the path in desktop file and after todays update, icon stayed as wanted.
Locked

Return to “Software & Applications”