Issue
Hi I'm tryng to run an application by double click it in linux and I've read about .desktop file (I need to open by doble click because I've got to deploy the app on a Raspberry and users don't want to use terminal). This is what I've done so far:
desktop file:
[Desktop Entry]
Version=1.0
Type=Application
Name=CHRONOTERMOSTAT
Icon=../../../../../../home/gjcode/Scaricati/icons8-automazione-riscaldamento-48.png
Exec=sudo "../../../../../../home/gjcode/WebstormProjects/tlc-app/scripts/runAngular" %f
Exec="../../../../../../home/gjcode/WebstormProjects/tlc-app/scripts/runNode" %f
Exec="../../../../../../home/gjcode/WebstormProjects/tlc-app/scripts/openBrowser" %f
Comment=A chronotermostat for home automation
Categories=Application
Terminal=true
runAngular:
#!/bin/bash
cd ../ui
ng serve
runNode:
#!/bin/bash
cd ../broker
npm start
openBrowser:
#!/bin/bash
google-chrome http://localhost:4200
I'm running these files on ubuntu so I don't actually need to run angular on Raspberry, but I have to run node server. When I double click the browser is opened but none of node and angular seems to be started. When I run these scripts by a terminal everything work well. I've checked running permissions and everything is ok:
4 -rwxr-xr-x 1 gjcode gjcode 49 lug 3 16:35 openBrowser
4 -rwxr-xr-x 1 gjcode gjcode 31 lug 3 16:34 runAngular
4 -rwxr-xr-x 1 gjcode gjcode 36 lug 3 16:59 runNode
I've tested this approach by running a simple script and everything worked fine, so what am I doing wrong? How to double click and run node and open the browser?
Solution
I solved it on my own, and it was a problem with the path, for anyone who will face the same issue remember that EXEC use: home/username
as a working directory even though you put the file in usr/share/applications
so change the path accordingly.
Answered By - CodeRonin Answer Checked By - Gilberto Lyons (WPSolving Admin)