freedesktop-desktop-entry icon indicating copy to clipboard operation
freedesktop-desktop-entry copied to clipboard

Add an API to launch desktop entries

Open oknozor opened this issue 2 years ago • 9 comments

Related to https://github.com/pop-os/launcher/pull/119

This PR add a a method to launch desktop entries either via dbus or shell commands.

When launching an entry with the prefer_non_default_gpu option, the discrete gpu should be used either by passing the corresponding environment variables to the sub shell or via dbus.

I am not 100% confident regarding the gpu implementation since I don't have every hybrid graphics laptop available (only AMD discrete and integrated gpus), feedback would be appreciated here.

There are fake desktop entries launching glxgears -info in the ignored tests, this should be enough to test the expected gpu is used. (see https://github.com/oknozor/freedesktop-desktop-entry/blob/33f2d16b731ed80258959b2bd859fc3056d52441/src/exec/mod.rs#L252)

For the implementation to be complete we would need a launch_action method. I'll implement this after this PR has been reviewed.

oknozor avatar Jun 02 '22 12:06 oknozor

Just added desktop entry actions, let me know if anything needs to be changed.

oknozor avatar Jun 06 '22 09:06 oknozor

Seems fine, but should we also support async zbus calls?

mmstick avatar Jun 06 '22 13:06 mmstick

We could easily add an async api with zbus async calls and tokio::process instead of std::process. I am not sure if this would be useful though. Most of the time you just want to launch one entry and exit.

oknozor avatar Jun 06 '22 16:06 oknozor

@mmstick is there something more I can do ?

oknozor avatar Jun 15 '22 06:06 oknozor

Has this been integrated into the pop-launcher/pop-shell PR?

mmstick avatar Jun 15 '22 14:06 mmstick

Hey! Is this ready to merge yet? Would love to use it.

jakeisnt avatar Jan 07 '23 17:01 jakeisnt

@mmstick - Is this ready to go? I've been using this - it's worked well. Would love to have an official release.

jakeisnt avatar May 11 '23 19:05 jakeisnt

FWIW - I don't use this library for launching apps directly and would like such feature to live under a "feature" to avoid any extra dependency.

(Though I'm not sure if this repository is still maintained.)

liias avatar Mar 03 '24 11:03 liias

This library is maintained. It is a dependency of the COSMIC desktop.

mmstick avatar Mar 03 '24 12:03 mmstick