1

PROBLEM

Hi, I'm trying to make a .desktop entry for jetbrains toolbox (a program), because for some reason, the desktop entry they included isn't showing the icon on my system (popOS 22.04, a Ubuntu fork).

Here are the file contents in ~/.local/share/applications/jetbrains-toolbox.desktop, and it's permissions are -rwxrw-r--.

I also know using apostrophes in file paths in generally bad. It's an old file path, I have references to it elsewhere, and I don't care to change it because it's working fine.

[Desktop Entry] Icon=/home/me/OS's and other progs/Jetbrains - PyCharm, etc/jetbrains-toolbox-2.8.0.51430/bin/toolbox.svg Exec=/home/me/OS's and other progs/Jetbrains - PyCharm, etc/jetbrains-toolbox-2.8.0.51430/bin/jetbrains-toolbox %u Version=1.0 Type=Application Categories=Development Name=JetBrains Toolbox StartupWMClass=jetbrains-toolbox Terminal=false MimeType=x-scheme-handler/jetbrains; X-GNOME-Autostart-enabled=true StartupNotify=false X-GNOME-Autostart-Delay=10 X-MATE-Autostart-Delay=10 X-KDE-autostart-after=panel 

WHAT I TRIED

The only way I can get the icon to show is by adding double quotes to the Exec entry. Like so:

Exec="/home/me/OS's and other progs/Jetbrains - PyCharm, etc/jetbrains-toolbox-2.8.0.51430/bin/jetbrains-toolbox" %u 

But the problem is that once I do that > Click the icon to open it > do my stuff > close it again... For some reason it rewrites the file and deletes the double quotes from the Exec entry, and then I have to do it all over again, or run the program directly from the terminal via ~/path/to/jetbrains-toolbox, which gets annoying.

I also read the docs for desktop entry keys, and for the Exec variables like %u, and a number of other guides on this site and off, like this one, and this one too.

I also made some other test desktop entries with the same code above but with no double quotes, but using my own and the same toolbox.svg image in other folders for the Icon entry, but with a different Exec entry such as /usr/bin/gedit, and it opened gedit every time. So the problem is obviously the Exec line, but my double quotes keep getting overwritten.

I even chmod 777 jetbrains-toolbox.desktop, and even that wouldn't work.

I also asked Jetbrains about this like a week ago. No response yet.

And nothing I tried is fixing the problem.

QUESTION

What can I do to stop it from overriding my double quotes, or do you have a better idea on making the program run without me having to do the above stuff again and again??

0

1 Answer 1

2

But the problem is that once I do that > Click the icon to open it > do my stuff > close it again... For some reason it rewrites the file and deletes the double quotes from the Exec entry

JetBrains likely tries to re-install its own .desktop file every time you open it, and since its .desktop generating code hasn't been written to properly handle paths with spaces (and/or single quotes), it probably thinks that your fixed version is actually incorrect and replaces it with its "correct" version. It seems like a bug they need to fix.

I even chmod 777 jetbrains-toolbox.desktop, and even that wouldn't work.

Not sure why you expect it to work; if anything it sets the opposite permissions than the ones which might work. You want to remove 'write' permissions from everyone including yourself, but 777 does the opposite and grants every possible permission to everyone.

(That is, 777 converted from octal to binary is 111 111 111, which means rwx rwx rwx. In chmod symbolic notation it does ugo=rwx.)

Instead:

  • Try chmod a-w or chmod a=r (rx if you want) or chmod 444 (4oct=100bin=r--). This will prevent direct overwrite, but will not prevent delete-and-replace.

  • If that doesn't help, you can sudo chattr +i to glue the file in place. It will become completely read-only (immutable) until root does a chattr -i again.

  • If your distribution supports it, an AppArmor policy could be written specifically for the jetbrains-toolbox executable to prevent it from touching a specific file while other tools still can, although "allow any other action" is not very straightforward in AppArmor.

  • Finally you could create a differently named file, e.g. jetbrains-toolbox-fixed.desktop, with a distinct icon and name.

1
  • You were right. The easiest and fastest way was to make a jetbrains-toolbox-fixed.desktop, add my double quotes back in, and it works fine. I haven't tried chmod 555 or similar yet, but good call anyway. Thanks! Commented Sep 25 at 15:13

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.