This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: IDLE: On macOS, Command-M minimizes & opens "Open Module..."
Type: behavior Stage: resolved
Components: IDLE Versions: Python 3.8
process
Status: closed Resolution: duplicate
Dependencies: Superseder: IDLE macOS: Some Command shortcuts do not work correctly
View: 21359
Assigned To: terry.reedy Nosy List: ned.deily, taleinat, terry.reedy, wordtech
Priority: normal Keywords:

Created on 2018-10-29 11:30 by taleinat, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
command-M.gif taleinat, 2018-10-29 11:30
Messages (12)
msg328802 - (view) Author: Tal Einat (taleinat) * (Python committer) Date: 2018-10-29 11:30
On macOS, Command-M simultaneously minimizes the window and opens the "Open Module..." dialog. This happens with a very confusing sequence of visual effects (see attached animated gif).

This doesn't happen when activating either of the menu items; only when using the keyboard shortcut.

Tested with current master (3.8.0a0, 53835e92d3).
msg328832 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2018-10-29 14:18
What I see in the .gif is that Open Module is open on top of Shell (not minimized, traffic lights gray) and that clicking Cancel closes Open Module and temporarily minimizes Shell, before it pops back up with traffic lights.  It is hard to imagine that how one opens Open Module changes its close behavior.

With 3.7.1rc1, with unreleased tk patches, Command-M immediately after opening IDLE (Shell) closes IDLE.  A window pops up offering to send a report to Apple, or to re-open.  'Re-open' does not work.  After opening another window, I see Shell minimize and pop back with the traffic lights gray.  Both Cancel and Escape have the effect in the gif.  Clicking OK with a valid module name does the same and opens the module.

In summary, using Command-M either crashes IDLE or causes the change in traffic lights to be accompanied by minimizing and restoring.

Kevin, another weird tkinter/tk Mac behavior.
msg328840 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2018-10-29 15:51
AFAICT, the problem here is that there is a duplicate command accelerator assignment: IDLE assigns CMD-M to its Open Module command (https://github.com/python/cpython/blob/master/Lib/idlelib/config-keys.def#L205) but either Tk or the underlying macOS services it uses already use CMD-M to mean "minimize the front window to the Dock" (https://support.apple.com/en-us/HT201236).  You can see in the IDLE menu bar where CMD-M shows up in the Window menu stack (with Minimize) but not in the the File stack (where Open Module is).  Since CMD-M has a commonly used system-wide meaning, it would probably be best to change IDLE's Open Module to use something else.
msg329156 - (view) Author: Tal Einat (taleinat) * (Python committer) Date: 2018-11-02 19:47
I agree with Ned's analysis. The shortcut for macOS should be changed, or simply removed if there's no good candidate for a shortcut.

Terry, what do you suggest?
msg329158 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2018-11-02 20:06
I routinely use Alt-M to open modules on Windows, so I would want a shortcut on Mac also.  I just made a 'Mac-module' custom keyset with Control-Key-M for open-module, and it works.  It that acceptable?

We do not usually change default keysets, but this amounts to a bugfix in relation to current MacOS.  I would add it to the IDLE section of What's New.

Ned, is the system use of CMD-M newer than IDLE's (15 years?)?
msg329162 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2018-11-02 20:31
> is the system use of CMD-M newer than IDLE's (15 years?)?

macOS has been using CMD-M for minimize for quite a while.  It's listed in the current Apple "Human Interface Guidelines" which is the reference document that Apple itself and third-parties are strongly encouraged to follow (sort of the PEP 8 for macOS UIs).  It's probably a good idea for anyone working on the IDLE UI to read through the macOS section at least once.

Note that they discourage the use of the Control key as a modifier and they also encourage the use of the Shift key as a secondary modifier "when a shortcut complements another shortcut".  Following those suggestions, perhaps a better choice for "Open Module" would be Shift-Command-O (complementing "Open File" Command-O), if it isn't already being used by IDLE.

https://developer.apple.com/design/human-interface-guidelines/macos/user-interaction/keyboard/
msg329163 - (view) Author: Tal Einat (taleinat) * (Python committer) Date: 2018-11-02 20:44
Indeed Command-M has been in use for a while.

+1 for Shift-Command-o. I don't see it used in the default key config (Lib/idlelib/config-keys.def).

We already use Shift-Command-s for "Save As...", so this would be a consistent use of a Shift-Command modifier.
msg329165 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2018-11-02 20:47
I like the idea, but for me, Shift-Command-o does the same as Command-o -- open file, and setting open-module to shift-command-key-o does not override this.
msg329166 - (view) Author: Tal Einat (taleinat) * (Python committer) Date: 2018-11-02 20:48
Terry, does Shift-Command-s trigger "Save" or "Save As" for you? If "Save As", then surely this is something that can be worked out?
msg329654 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2018-11-11 00:34
#21359, reported by Ned in 4/2018, is about "Cmd-Shift-Z, has the same effect as the Undo accelerator, Cmd-Z"  So there may be a general problem with Cmd-Shift == Cmd.
msg329687 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2018-11-11 20:58
That's a good point. I see that Cmd-Shift-S which is defined as the shortcut for "Save As.." seems to have the same effect as Cmd-S "Save".  Also, the Cmd-Opt-S shortcut for "Save Copy As.." seems to bring up the save dialog window twice, the second after the first closes.  I guess somebody should go through and try to see exactly which Tk events IDLE is seeing in these cases similar to what Ronald was doing while investigating Issue11055 (referenced in Issue21359).
msg352810 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2019-09-19 17:59
I am closing this as a duplicate of #21359 as I believe there is at least one more non-working shortcut and because I believe the solution is to test all and patch the default mac keyset all at once.
History
Date User Action Args
2022-04-11 14:59:07adminsetgithub: 79285
2019-09-19 17:59:51terry.reedysetstatus: open -> closed
superseder: IDLE macOS: Some Command shortcuts do not work correctly
messages: + msg352810

resolution: duplicate
stage: needs patch -> resolved
2018-11-11 20:58:44ned.deilysetmessages: + msg329687
2018-11-11 00:34:08terry.reedysetmessages: + msg329654
2018-11-02 20:48:59taleinatsetmessages: + msg329166
2018-11-02 20:47:20terry.reedysetmessages: + msg329165
2018-11-02 20:44:28taleinatsetmessages: + msg329163
2018-11-02 20:31:10ned.deilysetmessages: + msg329162
2018-11-02 20:06:22terry.reedysetmessages: + msg329158
2018-11-02 19:47:33taleinatsetmessages: + msg329156
2018-10-29 15:51:34ned.deilysetmessages: + msg328840
2018-10-29 14:18:40terry.reedysetnosy: + wordtech, ned.deily
messages: + msg328832
2018-10-29 11:30:06taleinatcreate