1

I'm currently developing an application just for myself on Ubuntu desktop using Ubuntu SDK. I've been trying to make an executable on the desktop/launcher to start the application from the desktop.

I've created an icon that can be run as an executable and on the command under Properties->Command on the launcher I've put:

qmlscene ~/file/path/main.qml

When entered into the terminal this same way, the application starts how I would like it to. But when launched from the desktop icon, only qmlscene pops up that I then have to manually follow the path to main.qml

Does anyone know how to correctly launch an application from the launcher icon?

1

You need to use $HOME instead of ~ (tilde).

Tilde is bash specific. In bash tilde automatically expands to the $HOME value.

It has no special meaning, except for bash. See the bash manual for further details about tilde expansion.

Your launcher Exec command should be:

Exec=bash -c "qmlscene $HOME/file/path/main.qml"

Edit: My test launcher

[Desktop Entry]
Name=Myapp
Comment=Myapp
Exec=bash -c "qmlscene $HOME/foo.qml"
Terminal=false
Type=Application
Categories=Qt;
TargetEnvironment=Unity
StartupWMClass=do-not-directly-run-firestorm-bin
StartupNotify=true
  • So I've created a new .desktop file with the new Exec=qmlscene $HOME/file/path/main.qml, but it still only opens to the home directory to let me manually find the .qml file. – QandA Sep 11 '14 at 14:27
  • @QandA I've updated my answer to include a bash command, please try this version – Sylvain Pineau Sep 11 '14 at 14:43
  • This instead just gives me an error: "There was an error launching the application". Does the command/exec run like it would in a terminal (except for the differences in ~ and $HOME)? – QandA Sep 11 '14 at 15:06
  • @QandA: Could you please adapt to your path my sample launcher? – Sylvain Pineau Sep 11 '14 at 15:09
  • Wow! Thank you so much! It does directly open the qml file now. I'm not sure why it works now though. Before I did not include TargetEnvironment,StartupWMClass, or StartupNotify. – QandA Sep 11 '14 at 15:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.