check out this module of mine...
There's not docs so study the code.
it lets you make either a desktop icon or a menu item.
Here is how i use it...
Just drop the MakeIcon.module into your .src folder
the main command of the module is MakeMe()
MakeMe(Optional name As String = "", Optional icn As Image = Null, Optional comment As String = "", Optional menuCats As String = "", Optional Prefix As String = "gbr3", Optional UseRoot As Boolean = False)
name = Icon name
icn = icon image
menuCats = the menu categories, if null a desktop icon is made
prefix = what's put before the exe path (like gbr3)
(if you want your app to run as root set prefix to "pkexec gbr3")
(providing you have added gbr3 to pkexec rules see my app
https://forum.gambas.one/viewtopic.php?f=13&t=883 on how to do that)
(or try my app groot
https://forum.gambas.one/viewtopic.php?f=13&t=921)
(NOTE: those forum topics have old and updated versions, scroll to the last posts to get the links to the latest.)
useroot = if true icon is made for root otherwise for normal user
Public Sub btnMakeLauncher_Click()
Dim sRes As Integer = Message.Question("Make a desktop Icon or a menu Launcher?", "Desktop", "Menu", "Cancel")
If sRes = 3 Then Return
If sRes = 1 Then
MakeIcon.MakeMe("ScriptEd", FMain.Icon.Image, "ScriptEd script editor")
Else
MakeIcon.MakeMe("ScriptEd", FMain.Icon.Image, "ScriptEd script editor", "Application;Editor;Tools;Development;Programming")
Endif
End
this function exists in my ScriptEd text editor, my gambas updaters, (and probably some other progs)
PS. it also adds a right click option (when icon is in a panel) to use gtk/qt gui environments (like the gambas3 icon does)
if you don't want that then change the following code...
s &= "StartupNotify=True\nActions=QT4;QT5;GTK;GTK3\n\n"
"[Desktop Action QT4]\nName=GB_GUI QT4\nExec=env GB_GUI=gb.qt4 " & Prefix & " '" & MyFullPath(True) & "'\n\n"
"[Desktop Action QT5]\nName=GB_GUI QT5\nExec=env GB_GUI=gb.qt5 " & Prefix & " '" & MyFullPath(True) & "'\n\n"
"[Desktop Action GTK]\nName=GB_GUI GTK2\nExec=env GB_GUI=gb.gtk " & Prefix & " '" & MyFullPath(True) & "'\n\n"
"[Desktop Action GTK3]\nName=GB_GUI GTK3\nExec=env GB_GUI=gb.gtk3 " & Prefix & " '" & MyFullPath(True) & "'\n"
To...
s &= "StartupNotify=True\n"