From 4763c674d01ccfc6d50ba4bcd5e38741605052e0 Mon Sep 17 00:00:00 2001
From: Albert Graef <aggraef@gmail.com>
Date: Tue, 20 Aug 2019 00:12:03 +0200
Subject: [PATCH] Invoke desktop actions via /bin/sh.

We do this to prevent extra arguments to be passed from the DE.

At least on KDE, it seems that the desktop file itself gets passed if the
action is invoked by right-clicking the icon on the desktop (this doesn't
happen with panel icons). Maybe this is a bug in KDE, but we need to prevent
this, because otherwise Purr Data tries to open the desktop file as a patch,
which of course will cause a bunch of ugly error messages in the main window.
---
 packages/linux_make/pd-l2ork-debug.desktop     | 6 +++---
 packages/linux_make/pd-l2ork-k12-debug.desktop | 6 +++---
 packages/linux_make/pd-l2ork-k12.desktop       | 6 +++---
 packages/linux_make/pd-l2ork.desktop           | 6 +++---
 4 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/packages/linux_make/pd-l2ork-debug.desktop b/packages/linux_make/pd-l2ork-debug.desktop
index 931efd470..f98550c25 100755
--- a/packages/linux_make/pd-l2ork-debug.desktop
+++ b/packages/linux_make/pd-l2ork-debug.desktop
@@ -11,15 +11,15 @@ MimeType=application/x-puredata;
 
 [Desktop Action ALSA]
 Name=ALSA
-Exec=pd-l2ork -rt -alsa -audiobuf 20 -d 3 %U
+Exec=/bin/sh -c "pd-l2ork -rt -alsa -audiobuf 20 -d 3 %U"
 TargetEnvironment=Unity
 
 [Desktop Action JACK]
 Name=JACK
-Exec=pd-l2ork -rt -jack -audiobuf 20 -d 3 %U
+Exec=/bin/sh -c "pd-l2ork -rt -jack -audiobuf 20 -d 3 %U"
 TargetEnvironment=Unity
 
 [Desktop Action ForceQuit]
 Name=Force Quit Pd-L2Ork
-Exec=/usr/bin/killall pd-l2ork pd-gui
+Exec=/bin/sh -c "/usr/bin/killall pd-l2ork pd-gui"
 TargetEnvironment=Unity
diff --git a/packages/linux_make/pd-l2ork-k12-debug.desktop b/packages/linux_make/pd-l2ork-k12-debug.desktop
index c1088afca..f76a5dd15 100755
--- a/packages/linux_make/pd-l2ork-k12-debug.desktop
+++ b/packages/linux_make/pd-l2ork-k12-debug.desktop
@@ -11,15 +11,15 @@ MimeType=application/x-puredata;
 
 [Desktop Action ALSA]
 Name=ALSA
-Exec=pd-l2ork -k12 -noautopatch -rt -alsa -audiobuf 20 -d 3 %U
+Exec=/bin/sh -c "pd-l2ork -k12 -noautopatch -rt -alsa -audiobuf 20 -d 3 %U"
 TargetEnvironment=Unity
 
 [Desktop Action JACK]
 Name=JACK
-Exec=pd-l2ork -k12 -noautopatch -rt -jack -audiobuf 20 -d 3 %U
+Exec=/bin/sh -c "pd-l2ork -k12 -noautopatch -rt -jack -audiobuf 20 -d 3 %U"
 TargetEnvironment=Unity
 
 [Desktop Action ForceQuit]
 Name=Force Quit Pd-L2Ork
-Exec=/usr/bin/killall pd-l2ork pd-gui
+Exec=/bin/sh -c "/usr/bin/killall pd-l2ork pd-gui"
 TargetEnvironment=Unity
diff --git a/packages/linux_make/pd-l2ork-k12.desktop b/packages/linux_make/pd-l2ork-k12.desktop
index 077520048..d2571b7a9 100755
--- a/packages/linux_make/pd-l2ork-k12.desktop
+++ b/packages/linux_make/pd-l2ork-k12.desktop
@@ -11,15 +11,15 @@ MimeType=application/x-puredata;
 
 [Desktop Action ALSA]
 Name=ALSA
-Exec=pd-l2ork -k12 -noautopatch -rt -alsa -audiobuf 20 %U
+Exec=/bin/sh -c "pd-l2ork -k12 -noautopatch -rt -alsa -audiobuf 20 %U"
 TargetEnvironment=Unity
 
 [Desktop Action JACK]
 Name=JACK
-Exec=pd-l2ork -k12 -noautopatch -rt -jack -audiobuf 20 %U
+Exec=/bin/sh -c "pd-l2ork -k12 -noautopatch -rt -jack -audiobuf 20 %U"
 TargetEnvironment=Unity
 
 [Desktop Action ForceQuit]
 Name=Force Quit Pd-L2Ork
-Exec=/usr/bin/killall pd-l2ork pd-gui
+Exec=/bin/sh -c "/usr/bin/killall pd-l2ork pd-gui"
 TargetEnvironment=Unity
diff --git a/packages/linux_make/pd-l2ork.desktop b/packages/linux_make/pd-l2ork.desktop
index 5f6528cea..e3a43e8e8 100755
--- a/packages/linux_make/pd-l2ork.desktop
+++ b/packages/linux_make/pd-l2ork.desktop
@@ -11,15 +11,15 @@ MimeType=application/x-puredata;
 
 [Desktop Action ALSA]
 Name=ALSA
-Exec=pd-l2ork -rt -alsa -audiobuf 20 %U
+Exec=/bin/sh -c "pd-l2ork -rt -alsa -audiobuf 20 %U"
 TargetEnvironment=Unity
 
 [Desktop Action JACK]
 Name=JACK
-Exec=pd-l2ork -rt -jack -audiobuf 20 %U
+Exec=/bin/sh -c "pd-l2ork -rt -jack -audiobuf 20 %U"
 TargetEnvironment=Unity
 
 [Desktop Action ForceQuit]
 Name=Force Quit Pd-L2Ork
-Exec=/usr/bin/killall pd-l2ork pd-gui
+Exec=/bin/sh -c "/usr/bin/killall pd-l2ork pd-gui"
 TargetEnvironment=Unity
-- 
GitLab