Thunar has an option when right-clicking the desktop to create desktop-files/launchers.
Is there a command behind this GUI that could be used in other contexts?
This is just creating a .desktop file in the ~/Desktop folder.
You can create these files manually with a text editor or using any other program that can write an INI style file.
A .desktop file can be also be installed with the xdg-desktop-icon tool.
Edit
To find the process that has created a window under X.
xwininfo and click in the window you are interested in, note the "Window id"xprop -id XXXX | grep PID where XXXX is from xwininfo, note the PIDps aux | grep XXXX where XXXX is the PID from xpropOn Xfce, the program is:
exo-desktop-item-edit --display=:0.0 --create-new --type Application file:///home/$USER/Desktop
As a complement based on the first answer and its comments:
For a Thunar action in order to create a launcher in the current directory: open Thunar, select 'Edit - Configure custom actions', add the command:
sh -c 'exo-desktop-item-edit --create-new --type Application .'
The last dot (.) specifies the current directory as location for the creation of the file. (Source link.)
Under "Appearance conditions" check 'Directories'.