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)

1
  • AFAIK this is the normal IDLE behavior, it even opens the shell on Windows. Dec 26, 2013 at 7:36

1 Answer 1

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;
3
  • I am not sure what idle.desktop is and how to edit it. I only find IDEL in /usr/share/applications. and I make a copy IDLE.other ,and run command gksudo gedit /usr/share/applications/idle.other.desktop, but only open a blank file, while gksudo gedit /usr/share/applications/idle.desktop can open a file with some setting options in it. why?
    – tcpiper
    Dec 26, 2013 at 15:17
  • as open idle.other getting a blank file, there is no way for me to add NoDisplay=true
    – tcpiper
    Dec 26, 2013 at 15:21
  • I can see it on your screenshot. There is an icon with the name IDLE, that is the idle.desktop file, but nautilus hides its extension. If you use terminal to check that directory, you will see. You have to open and edit that file with a text editor.
    – falconer
    Dec 26, 2013 at 15:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .