Leap 16 beta `xdg-open` doesn't work on KDE Plasma 6 (old version of script)

Hi, I have a little project with a tray indicator icon menu item that relies on xdg-open to open a folder location for the user. This almost always works as long as the xdg-mime setting for the default app to handle inode/directory is correct.

In Leap 16 beta it doesn’t work on Plasma 6. And I know why.

The xdg-open command is actually just a long shell script with functions like this:

open_kde()
{
    if [ -n "${KDE_SESSION_VERSION}" ]; then
      case "${KDE_SESSION_VERSION}" in
        4)
          kde-open "$1"
        ;;
        5)
          "kde-open${KDE_SESSION_VERSION}" "$1"
        ;;
        6)
          kde-open "$1"
        ;;
      esac
    else
        kfmclient exec "$1"
        kfmclient_fix_exit_code $?
    fi

    if [ $? -eq 0 ]; then
        exit_success
    else
        exit_failure_operation_failed
    fi
}

This is the current version of the relevant function in the script hosted at the source:

Over a year ago, when Plasma 6 was still in beta/prerelease, most distros already had the xdg-open command updated to handle Plasma 6, while a few still had an older version of the script that only knew about Plasma 4 and 5, like this:

open_kde()
{
    if [ -n "${KDE_SESSION_VERSION}" ]; then
      case "${KDE_SESSION_VERSION}" in
        4)
          kde-open "$1"
        ;;
        5)
          "kde-open${KDE_SESSION_VERSION}" "$1"
        ;;
      esac
    else
        kfmclient exec "$1"
        kfmclient_fix_exit_code $?
    fi

    if [ $? -eq 0 ]; then
        exit_success
    else
        exit_failure_operation_failed
    fi
}

KDE Neon was strangely one of the distros that hadn’t updated the script version yet. The function looks the same in the version of the script on Leap 16 beta.

The script in either case has the defect that if KDE_SESSION_VERSION is found but the value is not in the case logic tree, it will simply do nothing, with no error message and no bad return code. This can cause a lot of confusion for the user wondering why it isn’t doing anything. I was able to implement a fall-back mechanism in my app so that it will work on Leap 16 even before xdg-open gets updated, but most users may find it difficult to figure out why the command is not working in Plasma 6.

I don’t have an account on the openSUSE Bugzilla, and don’t really have a reason to be signing up for one. Leap 16 is just one of many distros I test my project on. If someone who has a Bugzilla account could report this and help prompt the xdg-utils package to be updated, so that xdg-open will function in Plasma 6 (which is available on Leap 16 beta), that would be appreciated.

I have separately submitted an issue for xdg-utils at the source, to possibly get the open_kde() function updated with some error messages and fall-back actions for any future unrecognized values of KDE_SESSION_VERSION, which would prevent issues like this.

Not sure if this is the right forum to post this in, but I’m sure it will get moved if not. There’s no leap-16 tag, so I’m using “other”.

Thanks. :+1:

You already have an openSUSE bugzilla account. It is the same as the forum login.

This is the user forum where the devs don’t read as it is no proper communication channel for bugs. So please create a bugreport.

1 Like

Oh, is it? I’ll give it a try then. Often Bugzillas are their own thing.

Did the best I could on a bug report.

https://bugzilla.opensuse.org/show_bug.cgi?id=1238210

Thanks for responding.

I don’t see xdg-utils in Leap 16 alpha/ 15.6. What do I miss?

The package is in the standard OSS repo…

Leap 16:
https://download.opensuse.org/distribution/leap/16.0/repo/oss/noarch/xdg-utils-1.1.3+20210805-slfo.1.1.3.noarch.rpm

Leap 15.6:
https://download.opensuse.org/distribution/leap/15.6/repo/oss/noarch/xdg-utils-1.1.3+20210805-150500.1.1.noarch.rpm

1 Like

Thanks, I have missed the noarch stuff.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.