Unable to launch programs by clicking file/icon

Hi, a strange problem has appeared with my installation Leap 15.1.
When I attempt to start a program by clicking either the file or an icon linking to it, i just get the file opening in Kate, or, if it’s a desktop icon, the Desktop Entry, e.g.


[Desktop Entry]
Comment[en_GB]=
Comment=
Exec=/home/andy/Programs/JobTracker/Start.py
GenericName[en_GB]=
GenericName=
Icon=/home/andy/Programs/JobTracker/Icons/shackles.png
MimeType=
Name[en_GB]=JobTracker
Name=JobTracker
Path=/home/andy/Programs/JobTracker
StartupNotify=true
Terminal=false
TerminalOptions=
Type=Application
X-DBUS-ServiceName=
X-DBUS-StartupType=
X-KDE-SubstituteUID=false
X-KDE-Username=

This happens even though the file properties are set to ‘is executable’ and the access permissions are set to ‘Can view and Modify’. Python programs like the above have the correct shebang at the top.

This happens with most programs, except those where the first tab of the Properties window lists the file as Type: executable.

In all cases the program can be launched from the terminal, e.g. in the above case by entering ./Start.py. Start menu programs start normally.

Does anyone have any idea what’s going on? It’s really very irritating.

This is apperently all about a desktop? But which one. Please do not let your potential audience guess such an importnat fact.

Whoops, my bad.
It’s KDE 5.12.8

Hi
Only a few of the items are required and they do need data after the equals sign, get rid of the rest…

https://en.opensuse.org/openSUSE:Packaging_desktop_menu_categories
https://specifications.freedesktop.org/menu-spec/menu-spec-latest.html


[Desktop Entry]
Comment[en_GB]=A python job tracker
Comment=A python job tracker
Exec=/home/andy/Programs/JobTracker/Start.py
Icon=/home/andy/Programs/JobTracker/Icons/shackles.png
Name[en_GB]=JobTracker
Name=JobTracker
StartupNotify=true
Terminal=false
Type=Application
Encoding=UTF-8
Categories=Office;ProjectManagement;

I normally put icons in ~/.icons, then your Icon= would be;


Icon=shackles

Hi Malcolm,
That example file was the one that was automatically generated when i used the ‘Link to Application’ command from the right-click menu in a folder. It seems that if you leave some of the fields in the Application tab of the resulting dialogue unfilled, it leaves a blank after the equals sign.
If it’s a program I’ve written, I prefer to keep the icon in the program folder, it just makes it easier to keep track of the things.

Hi
So did the modified one work?

No, the same thing happens even when directly clicking the executable file, so for the example above you get Start.py opening in Kate:

#!bin/python3.6
import sys

from PyQt5 import QtGui, Qt
from PyQt5.QtWidgets import QApplication, QSplashScreen

from JobTracker import MainWindow

if __name__ == "__main__":
    app = QApplication(sys.argv)
    splash_pix = QtGui.QPixmap("./Icons/icon_start.png")
    splash = QSplashScreen(splash_pix, Qt.Qt.WindowStaysOnTopHint)
    splash.setMask(splash_pix.mask())
    splash.show()
    app.processEvents()
    myapp = MainWindow()
    myapp.show()
    splash.finish(myapp)
    sys.exit(app.exec_())

Or, for QCad, say:

#!/bin/bash
#
# QCAD startup script
#

DIR=${0%/*}
binary="$DIR/qcad-bin"

# Many Linux distributions try to use a style plugin that
# is not available as 32bit version, links against another 
# version of Qt or is otherwise incompatible. For this
# reason, this script forces the style to the integrated 
# plastique style of Qt.

# The style may be changed here or removed to use the
# default style:

LD_LIBRARY_PATH="$DIR" "$binary" -style plastique "$@"

Also, I tried logging into an alternative desktop (IceWM), with the same result, so not a problem specific to KDE.

Hi
I imagine all was working ok with respect to desktop icons before you created the shortcut? I wonder if the mime entry being blank screwed something up…

Do you have a file;


cat ~/.local/share/applications/mimeinfo.cache

Note I’m on GNOME here, but should still be the same…

Check the setting “When opening an executable file” in dolphin (General->Confirmations). It’s probably set to “Open in application”.

@Malcolm, the shortcuts were created long ago and everything has worked fine until a few days ago. I do have the mimeinfo.cache file - much of its contents refer to wine, I’ll come back to that in a moment.

@wolfi, It’s actually “Ask for confirmation in all KDE applications when:” … “Executing scripts or desktop files” in my installation, and checking it works! Admittedly I (obviously) have to select “Execute” in the pop-up, but that’s a minor issue which I can happily live with (and might actually be convenient on occasions when I want to select a file but not execute it).

I had a look at the settings on my laptop, which also has Leap 15.1 and which has been working correctly, and “Ask for confirmation in all KDE applications when:” … “Executing scripts or desktop files” isn’t checked, yet programs run. It’s all very strange, the only thing I’ve done recently which might involve some change in settings was a lot of messing around with Wine/PlayOnLinux, etc. in an ultimately unsuccessful attempt to get Adobe Digital Editions to work. It’s hard to see that there could be any connection, but if anyone knows differently, I’d be interested to know.

Thanks to all for your help,

Andy

Did you inadvertently enable double clicking? Application Starter > System Settings > Workspace Behavior > General Behavior

Apparently the exact text changed in later versions… :wink:

Admittedly I (obviously) have to select “Execute” in the pop-up, but that’s a minor issue which I can happily live with (and might actually be convenient on occasions when I want to select a file but not execute it).

I had a look at the settings on my laptop, which also has Leap 15.1 and which has been working correctly, and “Ask for confirmation in all KDE applications when:” … “Executing scripts or desktop files” isn’t checked, yet programs run.

Well, there are actually 3(!) possible settings:

  • Always ask for confirmation (the default)
  • Open in application
  • Execute

The settings in older dolphin versions were slightly wrong (or rather incomplete) unfortunately.

Anyway, you can get rid of the dialog by activating the “Don’t ask me again” checkbox, the button you click (i.e. Execute or Open) will then be used everytime without asking.
That’s maybe how you ended up in this situation in the first place, or why your laptop executes without asking.

Btw, the setting is stored in ~/.config/kiorc.
E.g. it contains something like this:

[Executable scripts]
behaviourOnLaunch=execute

(this means it will always execute without asking, can also be “open” and “alwaysAsk”)

Also see https://forum.kde.org/viewtopic.php?f=224&t=129445.

Thanks Wolfi, I’ve just edited ~/.config/kiorc and everything’s back to normal. I wonder how it got changed…

@karlmistelburger - that’s what I thought at first (might have fitted with messing around with Wine), but no.

FWIW, the kiorc setting I have is

[Executable scripts]
behaviourOnLaunch=dontAsk

I note Nate Graham mentioned this…
https://bugs.kde.org/show_bug.cgi?id=421294#c1

My ~/.config/kiorc dates from August 2016. Could be a spurious malfunction. One user had a support call when the desktop disappeared all of sudden. On restart it insisted on using folder Desktop instead of (german) Schreibtisch. Never succeeded in reverting this behavior, but moved the old home and started with a pristine one.

Annoyingly, I first changed the setting using the Dolphin settings dialogue so I don’t know what kiorc had said before, or even whether it had existed prior to my making the change to “Executing scripts or desktop files”.

It gets changed when you change the setting in dolphin, or tick “Do not ask again” in the dialog that asks about executing or opening.

The default is “alwaysAsk”, that’s what it should do on a fresh installation/user account, and that’s what you get when you delete the file or line.

IIRC, they used a wrong value when expanding the dolphin settings, and I think I even mentioned this in the review back then…

Although, the way kio reads the option, “dontAsk” is equal to “open”.