Houston4444 / RaySession

Session manager for linux musical programs
GNU General Public License v2.0
166 stars 18 forks source link

Doesn't detect apps installed via flatpak #117

Open Kirtai opened 3 years ago

Kirtai commented 3 years ago

When an app like Guitarix is installed via flatpak, it is not detected.

Kirtai commented 3 years ago

It also does not detect AppImages such as qtractor-0.9.22-64.x86_64.AppImage

Houston4444 commented 3 years ago

Hi. Yes this is totally normal, it searches for executables in PATH. In NSM protocol, programs must be in PATH. With an appimage, just link the executable of your program to somewhere in PATH (~/bin/ for example in most distributions). Then add them with "Add executable".

Kirtai commented 3 years ago

Well, my flatpaks and appimages are in $PATH. Must be the odd names preventing automatic detection. Thanks for saying how to get the appimages working though :)

I did have some problems with the Flatpak not starting/stopping correctly but I'll file another issue if I track that down.

Kirtai commented 2 years ago

It still doesn't detect flatpak installed apps even with the new *.desktop file entries.

This is probably because Flatpak stores the *.desktop files in /var/lib/flatpak/exports/share/applications

Houston4444 commented 2 years ago

Hi. Are you talking about applications with X-NSM-Capable=true entry in the .desktop file ? This folder is not currently listed, that is true. Are you sure it is ever this folder on all distributions for .desktop files ?

Kirtai commented 2 years ago

Ok, I think I've figured it out.

According to the XDG standard, the environment variable $XDG_DATA_DIRS contains the list of folders to search for data files. Flatpak adds its folder to that env var.

So, RaySession should search for desktop files in the folders listed in $XDG_DATA_DIRS/applications, rather than a hardcoded set of folders. This way, it will automatically find all of the installed desktop files.

On my system I get

echo $XDG_DATA_DIRS 
/home/faith/.local/share/flatpak/exports/share:/var/lib/flatpak/exports/share:/usr/local/share:/usr/share

From the standard:

 There is a set of preference ordered base directories relative to which data files should be searched. This set of directories is defined by the environment variable $XDG_DATA_DIRS. 

$XDG_DATA_DIRS defines the preference-ordered set of base directories to search for data files in addition to the $XDG_DATA_HOME base directory. The directories in $XDG_DATA_DIRS should be seperated with a colon ':'.

If $XDG_DATA_DIRS is either not set or empty, a value equal to /usr/local/share/:/usr/share/ should be used. 
Houston4444 commented 2 years ago

Interesting. I remember to have tried to get theses folders with python xdg lib, but it was giving them in a wrong order (/usr/share before /usr/local/share IIRC). Now, they seems to be in the good order in my distribution.

I have no XDG_DATA_DIRS env var, but it's maybe not strong, all seems to be well now with xdg python lib (just checked). So it's something doable.

Thanks

Kirtai commented 2 years ago

Yeah, it's not usually defined in which case it defaults to /usr/local/share/:/usr/share/

It's defined on my system because Flatpak adds it's own folders to it, but it's also useful for any self installed software you may add.

Good to hear it's working now though :)

Houston4444 commented 2 years ago

It should be now fixed with the last commit. Please test !

Kirtai commented 2 years ago

I finally got around to testing it but it still doesn't detect them.

Could it be because they are symlinks?

e.g.

/var/lib/flatpak/exports/share/applications/org.guitarix.Guitarix.desktop

links to

../../../app/org.guitarix.Guitarix/current/active/export/share/applications/org.guitarix.Guitarix.desktop

on my system.

org.guitarix.Guitarix.desktop does have X-NSM-Capable=true in it.