nwg-piotr / nwg-dock

GTK3-based dock for sway
MIT License
170 stars 9 forks source link

Some pinned desktop entries cannot be launched from dock due to command line parsing #14

Open supernintendo opened 3 years ago

supernintendo commented 3 years ago

Describe the bug Some desktop entries do not launch from nwg-dock due to how command line arguments are handled. Specifically, having the passed parameter %F in the Exec statement of a .desktop file along with other command line flags seems to prevent the application from launching.

To Reproduce Steps to reproduce the behavior:

  1. Open an application that supports %F as a parameter and pin to the dock (to reproduce this, I used code-oss).
  2. Update the desktop entry for that application (in my case /usr/share/applications/code-oss.desktop) to contain an Exec statement containing %F. For example Exec=/usr/bin/code-oss --enable-features=UseOzonePlatform --ozone-platform=wayland --unity-launch %F.
  3. Close the application.
  4. Try to re-open it from the dock. If nwg-dock is started from a terminal the following debugging statement is logged, indicating that the actual command name has been truncated. env vars: ["--enable-features=UseOzonePlatform --ozone-platform=wayland]; command: '--unity-launch'; args: []

Expected behavior nwg-dock should launch the application with all command line flags intact.

Desktop (please complete the following information):

Additional context The same desktop entry launches from gtk-launch, bemenu, etc. just fine. I'm not sure if there's another way to format my Exec statement to make this work or if nwg-dock is just tripping up on just %F or all passed parameters, but I thought I'd report this anyway. I haven't written any Go in forever but when I have some time I might be able to track down the bug and submit a PR if you're too busy. Thanks. :)

nwg-piotr commented 3 years ago

Running external commands in golang sucks, as you can not give env vars and the command together. I'll try to improve parsing, as soon as I'm back from holiday (after 13rd Aug).