.desktop file in Ubuntu that launches a Python script
Here we will make two
.desktop files that will launch Pupil Capture and Pupil Player.
- Right click on your desktop and create a new empty document.
- Set the document file type by Renaming the document that ends with
- Drag the document into a text editor and edit the document with the example code below
Note: Change the
X-Icon-Path to the icon you want to use and Exec
path to where Pupil Capturemain.py` is located on your machine (see example pupil.desktop for reference)
[Desktop Entry] Name=Pupil Capture Version=v0.8.5 Icon=pupil-capture X-Icon-Path=/path/to/icon/file/ Exec=python /path/to/py/file/main.py Terminal=false Type=Application
Option - you can use
Terminal=true to launch the terminal if desired.
In the terminal set the permissions of the desktop file to be executable by typing this:
chmod u+x path/to/py/file/main.py
Right click on the new empty document and in the Permissions tab, set the
allow executing file as program.