Sorry the dumb question but i dont find the answer.
I have a program .py that of course i can run from a terminal like “python app.py” but i dont want to go to a terminal, go to the “directory”, etc.
How i can make these?
If you want an icon on the desktop to double click to run, create a .desktop file.
I’m using XFCE. What I would do:
- Right click the desktop
- Select Create Launcher
- Complete the dialog
For the “Command” line, click the button on the right to open the File Dialog so the program can be easily selected. Click “Run in Terminal” if required.
Now a new .desktop file is on the user’s desktop. You can right click the desktop launcher and select Properties or double click to run it. The actual file resides in
$HOME/Desktop. .desktop files are an XDG standard so all desktops (GNOME, XFCE, KDE…) implement it. The “how” varies but the concepts are the same, mostly.
If I needed the launcher in the menu (in my case since I use XFCE, it is the Whisker Menu), I would:
- Right click the menu
- Select Edit Applications
- Position myself in the menu tree where I wanted the new launcher. There are up and down arrows so I could reposition the launcher someplace else in the menu tree later.
- Click the “+” in the top menu to add a new launcher.
- Complete the dialog
- Test launcher
- Save the launcher
The actual .desktop file will reside in
$HOME/.local/share/applications. You can view or edit the file, but using the tools provided make it a little easier to get started.
- Desktop Entries at archlinux
- Desktop files: putting your application in the desktop menus at gnome
- XDG Desktop Entry Specification at freedesktop
To add a little more info that may be helpful:
Exec line in the desktop file should be:
or if it’s an installed Python module:
Exec=python -m python-script.py
Python scripts with
#!/usr/bin/python can be run directly if it is marked as executable just as you would any shell script.
This makes it a piece of cake to create a launcher which can be used in the menu system or from the desktop - place the launcher in ~/.local/share/applications - and it will appear in your menu system
[Desktop Entry] Name=My Python script Comment=Your Comment for your Python script Exec=/path/to/script.py Icon=python Type=Application
Thanks to all.
Is working perfect!!!
This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.