libredeb / lightpad

LightPad is a lightweight, simple and powerful application launcher. It is also Wayland compatible.
GNU General Public License v3.0
63 stars 12 forks source link

Can't run gnome (?) applications #28

Closed hazg closed 2 years ago

hazg commented 3 years ago

There are no windows in gnome programs. From the terminal everything runs correctly.

I.e. I can see in htop for example that they are running.

dconf-editor, deja-dup, gnome-software for example.

Ubuntu 21.04

im using it by UbuntuBudgie/budgie-lightpad-applet in Budgie

Sep 24 18:00:51 ss com.github.libr[8310]: Application.vala:66: The monitor dimensions are: 1440x900
Sep 24 18:00:51 ss com.github.libr[8310]: Application.vala:82: The apps icon size is: 64
Sep 24 18:00:51 ss com.github.libr[8310]: DesktopEntries.vala:44: Number of categories: 13
Sep 24 18:00:51 ss com.github.libr[8310]: DesktopEntries.vala:68: Category [Accessories] has [32] apps
Sep 24 18:00:51 ss com.github.libr[8310]: DesktopEntries.vala:68: Category [Chrome Apps] has [1] apps
Sep 24 18:00:51 ss com.github.libr[8310]: DesktopEntries.vala:68: Category [Games] has [4] apps
Sep 24 18:00:51 ss com.github.libr[8310]: DesktopEntries.vala:68: Category [Graphics] has [8] apps
Sep 24 18:00:51 ss com.github.libr[8310]: DesktopEntries.vala:68: Category [Internet] has [10] apps
Sep 24 18:00:51 ss com.github.libr[8310]: DesktopEntries.vala:68: Category [Office] has [8] apps
Sep 24 18:00:51 ss com.github.libr[8310]: DesktopEntries.vala:68: Category [Other] has [4] apps
Sep 24 18:00:51 ss com.github.libr[8310]: DesktopEntries.vala:68: Category [Programming] has [3] apps
Sep 24 18:00:51 ss com.github.libr[8310]: DesktopEntries.vala:68: Category [Science] has [2] apps
Sep 24 18:00:51 ss com.github.libr[8310]: DesktopEntries.vala:68: Category [Sound & Video] has [9] apps
Sep 24 18:00:51 ss com.github.libr[8310]: DesktopEntries.vala:68: Category [Administration] has [3] apps
Sep 24 18:00:51 ss com.github.libr[8310]: DesktopEntries.vala:68: Category [Preferences] has [34] apps
Sep 24 18:00:51 ss com.github.libr[8310]: DesktopEntries.vala:68: Category [System Tools] has [53] apps
Sep 24 18:00:51 ss com.github.libr[8310]: DesktopEntries.vala:68: Category [Universal Access] has [2] apps
Sep 24 18:00:51 ss com.github.libr[8310]: DesktopEntries.vala:68: Category [Utilities] has [13] apps
Sep 24 18:00:51 ss com.github.libr[8310]: DesktopEntries.vala:89: Amount of apps: 133
Sep 24 18:00:51 ss com.github.libr[8310]: Application.vala:106: Searchbar created!
Sep 24 18:00:54 ss dbus-daemon[2224]: [session uid=1000 pid=2224] Activating service name='org.gnome.DejaDup' requested by ':1.142' (uid=1000 pid=8310 comm="com.github.libredeb.lightpad " label="unconfined")
Sep 24 18:00:54 ss dbus-daemon[2224]: [session uid=1000 pid=2224] Successfully activated service 'org.gnome.DejaDup'
^C
➜  ~ deja-dup 

but from terminal - It's OK

fossfreedom commented 3 years ago

I've debugged this. The issue is that these apps are activated via dbus - however, due to lightpad closing immediately after "launching" the application, the dbus activation is not fully started and hence the application does not appear.

What is needed is that lightpad needs to understand about dbusactivatable and wait until the dbus signal appears before closing.

budgie-desktop shows how this could be done

https://github.com/solus-project/budgie-desktop/blob/master/src/rundialog/RunDialog.vala#L197

https://github.com/solus-project/budgie-desktop/blob/master/src/rundialog/RunDialog.vala#L375

https://github.com/solus-project/budgie-desktop/blob/master/src/rundialog/RunDialog.vala#L352

fossfreedom commented 2 years ago

Note - this is a very dirty patch I'm including in our (ubuntu budgie) backports PPA - I won't do a PR because really the code needs proper dbusactivatable handling as outlined above.

From 7b5cd1e35c1a84d8c4aa181f200562a69dcb1a8b Mon Sep 17 00:00:00 2001
From: David Mohammed <fossfreedom@ubuntu.com>
Date: Tue, 28 Dec 2021 15:40:54 +0000
Subject: [PATCH] Hide and delay to enable mainly gnome based apps to launch

---
 src/Application.vala | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/Application.vala b/src/Application.vala
index de9ce27..995ce34 100644
--- a/src/Application.vala
+++ b/src/Application.vala
@@ -233,9 +233,16 @@ public class LightPadWindow : Widgets.CompositedWindow {
                         if (this.filtered.get (app_index)["terminal"] == "true") {
                             GLib.AppInfo.create_from_commandline (this.filtered.get (app_index)["command"], null, GLib.AppInfoCreateFlags.NEEDS_TERMINAL).launch (null, null);
                         } else {
-                            new GLib.DesktopAppInfo.from_filename (this.filtered.get(app_index)["desktop_file"]).launch (null, null);
+                            var context = new AppLaunchContext ();
+                            new GLib.DesktopAppInfo.from_filename (this.filtered.get(app_index)["desktop_file"]).launch (null, context);
                         }
-                        this.destroy ();
+                        this.hide();
+                        GLib.Timeout.add_seconds (3, () => {
+                            // allow some time before quitting to allow dbusactivatable apps to be launched
+                            this.destroy ();
+
+                            return GLib.Source.REMOVE;
+                        });
                     } catch (GLib.Error e) {
                         warning ("Error! Load application: " + e.message);
                     }
-- 
2.32.0
libredeb commented 2 years ago

@fossfreedom thank you for the contribution. I've very busy lately with my main work. I'll try to fix this issue as soon as possible. Regards!

libredeb commented 2 years ago

We need investigate in more deep DBus activatable features... thank @fossfreedom for the example code of Budgie Desktop... DBus things will be features for next major release. For now, I implemented you temporary patch. Thank you!