0

OK, I've been beating my head against this for two hours and trying not to have to post it as a question, but I give up. I migrated today to a new Ubuntu 24.04 installation, and I can't get my FaveProgram.desktop files to work. These are files that define GUI launcher icons to run a particular CLI command (e.g. "faveprogram -option attribute"), and I have searched and tried and searched and hacked and tested and aaaarrrrgghh...

When I "run" the icon, it always opens the default text editor. Here's what I've tried:

  • right click -> Run As Program
  • right click -> Open With -> Run Software
  • set as executable graphically in GUI
  • set as executable manually with chmod (confirmed)
  • gio set FaveProgram.desktop metadata::trusted {yes true TRUE} (tried them all)
  • note: "Allow To Launch" is NOT available in the right-click menu!
  • starting from scratch with new .desktop file

I watched /var/log/syslog and it says something about a VTE spawn problem. That might be a red herring but I'm mentioning it in case someone has a tip on a next step there.

I started to try to look into xdg-mime but I didn't understand it.

Here's the contents of the .desktop file I'm trying to run:

#!/usr/bin/env xdg-open
[Desktop Entry]
Version=1.0
Type=Application
Terminal=true   <-- normally false, tried true anyway
Exec=/usr/bin/program -option value   <-- yes it exists, can run manually
Name=FaveProgram
Comment=FaveProgram
Icon=/valid/path/to/icon.png

EDIT: Found the "edit" link here, wasn't visible before. Adding a few more things:

  • thanks to admin @mook765 for quickly editing this question to format my code
  • I did try removing the xdg-open, no improvement
  • I've previously been running these icons from arbitrary folders, via Nautilus / Files / file manager, not from GUI menus; re an XDG application folder, which one should I try?
  • thanks @david; I did try that the first method suggested in that thread and it didn't work, will move on to the others shortly

In case the VTE errors in syslog lead to problem, here is the burst of errors I get there when I try to "run as program":

  • 2025-03-06T15:58:58.273700-05:00 shuttle4 systemd[1379]: vte-spawn-8a9d9df0-2262-4e79-b9be-15b00bcdf6b5.scope: PID 48562 vanished before we could move it to target cgroup '/user.slice/user-1000.slice/user@1000.service/app.slice/app-org.gnome.Terminal.slice/vte-spawn-8a9d9df0-2262-4e79-b9be-15b00bcdf6b5.scope', skipping: No such process
  • 2025-03-06T15:58:58.273830-05:00 .... No PIDs left to attach to the scope's control group, refusing
  • (two more lines, char limited)

2 Answers2

0

For the record, some googling of the VTE errors (mentioned in a comment above) led me to a) reinstall dbus (via apt) and b) to reboot. So one of those (maybe just the reboot!) alone may have contributed to things starting to work.

So, now I'm getting somewhere! In short, I discovered that the exact same .desktop file, from 2019 with NO edits, works properly if copied to the Desktop area and launched from there via double-click. If I use Nautilus / Files to navigate to ~/Desktop folder and double-click the .desktop file there, I get the vexing text editor. This is not how it worked before!

So I think @vanadium (in a comment) above was on the right path. In what way can I add "xdg-open" to the .desktop file so that it works within Nautilus, in Ubuntu 24.04? Because I don't want to have to view my Desktop to launch these programs.

0

Running programs by clicking any executable file in a file manager is not anymore supported in several desktop environments. The user is supposed to run properly installed programs by launching them from an Application menu, or with a command in the terminal or a "Run a command" dialog, or through a file association (i.e., clicking an .odt launches LibreOffice). In Gnome Shell, executables still can be run from the right-click menu, only not anymore by hitting Enter or double clicking.

It remains possible to configure your system such that double-clicking a .desktop launcher in the file manager starts the application.

  • Create a .desktop launcher that runs a tool that can run .desktop files, for example for the gnome desktop: Exec=gio launch %U, in a dedicated location (e.g. ~/.local/share/applications for access by the user only)
  • In the file manager, associate .desktop files with that launcher.

See this question for ways to run .desktop launchers from a command, in this case from .

vanadium
  • 97,564