Skip to content

Shortcut Linux

HiroYokoyama edited this page Nov 10, 2025 · 3 revisions

Guide to Creating Shortcuts and File Associations on Linux

1. Creating the .desktop Entry File (moleditpy.desktop)

First, create the application launcher's definition file (.desktop file). Open a text editor and save the following content as moleditpy.desktop.

[Desktop Entry]
Type=Application
Version=1.0
Name=MoleditPy
Exec=[Full path to moleditpy executable]
Terminal=true
Icon=[Path to site-packages]/moleditpy/assets/icon.png

Field Descriptions:

  • Name: The name displayed in the application menu or as the shortcut name.
  • Exec: The command or full path to launch the application. (See details below)
  • Icon: The full path to the icon file to be displayed.
  • Terminal: Whether to run the application in a terminal (black screen). Specify true or false.
  • Type: Specify Application.

2. Verifying the Executable (Exec) and Icon (Icon) Paths

To make the .desktop file function correctly, you must modify the Exec= and Icon= paths to match your environment.

Exec (Executable File) Path

Specifying the full path to the moleditpy executable in the Exec= field is the most reliable method.

How to find the path:

  1. Open a terminal.
  2. Type which moleditpy and press Enter.
  3. Copy the displayed full path.
  4. Rewrite the Exec= line in your .desktop file with the copied path.

Note: It is possible to use just the executable name (e.g., Exec=moleditpy), but this requires the executable to be located in a directory included in your $PATH environment variable. Specifying the full path is less dependent on the environment.

Icon (Icon) Path

Specify the full path to the icon file (.png or .svg). If moleditpy is installed as a Python package, a common path structure would be:

[Path to site-packages]/moleditpy/assets/icon.png

Replace [Path to site-packages] to match your environment (e.g., /home/YOUR_USERNAME/.local/lib/pythonX.X/site-packages).


3. Placing the Launcher (Registering in the Application Menu)

By placing the created moleditpy.desktop file in the appropriate directory, MoleditPy will appear in your application menu (launcher).

A. For the Current User Only (Recommended)

This will add the launcher to the menu for the current user only.

  1. Open your file manager and enter the following path in the address bar:
    ~/.local/share/applications/
    
    (~ signifies your home directory)
  2. Copy or move your moleditpy.desktop file into this folder.

B. For All Users (Requires administrator privileges)

This will add the launcher to the menu for all users on the PC.

  1. Access the following path (requires administrator privileges):
    /usr/share/applications/
    
  2. Place the moleditpy.desktop file in this folder.

After placing the file, your desktop environment may recognize it automatically. If not, try logging out and logging back in.


4. Creating a Desktop Shortcut

Once registered in the application menu (Step 3), you can create a desktop shortcut by dragging and dropping the icon from the menu onto your desktop.

Note: Depending on your desktop environment, when you first execute (double-click) the .desktop file copied to your desktop, you may be asked to "trust" it or "mark as trusted" before it can be launched.


Clone this wiki locally