3

Thunar has an option when right-clicking the desktop to create desktop-files/launchers.

enter image description here

enter image description here

Is there a command behind this GUI that could be used in other contexts?

2 Answers2

4

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.

  1. Start a terminal
  2. Run xwininfo and click in the window you are interested in, note the "Window id"
  3. Run xprop -id XXXX | grep PID where XXXX is from xwininfo, note the PID
  4. Run ps aux | grep XXXX where XXXX is the PID from xprop

On Xfce, the program is:

exo-desktop-item-edit --display=:0.0 --create-new --type Application file:///home/$USER/Desktop
Silas Parker
  • 253
  • 1
  • 5
  • I know what are and how desktop files work. I am strictly referring to the GUI from my second image. Possibly that is a GUI for `xdg-desktop-icon`. I want a command that could start that GUI. –  Nov 29 '17 at 15:36
  • 1
    @cipricus I've edited the answer to explain how to find the command for an X window. – Silas Parker Nov 29 '17 at 16:00
  • That's exactly what I was looking for. Now I can use that command in the file `/.local/share/applications/Create new desktop launcher.desktop` and create such launchers outside Xfce/Thunar, or I can add it in other file mansagers like Nautilus or PCManFM. –  Nov 29 '17 at 17:53
  • 1
    To create an application launcher in `/.local/share/applications` that can be searched and launched with a tool like Synapse, Dash, Whiskermenu, Krun etc (instead of one one the Desktop), the command is `exo-desktop-item-edit --display=:0.0 --create-new --type Application file:///home/$USER/.local/share/applications`. –  Nov 29 '17 at 18:07
2

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'.

cipricus
  • 1,386
  • 13
  • 42