OPTION 1:
Edit your $HOME/.local/share/applications/mimeapps.list
if you want such association to be only applied for your user.
Add the following lines:
[Default Applications]
text/x-python=idle.desktop
[Added Associations]
text/x-python=idle.desktop;
Note, if you want the .py
association for all users the file to modify is (using sudo
):
/usr/share/applications/defaults.list
OPTION 2:
To set up IDLE as the default editor you'll have to make the idle.desktop file visible in the "Open with" list. To to so edit this file using sudo:
sudo gedit /usr/share/applications/idle.desktop
And replace its content by the following lines:
[Desktop Entry]
Name=IDLE
Comment=Integrated Development Environment for Python
Exec=/usr/bin/idle %F
Icon=/usr/share/pixmaps/idle.xpm
Terminal=false
Type=Application
Categories=Application;Development;
MimeType=text/x-python;
StartupNotify=true
Needless to restart your session or computer, to set the default application for the python type, locate a file of that type (*.py) in the file manager, right-click it, and select Properties.
Click the "Open With" tab and select the application you want to use for that file type.
Use the Set as default button to make the application the default application.
From now, clicking on a python file should open your preferred editor.