1

First, I followed this answer to modify the file mimeapps.list.

How do I set IDLE as the default editor for Python scripts?

It works, but not perfect because everytime I right click .py file--select "Open With IDLE"--a python shell shows alongside the editor.

the following picture show the result of opening two .py files. enter image description here

Thanks in advance. enter image description here enter image description here

Update, as the IDLE appears in right-click menu, I donot run the commands:gksudo gedit /usr/share/applications/idle.desktop and Exec=/usr/bin/idle -n %f (no need to do this)

tcpiper
  • 153

1 Answers1

1

Change the /usr/share/applications/idle.desktop file so at the Exec line it reads:

Exec=/usr/bin/idle -en

Or the better way would be to copy that file to ~/.local/share/applications and modify it there similarly, so after an update you won't have to reapply the changes.

But the above will modify IDLE-s opening behaviour even when you open it simply from the Dash/Launcher. If you don't want that, then you would have to make a copy of the idle.desktop file in the same directory (/usr/share/applications/ or ~/.local/share/applications/) , name it e.g idle.other.desktop, and modify the Exec line in that one, and also add a new line with the following content:

NoDisplay=true

Then modify your mimeapps.list file, so the text/x-python= line reads:

text/x-python=idle.other.desktop;
falconer
  • 15,334