Solved qt 4.8 application launcher icon - ubuntu 14.04
-
Hi all,
i want to use application launcher icon in my desktop app.
i do look over this Link but unable to tackle, i feel lost somewhere. kindly suggest me correct way to do it.i can share demo code if you guys want
-
@Anas_Deshmukh said in qt 4.8 application launcher icon - ubuntu 14.04:
i feel lost somewhere
You need to specify where you are lost, otherwise we can't help ;-)
My recommendations:
- take a look at linuxdeployqt https://github.com/probonopd/linuxdeployqt Not sure if it works with such ancient Qt version as 4.8
- consider switching to newer Qt version
- consider switching to newer OS
-
This is pretty easy, just create a .desktop file for your application and install it either system wide in /usr/share/applications or for the single user in ~/.local/share/applications.
It should look something like this:
[Desktop Entry] Name=Your Application Friendly Name GenericName=ShortAppName Type=Application Comment=My super cool app that does cool things Exec=/path/to/your/app Icon=/path/to/your/icon.png
Then let's assume your app is called,
someapp
and your desktop file will besomeapp.dekstop
, you then just dosudo cp someapp.desktop /usr/share/applications
to install it system wide (notice you need root permissions for this), orcp someapp.desktop ~/.local/share/applications/
for the local user, no root required.I usually mix this into my installer for my application. Usually in a bash script that looks something like (note this is just a portion of my install script, use as a reference only):
if [ -e $ddfile ] && [ ! -n $OVERWRITE ] then echo "fail, $ddfile exists, not overwriting, use ./INSTALL --overwrite" else # make .desktop file echo "[Desktop Entry]" > $ddfile echo "Name=My App" >> $ddfile echo "GenericName=MyApp" >> $ddfile echo "Type=Application" >> $ddfile echo "Comment=Description of MyApp" >> $ddfile echo "Path=$installpath/myapp" >> $ddfile echo "Exec=$installpath/myapp/myapp" >> $ddfile echo "Icon=myapp" >> $ddfile echo "Terminal=false" >> $ddfile chmod 644 $ddfile echo "done" fi
My Icon in this is set just to
myapp
, this is because myapp.png was installed in /usr/share/pixmaps so it doesn't need the full path. Likewise you can use ~/.local/share/pixmaps if installed user specific.Edit: just as a warning, some window managers don't pick up these changes immediately. So if that happens where it doesn't recognize your .desktop file in the launcher right away, then just restart your wm. Gnome and KDE tend to see it right away but I can't say that for the other wms.
-
@ambershark thank you for update, i will revert you soon. i am lil busy with other task as of now. will resume this thread again.
-
@ambershark thank you for suggestion. It work smooth.
-
Hi @Anas_Deshmukh,
thanks for the feedback. Please mark this topic as SOLVED then.