Title: [MNT]: macOS backend lacks standard keyboard shortcuts · Issue #31770 · matplotlib/matplotlib · GitHub
Open Graph Title: [MNT]: macOS backend lacks standard keyboard shortcuts · Issue #31770 · matplotlib/matplotlib
X Title: [MNT]: macOS backend lacks standard keyboard shortcuts · Issue #31770 · matplotlib/matplotlib
Description: Summary A longstanding issue that I've had with matplotlib is the lack of support for standard macOS keyboard shortcuts: Command Shortcut Quit Command-Q Minimize window Command-M Switch windows Command-Grave Shift-Command-Grave Hide all ...
Open Graph Description: Summary A longstanding issue that I've had with matplotlib is the lack of support for standard macOS keyboard shortcuts: Command Shortcut Quit Command-Q Minimize window Command-M Switch windows Com...
X Description: Summary A longstanding issue that I've had with matplotlib is the lack of support for standard macOS keyboard shortcuts: Command Shortcut Quit Command-Q Minimize window Command-M Switch windows...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/31770
X: @github
Domain: github.com
IPv4 address: 140.82.114.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[MNT]: macOS backend lacks standard keyboard shortcuts","articleBody":"### Summary\n\nA longstanding issue that I've had with matplotlib is the lack of support for standard macOS keyboard shortcuts:\n\n| Command | Shortcut |\n|-|-|\n| Quit | Command-Q |\n| Minimize window | Command-M |\n| Switch windows | Command-Grave \u003cbr> Shift-Command-Grave |\n| Hide all windows | Command-H |\n| Hide other windows | Command-Shift-H |\n\nAnd when dealing with text input (the save dialog):\n\n| Command | Shortcut |\n|-|-|\n| Cut | Command-X |\n| Copy | Command-C |\n| Paste | Command-V |\n| Select All | Command-A |\n| Undo | Command-Z |\n| Redo | Shift-Command-Z |\n\nIn addition, macOS Sequoia also added several keyboard shortcuts for dealing with tiling window management.\n\nOn macOS, most of these shortcuts are driven by menu items in the main menu bar. The matplotlib macOS backend sets up the shared `NSApplication` instance when it calls `+[NSApplication sharedInstance]`; however, it never fills the `NSApplication.mainMenu` property with a main menu.\n\nSimilarly, as `NSApplication.windowsMenu` is never set, macOS doesn't add the applicable menu items or shortcuts for dealing with the tiling window manager.\n\nI'd like to address this by creating a main menu when the macOS backend is used.\n\nThere are several ways to solve this, and I'd like some guidance so I don't step on any toes :)\n\n1) I can create the main menu programmatically in `_macosx.m`. This is likely the most straightforward approach, but it would involve a lot of hardcoded strings for menu titles in the `.m` file and ultimately lack localization support.\n\n From an architectural perspective, it seems like existing titles/tooltips are hardcoded at the Python layer, shipped to the backend, which then converts it into UI buttons. That's doable as well, but is a lot of complexity.\n\n2) Create a standard `MainMenu.xib` file that would be edited as a standalone file with Xcode. Invoke `ibtool` from the build system to generate a `.nib` file, package that at a similar level to existing image files, then load this from `_macosx.m`. This would require maintainers to use the Xcode app for editing the main menu, which might be a deal-breaker for some.\n\n3) Create a new Xcode project for macOS UI assets. For now, this would be the main menu xib. In the future, it could be localized UI strings, images, icons, etc. Have the project generate a `.bundle` with compiled `.nibs` / `.car` / `.strings` / etc.\n\n This is likely overkill for now, but could simplify asset creation in the future as Apple pushes for even more UI variants to apps (light / dark / tinted / glass / *sigh*). Xcode can generate those variants automatically and also generate compatible versions for previous macOS releases.\n\nI'm fine with any of these approaches.\n\nThere's also the approach of doing all of this without a main menu, but I think that would be harder to maintain in the future as it's not what macOS expects.\n\n\n### Proposed fix\n\n_No response_","author":{"url":"https://github.com/iccir","@type":"Person","name":"iccir"},"datePublished":"2026-05-28T19:01:14Z","url":"https://github.com/matplotlib/matplotlib/issues/31770"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:08fe9eac-db5a-e51f-5e55-49d19770d353 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8BEE:2E2845:3CF8BB:529C9E:6B06797E |
| html-safe-nonce | 477d6906c720da1a326d087023f142f87c03d44dacb7f67f1b11b2eb60f9a6db |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4QkVFOjJFMjg0NTozQ0Y4QkI6NTI5QzlFOjZCMDY3OTdFIiwidmlzaXRvcl9pZCI6IjM3MTE3MDc0MDYxMDQxNjQ3MzQiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | f7e73ea9c793033fe2cfbcdd0fde66ab03e23052f586fee21247216ffe9971ec |
| hovercard-subject-tag | issue:4543014611 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/matplotlib/matplotlib/31770/issue_layout |
| twitter:image | https://opengraph.githubassets.com/4342971d05435813cba51cbd8a888ca43cffc7fbcc63c8c7dbfbd3f42968417e/matplotlib/matplotlib/issues/31770 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/4342971d05435813cba51cbd8a888ca43cffc7fbcc63c8c7dbfbd3f42968417e/matplotlib/matplotlib/issues/31770 |
| og:image:alt | Summary A longstanding issue that I've had with matplotlib is the lack of support for standard macOS keyboard shortcuts: Command Shortcut Quit Command-Q Minimize window Command-M Switch windows Com... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | iccir |
| hostname | github.com |
| expected-hostname | github.com |
| None | 4462ff7ebfd3d551f202659f2423dae617b6849d23b1df6465dc504ef497d14a |
| turbo-cache-control | no-preview |
| go-import | github.com/matplotlib/matplotlib git https://github.com/matplotlib/matplotlib.git |
| octolytics-dimension-user_id | 215947 |
| octolytics-dimension-user_login | matplotlib |
| octolytics-dimension-repository_id | 1385122 |
| octolytics-dimension-repository_nwo | matplotlib/matplotlib |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1385122 |
| octolytics-dimension-repository_network_root_nwo | matplotlib/matplotlib |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 6d3909414814ff86ce7da4c51a0f4918a13fb41b |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width