1

I have .desktop files (shortcuts) on a RHEL 8.8 machine that are set up correctly and work on other RHEL systems, but for some reason, whenever trying to launch (double click) on these desktop files FROM the GUI it opens them in gedit.

There used to be an option when right clicking on these files to "Allow Launching" which was part of our installation instructions for customers but that doesn't exist in the RMC menu anymore for any of the .desktop files.

They are all set to executable. I installed the GNOME Tweaks and other add-on extensions and it's all set to use shortcuts. My software's shortcut is proprietary so I'm sharing one for Perforce.

Getting a crash course in MIME types and GNOME desktop, but nothing is helping. I am comparing the /usr/share/application and /usr/share/packages locations and so far everything matches the systems where this functionality WORKS.

Here's an example of one of the .desktop files:

[Desktop Entry] Type=Application MimeType=application/x-desktop Name=P4V Icon=/home/tcgllc/Perforce/p4v-2023.4.2558838/lib/P4VResources/icons/p4v.svg Exec=/home/tcgllc/Perforce/p4v-2023.4.2558838/bin/p4v Terminal=false Path=/home/tcgllc/Perforce/p4v-2023.4.2558838/bin 

One crazy aspect of this is that double clicking on them in the Files app (opened to ~/Desktop) works! It's JUST the .desktop files, in ~/Desktop, via double clicking on the gui.

Tried all of the following: Copied P4V.desktop to /usr/share/applications

gio set P4V.desktop metadata::trusted true gio set P4V.desktop metadata::trusted yes xdg-mime default P4V.desktop application/x-desktop update-desktop-database /usr/share/applications update-mime-database /usr/share/mime xdg-desktop-menu install /usr/share/applications/P4V.desktop --novendor 

when I run file --mime P4V.desktop the output is

/home/tcgllc/Desktop/P4V.desktop: text/plain; charset=us-ascii 

I have the free RHEL Developer subscription but it's self supported, RHEL Knowledgebase has been searched. I've been pulling my hair out for 2 days. I've tried everything I could find on google and I'm screaming uncle.

If anyone can help me with this issue I would be immensely grateful!

TIA KL

Editing to add what I've tried based on chubblywarner's comments (sorry new here, I just saw it said to edit original post!?)

YES you are correct in all of your initial points. I ended up re-creating the .desktop file and removing the copies of it I had placed all over the system to "start fresh".

$ nano P4V.desktop (made updates to .desktop file)

$ chmod +x ~/Desktop/P4V.desktop $ sudo update-mime-database /usr/share/mime $ sudo update-desktop-database $ gio info P4V.desktop standard::icon: application-x-desktop, text-x-generic standard::content-type: application/x-desktop standard::fast-content-type: application/x-desktop standard::symbolic-icon: application-x-desktop-symbolic, text-x-generic-symbolic, application-x-desktop, text-x-generic access::can-read: TRUE access::can-write: TRUE access::can-execute: TRUE access::can-delete: TRUE access::can-trash: TRUE access::can-rename: TRUE owner::user: tcgllc owner::user-real: tcgllc owner::group: tcgllc selinux::context: unconfined_u:object_r:user_home_t:s0 xattr-sys::security.selinux: unconfined_u:object_r:user_home_t:s0 metadata::nautilus-icon-position: 0,283 $ xdg-mime default P4V.desktop application/x-desktop $ gsettings get org.gnome.nautilus.preferences executable-text-activation 'launch' $ grep -r "application/x-desktop" ~/.config /etc/xdg /home/tcgllc/.config/mimeapps.list:application/x-desktop=org.gnome.gedit.desktop; /home/tcgllc/.config/mimeapps.list:application/x-desktop=P4V.desktop $ getenforce Permissive 

I'm not sure if anything below is useful, but it does look like there are warnings, permission issues?

$ journalctl -b | grep -i desktop .... Aug 29 15:52:04 TEW-LINUX sudo[9531]: tcgllc : TTY=pts/0 ; PWD=/home/tcgllc/Desktop ; USER=root ; COMMAND=/bin/update-desktop-database Aug 29 15:52:21 TEW-LINUX sudo[9556]: tcgllc : TTY=pts/0 ; PWD=/home/tcgllc/Desktop ; USER=root ; COMMAND=/bin/update-desktop-database Aug 29 15:53:12 TEW-LINUX sudo[9602]: tcgllc : TTY=pts/0 ; PWD=/home/tcgllc/Desktop ; USER=root ; COMMAND=/bin/xdg-mime default P4V.desktop application/x-desktop Aug 29 15:53:52 TEW-LINUX gnome-session[2863]: gnome-session-binary[2863]: WARNING: Unable to inhibit system: GDBus.Error:org.freedesktop.DBus.Error.AccessDenied: Permission denied Aug 29 15:53:52 TEW-LINUX gnome-session-binary[2863]: WARNING: Unable to inhibit system: GDBus.Error:org.freedesktop.DBus.Error.AccessDenied: Permission denied Aug 29 15:53:53 TEW-LINUX gnome-shell[3101]: desktop-icons: File System Manager.desktop is writable by others - will not allow launching Aug 29 15:54:51 TEW-LINUX sudo[9689]: tcgllc : TTY=pts/0 ; PWD=/home/tcgllc/Desktop ; USER=root ; COMMAND=/bin/xdg-mime default P4V.desktop application/x-desktop Aug 29 15:55:15 TEW-LINUX sudo[9722]: tcgllc : TTY=pts/1 ; PWD=/usr/share/applications ; USER=root ; COMMAND=/bin/rm P4V.desktop Aug 29 16:23:31 TEW-LINUX gnome-session[2863]: gnome-session-binary[2863]: WARNING: Unable to inhibit system: GDBus.Error:org.freedesktop.DBus.Error.AccessDenied: Permission denied Aug 29 16:23:31 TEW-LINUX gnome-session-binary[2863]: WARNING: Unable to inhibit system: GDBus.Error:org.freedesktop.DBus.Error.AccessDenied: Permission denied Aug 29 16:26:53 TEW-LINUX org.gnome.Shell.desktop[3101]: Window manager warning: Buggy client sent a _NET_ACTIVE_WINDOW message with a timestamp of 0 for 0x2400101 Aug 29 16:29:05 TEW-LINUX sudo[11737]: tcgllc : TTY=pts/0 ; PWD=/home/tcgllc/Desktop ; USER=root ; COMMAND=/bin/update-mime-database /usr/share/mime Aug 29 16:29:16 TEW-LINUX sudo[11753]: tcgllc : TTY=pts/0 ; PWD=/home/tcgllc/Desktop ; USER=root ; COMMAND=/bin/update-desktop-database Aug 29 16:31:35 TEW-LINUX org.gnome.Shell.desktop[3101]: Window manager warning: Buggy client sent a _NET_ACTIVE_WINDOW message with a timestamp of 0 for 0x2000007 _updateDesktopIfChanged@/usr/share/gnome-shell/extensions/[email protected]/desktopManager.js:415:21 _monitorDesktopFolder/<@/usr/share/gnome-shell/extensions/[email protected]/desktopManager.js:368:89 Aug 29 16:32:27 TEW-LINUX gnome-shell[3101]: desktop-icons: File System Manager.desktop is writable by others - will not allow launching Aug 29 16:33:09 TEW-LINUX sudo[11889]: tcgllc : TTY=pts/0 ; PWD=/home/tcgllc/Desktop ; USER=root ; COMMAND=/bin/update-mime-database /usr/share/mime Aug 29 16:33:41 TEW-LINUX sudo[11899]: tcgllc : TTY=pts/0 ; PWD=/home/tcgllc/Desktop ; USER=root ; COMMAND=/bin/update-desktop-database Aug 29 16:36:02 TEW-LINUX org.gnome.Shell.desktop[3101]: Window manager warning: Buggy client sent a _NET_ACTIVE_WINDOW message with a timestamp of 0 for 0x2400101 

Then, the final few commands:

$ gnome-shell --version GNOME Shell 3.32.2 $ rpm -qa | grep gnome gnome-desktop3-3.32.2-1.el8.x86_64 gnome-shell-3.32.2-50.el8.x86_64 gnome-shell-extension-common-3.32.1-39.el8_10.noarch gnome-shell-extension-top-icons-3.32.1-39.el8_10.noarch chrome-gnome-shell-10.1-7.el8.x86_64 gnome-online-accounts-3.28.2-4.el8.x86_64 gnome-system-monitor-3.28.2-1.el8.x86_64 gnome-control-center-filesystem-3.28.2-37.el8.noarch gnome-terminal-3.28.3-3.el8.x86_64 gnome-shell-extension-places-menu-3.32.1-39.el8_10.noarch gnome-screenshot-3.26.0-3.el8.x86_64 gnome-session-wayland-session-3.28.1-19.el8.x86_64 gnome-bluetooth-libs-3.34.3-1.el8.x86_64 gnome-session-xsession-3.28.1-19.el8.x86_64 gnome-keyring-pam-3.28.2-1.el8.x86_64 gnome-control-center-3.28.2-37.el8.x86_64 gnome-shell-extension-window-list-3.32.1-39.el8_10.noarch gnome-font-viewer-3.28.0-1.el8.x86_64 gnome-user-docs-3.28.2-1.el8.noarch gnome-menus-3.13.3-11.el8.x86_64 gnome-tweaks-3.28.1-7.el8.noarch gnome-video-effects-0.4.3-3.el8.noarch gnome-themes-standard-3.22.3-4.el8.x86_64 gnome-shell-extension-horizontal-workspaces-3.32.1-39.el8_10.noarch gnome-classic-session-3.32.1-39.el8_10.noarch gnome-initial-setup-3.28.0-11.el8.x86_64 gnome-color-manager-3.28.0-3.el8.x86_64 gnome-calculator-3.28.2-2.el8.x86_64 gnome-shell-extension-user-theme-3.32.1-39.el8_10.noarch gnome-settings-daemon-3.32.0-19.el8.x86_64 libgnomekbd-3.26.0-4.el8.x86_64 gnome-shell-extension-launch-new-instance-3.32.1-39.el8_10.noarch gnome-software-3.36.1-11.el8.x86_64 gnome-bluetooth-3.34.3-1.el8.x86_64 gnome-session-3.28.1-19.el8.x86_64 gnome-keyring-3.28.2-1.el8.x86_64 gnome-autoar-0.2.3-2.el8.x86_64 gnome-shell-extension-apps-menu-3.32.1-39.el8_10.noarch gnome-boxes-3.36.5-8.el8.x86_64 gnome-terminal-nautilus-3.28.3-3.el8.x86_64 gnome-logs-3.28.5-3.el8.x86_64 gnome-getting-started-docs-3.28.2-1.el8.noarch gnome-shell-extension-desktop-icons-3.32.1-39.el8_10.noarch gnome-disk-utility-3.28.3-2.el8.x86_64 gnome-remote-desktop-0.1.8-3.el8.x86_64 gnome-characters-3.28.2-1.el8.x86_64 $ $ ls -l ~/Desktop/P4V.desktop -rwxrwxr-x. 1 tcgllc tcgllc 298 Aug 29 16:32 /home/tcgllc/Desktop/P4V.desktop 

I appreciate SO MUCH all of your help in diagnosing this weirdness. Unfortunately, I still only get gedit double clicking on the .desktop file ON the desktop. And still, when I double click on the .desktop files in the Files App, it will launch correctly. I'm going to include a visual of this. I do get the "Untrusted application launcher" pop up the first time running P4V.desktop in the Files App. Thereafter, the icon shows as expected.

enter image description here

Also, if I am responding to or communicating with you incorrectly, let me know what I should do if different. :) TYSVM

2 Answers 2

0

The Problem

From what I understand:

  • Your .desktop files (shortcuts) work fine on other RHEL systems
  • Double-clicking them from the GUI opens them in gedit instead of launching the app
  • The "Allow Launching" option is missing from the right-click menu
  • Weirdly, double-clicking in the Files app (when opened to ~/Desktop) works fine
  • You've already tried a bunch of solutions (nice work on the troubleshooting!)

Initial Thoughts

The first thing that jumps out at me is the MIME type issue. When you ran file --mime P4V.desktop, it showed up as text/plain instead of application/x-desktop. That's probably why your system is defaulting to gedit.

The .desktop File

Let's start by tweaking your .desktop file a bit. Here's a modified version that might work better:

[Desktop Entry] Type=Application MimeType=application/x-desktop Name=P4V Icon=/home/tcgllc/Perforce/p4v-2023.4.2558838/lib/P4VResources/icons/p4v.svg Exec="/home/tcgllc/Perforce/p4v-2023.4.2558838/bin/p4v" %f Terminal=false Path=/home/tcgllc/Perforce/p4v-2023.4.2558838/bin Categories=Development; 

The main changes here are:

  1. Added quotes around the Exec command and included %f at the end
  2. Added a Categories entry

Troubleshooting Steps

Alright, let's go through this step-by-step. Some of these you might have already tried, but it's worth giving them another shot:

  1. File Permissions: Make sure the file is executable.

    chmod +x ~/Desktop/P4V.desktop 
  2. Update MIME Database: This helps the system recognize file types correctly.

    sudo update-mime-database /usr/share/mime 
  3. Update Desktop Database: This refreshes the system's knowledge of .desktop files.

    sudo update-desktop-database 
  4. Check File Recognition: Let's see if the system is seeing the file correctly.

    gio info ~/Desktop/P4V.desktop 

    Look for "standard::content-type". It should say "application/x-desktop".

  5. Set Default Application: Tell the system to use your .desktop file for .desktop files (I know, it sounds weird).

    xdg-mime default P4V.desktop application/x-desktop 
  6. Check GNOME Settings: Make sure GNOME is set to launch executables.

    gsettings get org.gnome.nautilus.preferences executable-text-activation 

    If it says 'display', change it to 'launch':

    gsettings set org.gnome.nautilus.preferences executable-text-activation 'launch' 
  7. Look for Conflicts: Check if something else is trying to handle .desktop files.

    grep -r "application/x-desktop" ~/.config /etc/xdg 
  8. Check SELinux: Sometimes SELinux can interfere.

    getenforce 

    If it says "Enforcing", try:

    sudo setenforce 0 

    Test your .desktop file. If it works now, you'll need to create an SELinux policy (that's a whole other can of worms).

  9. Check Logs: Look for any errors related to desktop files.

    journalctl -b | grep -i desktop 

If All Else Fails

If none of that works (fingers crossed it does!), we might need to dig deeper. Could you run these commands and share the output?

gnome-shell --version rpm -qa | grep gnome ls -l ~/Desktop/P4V.desktop 

This will give us more info about your GNOME setup and the specific .desktop file.

Wrapping Up

I know this is a lot to try, but hopefully one of these steps will solve the issue. If not, don't worry! We'll figure it out. Let me know how it goes, and we can brainstorm more ideas if needed.

Good luck!

2
  • I CANNOT thank you ENOUGH for helping me with this! No luck (I tried all the commands you gave me) except there may be some type of permissions WARNINGS in the journalctl. (gonna try to attach a log file to this for you to see - if not I'll paste it in) Commented Aug 29, 2024 at 20:45
  • Hi again - I updated my original post (I didn't know if I should update yours?) with comments and output. SO much appreciation. Commented Aug 29, 2024 at 21:16
0

First, "Desktop files" are not supposed to be "executables".

The part that in ~/Desktop works, its an implementation of the "Desktop Manager" (GNOME) wich differe from the "GUI" (File Manager).

My solution was associate "*.desktops" to a script with the file name as parameter (run.sh %F) to run the line "Exec" within desktop files, simplifing :

#!/bin/bash FILE="$1" RUN () {grep '^Exec' "$FILE" | tail -1 | sed 's/^Exec=//' | sed 's/%.//' | sed 's/^"//g' | sed 's/" *$//g' } RUN # function! 

My two cents...

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.