How to set app icon in the .desktop file of an Ubuntu Touch application?

There are two things wrong with how you're doing things.

Fist of all, .desktop files are intended for installed apps, not for running via Ctrl+R. To install your app, you need to package it and install the package. You can find more details about packaging your app and publishing it in the Click App Store here.

Second of all, the paths you have in the .desktop should be local files, not absolute paths. Here is an example of a .desktop file:

[Desktop Entry]
Name=Tasks
Comment=Your tasks, every device, everywhere.
Exec=qmlscene $@ ubuntu-tasks.qml
Icon=ubuntu-tasks.png
Terminal=false
Type=Application
X-Ubuntu-Touch=true

A couple of things to note:

  • The Exec line should be in the format of qmlscene $@ <file.qml>, with just the name of your main QML file, no directory information.

  • The Icon line should be in the form of Icon=<icon.png>, with just the file name (including the extension), no directory information.

Now the information I've provided above is for running your app on an Ubuntu Touch device by packaging it in a Click package. Click packages are intended for Ubuntu Touch and currently don't integrate with the Unity desktop. So, if you want to be able to run your app from the Dash/Launcher and also see its icon, you will need to do two things:

  1. Copy your .desktop file to ~/.local/share/applications and use an absolute path to your icon instead of just the file name, as you would when packaging the app.

  2. Copy your icon to ~/.icons