elementary / applications-menu

Applications Menu for elementary OS and the Pantheon desktop environment
https://elementary.io
GNU General Public License v3.0
103 stars 35 forks source link

Desktop entries with pkexec do not work #536

Open andrewdbate opened 2 years ago

andrewdbate commented 2 years ago

What Happened?

The Applications menu picks up on desktop entries located in /usr/share/applications (plus other locations).

If the Exec line of a desktop entry is of the form Exec=pkexec <executable-name-here> then attempting to launch the application from the Applications menu does not work.

Some applications such as Timeshift install a desktop entry which calls pkexec. For example, the Timeshifts desktop entry has the line:

Exec=pkexec timeshift-gtk

Now I agree that desktop entries probably shouldn't use pkexec like this, however, it should still be supported by the Applications menu because it is not uncommon.

Note that double-clicking the Timeshift desktop entry from the Nemo file manager launches Timeshift correctly. (The elementary OS Files file manager does not support launching applications by double-clicking the desktop entry it seems.)

Steps to Reproduce

Create a file Example.desktop with the following contents:

[Desktop Entry]
Name=Example
Exec=pkexec io.elementary.photos
Type=Application
Terminal=false
Categories=Utility;

Again, I agree that this is not the best way to use pkexec but it should work regardless. I am using io.elementary.photos only for the example (I do know that Photos shouldn't be ordinarily used with pkexec).

Copy this file to /usr/share/applications. You will now see an application named "Example" in the Accessories category of the Applications menu.

If you click it, then an icon will appear in the dock and then disappear a few seconds later. You will not get the pkexec prompt to ask you for your password.

Now if you change the line:

Exec=pkexec io.elementary.photos

to

Exec=io.elementary.photos

and then go back to the Applications menu, this time Photos will launch as usual. So it was the pkexec entry that caused the issue.

Expected Behavior

The Applications menu should support desktop entries with Exec lines such as

Exec=pkexec timeshift-gtk

This should launch the user/password prompt as usual: Screenshot from 2022-03-20 18 15 27

OS Version

6.x (Odin)

Software Version

Latest release (I have run all updates)

Log Output

No response

Hardware Info

No response