2

I am creating Xampp desktop launcher on my Linux Mint 19 and I have very interesting problem.

When I run this from terminal:

pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY /opt/lampp/manager-linux-x64.run &

everything works correctly, XAMPP control panel opens.

But when I have launcher (I want to create icon for desktop) with code:

#!/usr/bin/env xdg-open
[Desktop Entry]
Comment=Start or Stop XAMPP
Name=XAMPP Control Panel
Exec=pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY sudo /opt/lampp/manager-linux-x64.run 
Icon[en_US]=/usr/share/icons/Humanity/devices/24/network-wired.svg
Encoding=UTF-8
Terminal=false
Name[en_US]=XAMPP Control Panel
Comment[en_US]=Start or Stop XAMPP
Type=Application
Icon=/opt/lampp/htdocs/favicon.ico

It prompts me for password but the window never opens. I tried various scripts and this one works in launcher:

#!/usr/bin/env xdg-open
[Desktop Entry]
Comment=Start or Stop XAMPP
Name=XAMPP Control Panel
Exec=**sudo /opt/lampp/manager-linux-x64.run**
Icon[en_US]=/usr/share/icons/Humanity/devices/24/network-wired.svg
Encoding=UTF-8
Terminal=**true**
Name[en_US]=XAMPP Control Panel
Comment[en_US]=Start or Stop XAMPP
Type=Application
Icon=/opt/lampp/htdocs/favicon.ico 

XAMPP control panel window opens but also the terminal that started it.

How can I create launcher that only opens the XAMPP control panel window without additional terminal?

4
  • Does your .desktop file work as expected if you remove the & from the command? Like this: Exec=pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY sudo /opt/lampp/manager-linux-x64.run
    – terdon
    Nov 9, 2018 at 10:21
  • no it only prompts window for password (as the command with & included) and after typing password nothing happens. I am using Linux Mint 19 Nov 9, 2018 at 10:23
  • Exec= defines an executable, it's not a shell interpreter. Use sh -c "blabla", if you wanna use shell. Nov 9, 2018 at 10:25
  • great it works now! I kind of knew that the problem will not be in the command but in the way how linux processes it Correct code to the desktop launcher is: sh -c "pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY sudo /opt/lampp/manager-linux-x64.run" Nov 9, 2018 at 10:28

2 Answers 2

2

Correct code to the desktop launcher:

#!/usr/bin/env xdg-open
[Desktop Entry]
Comment=Start or Stop XAMPP
Name=XAMPP Control Panel
Exec=sh -c "pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY sudo /opt/lampp/manager-linux-x64.run"
Icon[en_US]=/usr/share/icons/Humanity/devices/24/network-wired.svg
Encoding=UTF-8
Terminal=false
Name[en_US]=XAMPP Control Panel
Comment[en_US]=Start or Stop XAMPP
Type=Application
Icon=/opt/lampp/htdocs/favicon.ico
1
  • out of all these questions/answers, i found you, the answer.
    – R T
    Jun 21, 2019 at 6:14
0

I have used JQL/com.ubuntu.pkexec.xampp.policy on my Ubuntu 19.04 and it works 100%. And of course for Ubuntu Menu Editor use Ubuntu Alacarte Menu Editor.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .