Icons for Linux .desktop files (menu items)

Discuss new features and functions
Posts: 32
Joined: 7 Aug 2018

MartinPC

BACKGROUND and DISCLAIMER: I am just starting to learn Linux and am running Linux Mint 19 Cinnamon x64 in a VirtualBox guest (on a Windows 7 x64 host) to get my feet wet. My post and questions may well prove to be "stupid."

I manually installed FreeFileSync 10.2 for Linux x64 in my Linux Mint 19 Cinnamon virtual machine, using the tarball provided at FreeFileSync.org and following the tutorial provided at TutorialForLinux, titled "How to Install FreeFileSync on Linux Mint 19." (The version of FreeFileSync in Linux Mint's repository is a Flatpak app. I've read that it's old and has issues. Besides, 10.2's new option to automatically cap the number of versioned backups is important to me.) The installation went fine.

I created Cinnamon menu items for FreeFileSync and RealTimeSync using Cinnamon's built-in menu editor. That went fine, too, except that the new menu items had generic icons instead of the green circular double arrow for FFS and the red circular double arrow for RTS.

When I attempted to assign custom icons to the new .desktop files, I discovered that icons for FreeFileSync had not been extracted when the program's tarball was decompresed, but were instead left (along with other program icons) in the program directory's unzipped Resources.zip file. I extracted suitable icons myself and put them in a new Icons subdirectory in FreeFileSync's program directory. Then I was able to select "custom" icons for my new menu items. (I ended up choosing FFS_tray_24x24.png and RTS_tray_24x24.png.)

I guess my question is: Why aren't suitable .desktop-file icons extracted as part of the original decompression process? Is this something that is typically left to a distro-specific installer? Leaving the icons zipped and hidden seems like a small but annoying additional obstacle to a satisfying manual install -- at least for Linux newbies like me.

Related but possibly even "stupider" question: Should SVG icons also be supplied?

By the way, I just noticed that 10.3 is available for download. I updated from 10.2 to 10.3 by extracting, copying, and pasting over the old program files. Everything seems to work fine, except that my jobs list in the left pane of FreeFileSync's GUI was gone. Hopefully, I'll be able to figure out how to preserve the jobs list before the next update.

Thanks in advance for any illuminating feedback, but if my questions are too dumb to waste time on, no worries! It took me a while to become moderately competent at Windows, and I'm sure it will take me at least as long to become moderately competent at Linux. I'll probably figure most of this stuff out eventually ... hopefully ... maybe? ;-)
User avatar
Site Admin
Posts: 7052
Joined: 9 Dec 2007

Zenju

The problem with .desktop files is that their "Exec" and "Icon" paths must be absolute, and are not known for a portable application.
But at least on systems like Ubuntu they're not needed: Just launch FreeFileSync, right-click on the icon as it appears on the Launcher and select "Lock to Launcher".

Everything seems to work fine, except that my jobs list in the left pane of FreeFileSync's GUI was gone. MartinPC, 07 Aug 2018, 19:52
This shouldn't happen. Are you able to reproduce this? Migration from 10.2 to 10.3 works fine in my tests.
Posts: 306
Joined: 7 Jan 2018

bgstack15

The issue of the icons used by .desktop files is usually left up to the distro. Upstream developers, like Zenju, can package their application however they wish. The details of .desktop files and icons and general OS integration are usually left up to the distros because they tend to have particular ways to do it. However, most desktop environments comply with the freedesktop.org (formerly XDG, or X Desktop Group) specifications.

XDG-compliant .desktop files do not need absolute paths to the icons. There is a spec published for how to resolve relative icon names.

My .desktop contents:
[Desktop Entry]
Version=1.0
Name=FreeFileSync
GenericName=File synchronization
Comment=File sync tool
Keywords=synchronization;
Exec=/usr/bin/FreeFileSync %f
Terminal=false
X-MultipleArgs=false
Type=Application
Icon=freefilesync
Categories=Utility;FileTools;
StartupNotify=true
X-Desktop-File-Install-Version=0.23
And I've placed freefilesync icons in useful places:
$ find /usr/share/icons -iregex '.*freefilesync.*'
/usr/share/icons/HighContrast/scalable/apps/freefilesync.svg
/usr/share/icons/Numix-Circle/48/apps/freefilesync.svg
/usr/share/icons/hicolor/128x128/apps/freefilesync.png
/usr/share/icons/hicolor/64x64/apps/freefilesync.png
/usr/share/icons/hicolor/scalable/apps/freefilesync.svg
Posts: 32
Joined: 7 Aug 2018

MartinPC

Once again, my apologies for the long delay in getting back to you. I finally diagnosed and fixed my Internet connectivity problem, but irrespective of that, I don't seem to be getting notification emails when someone replies to a topic I've posted in. I've double-checked and reset my FFS forum notification settings and maybe that will fix the problem from here on out, but up till now, I've had to remember to remember to search for FFS forum postings I've participated in in my browser history, re-open the page, and look for new replies. Obviously, it's not the most reliable approach to maintaining an exchange...
Just launch FreeFileSync, right-click on the icon as it appears on the Launcher and select "Lock to Launcher".Zenju, 08 Aug 2018, 09:17
Cool tip. I'll have to try this in Linux Mint Cinnamon next time the problem comes up.
(A missing jobs list after upgrading) shouldn't happen. Are you able to reproduce this? Migration from 10.2 to 10.3 works fine in my tests.
I actually downgraded from 10.3 to 10.2 because of the logs folder issue and I haven't had occasion to try to reproduce the problem. I have only around 30 batch jobs on the machine in question, they're logically named and stored in logical locations, and having to manually re-open them in the GUI didn't take all that long.

Thanks again for a fabulous program, and special thanks again for introducing age and number caps for versioned backups in 10.2. The next big thing I'd hope for is some sort of delta-syncing/delta-copying capability in a future release. Syncing entire virtual-machine files (and then syncing their backups) can be brutally time-consuming on my older laptop with mechanical hard drives, and even if I had a newer system with SSDs, I imagine I wouldn't be too happy with the SSD degradation that comes with unnecessary writes. I can mitigate the problem to a degree by using VirtualBox snapshots, but even the snapshots can take a long time to copy.
Posts: 32
Joined: 7 Aug 2018

MartinPC

My .desktop contents: * * *
And I've placed freefilesync icons in useful places: * * * *bgstack15, 08 Aug 2018, 11:14
Thanks very much for this, bgstack15 -- I said I was stupid! (Well ... at least when it comes to Linux; for Windows, slightly less so.) The sample FFS .desktop file and icon locations will be useful references for me as I continue to learn more about Linux. I once read an introduction to the Filesystem Hierarchy Standard, but I'm afraid my brain overheated and shut down midway. I'm probably going to have to learn it the same way I learned Windows -- in small, digestible, ad hoc chunks.

BTW, see my last reply to zenju for an explanation of why it took me so long to reply. My apologies to you, as well, for the delay.

bimaloy30

Although packages that already ship with a .desktop file most certainly contain an icon or a set of icons, there is sometimes the case when a developer has not created a .desktop file, but may ship icons, nonetheless. So a good start is to look for icons in the source package. You can i.e. first filter for the extension with find and then use grep to filter further for certain buzzwords like the package name, "icon", "logo", etc, if there are quite a lot of images in the source package.
Posts: 32
Joined: 7 Aug 2018

MartinPC

Thanks, bimaloy30. This is *kind* of what I ended up doing, albeit by digging around manually rather than using find and grep. (I'm still at the Catfish-beginner level of expertise when it comes to searching.)

Incidentally, your reply triggered my very first FFS forums notification email, so that problem seems to be fixed. I've been using Linux Mint in a virtual machine for a while now, but I plan to do my first bare-metal install in the *very* near future and there's a good chance I'll have more FFS-in-Linux questions at some point. So -- good timing!

Thanks a lot for taking the time to help a newbie out!