Friday, January 26, 2018

bash - Qmlscene from Launcher Icon



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?




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

No comments:

Post a Comment

11.10 - Can't boot from USB after installing Ubuntu

I bought a Samsung series 5 notebook and a very strange thing happened: I installed Ubuntu 11.10 from a usb pen drive but when I restarted (...