Repository: napari/napari

Issue:
mac thinks that napari is named "__main__.py" in bundled app
## 🐛 Bug

My mac seems to think that napari is named "__main__.py" in bundled app

## To Reproduce

Steps to reproduce the behavior:

1. Launch napari bundled app on mac
2. Click "napari" on menu bar
3. See the menu items "Hide __main__.py" and "Close __main__.py"

![image](https://user-images.githubusercontent.com/1245615/110528081-f6626e00-80d4-11eb-867b-2b3955d13957.png)

## Expected behavior

menu items include "Hide napari" and "Close napari", similar to Chrome...

<!-- A clear and concise description of what you expected to happen. -->
![image](https://user-images.githubusercontent.com/1245615/110528760-bc459c00-80d5-11eb-8ca8-0f04c3247ea1.png)

## Environment

napari: 0.4.6
Platform: macOS-10.15.7-x86_64-i386-64bit
System: MacOS 10.15.7
Python: 3.8.7 (default, Jan 2 2021, 04:16:43) [Clang 11.0.0 (clang-1100.0.33.17)]
Qt: 5.15.2
PySide2: 5.15.2
NumPy: 1.19.3
SciPy: 1.6.1
Dask: 2021.03.0
VisPy: 0.6.6

OpenGL:
- GL version: 2.1 ATI-3.10.19
- MAX_TEXTURE_SIZE: 16384

Screens:
- screen 1: resolution 1792x1120, scale 2.0
- screen 2: resolution 2560x1440, scale 1.0

Plugins:
- affinder: 0.1.0
- aicsimageio: 0.2.0
- aicsimageio_delayed: 0.2.0
- brainreg: 0.2.3
- brainreg_standard: 0.2.3
- cellfinder: 0.2.1
- console: 0.0.3
- napari-hdf5-labels-io: 0.2.dev1
- ndtiffs: 0.1.1
- svg: 0.1.4

mac thinks that napari is named "__main__.py" in bundled app
## 🐛 Bug

My mac seems to think that napari is named "__main__.py" in bundled app

## To Reproduce

Steps to reproduce the behavior:

1. Launch napari bundled app on mac
2. Click "napari" on menu bar
3. See the menu items "Hide __main__.py" and "Close __main__.py"

![image](https://user-images.githubusercontent.com/1245615/110528081-f6626e00-80d4-11eb-867b-2b3955d13957.png)

## Expected behavior

menu items include "Hide napari" and "Close napari", similar to Chrome...

<!-- A clear and concise description of what you expected to happen. -->
![image](https://user-images.githubusercontent.com/1245615/110528760-bc459c00-80d5-11eb-8ca8-0f04c3247ea1.png)

## Environment

napari: 0.4.6
Platform: macOS-10.15.7-x86_64-i386-64bit
System: MacOS 10.15.7
Python: 3.8.7 (default, Jan 2 2021, 04:16:43) [Clang 11.0.0 (clang-1100.0.33.17)]
Qt: 5.15.2
PySide2: 5.15.2
NumPy: 1.19.3
SciPy: 1.6.1
Dask: 2021.03.0
VisPy: 0.6.6

OpenGL:
- GL version: 2.1 ATI-3.10.19
- MAX_TEXTURE_SIZE: 16384

Screens:
- screen 1: resolution 1792x1120, scale 2.0
- screen 2: resolution 2560x1440, scale 1.0

Plugins:
- affinder: 0.1.0
- aicsimageio: 0.2.0
- aicsimageio_delayed: 0.2.0
- brainreg: 0.2.3
- brainreg_standard: 0.2.3
- cellfinder: 0.2.1
- console: 0.0.3
- napari-hdf5-labels-io: 0.2.dev1
- ndtiffs: 0.1.1
- svg: 0.1.4



Discussion:
This happens with new bundles and also when somebody runs `napari` using `python -m napari` instead of the entry point command.
This happens with new bundles and also when somebody runs `napari` using `python -m napari` instead of the entry point command.

Resolving patch:
diff --git a/napari/_qt/qt_event_loop.py b/napari/_qt/qt_event_loop.py
--- a/napari/_qt/qt_event_loop.py
+++ b/napari/_qt/qt_event_loop.py
@@ -139,12 +139,19 @@ def get_app(
             QApplication.setAttribute(Qt.AA_EnableHighDpiScaling)
             QApplication.setAttribute(Qt.AA_UseHighDpiPixmaps)
 
+        argv = sys.argv.copy()
+        if sys.platform == "darwin" and not argv[0].endswith("napari"):
+            # Make sure the app name in the Application menu is `napari`
+            # which is taken from the basename of sys.argv[0]; we use
+            # a copy so the original value is still available at sys.argv
+            argv[0] = "napari"
+
         if perf_config and perf_config.trace_qt_events:
             from .perf.qt_event_tracing import QApplicationWithTracing
 
-            app = QApplicationWithTracing(sys.argv)
+            app = QApplicationWithTracing(argv)
         else:
-            app = QApplication(sys.argv)
+            app = QApplication(argv)
 
         # if this is the first time the Qt app is being instantiated, we set
         # the name and metadata
@@ -356,6 +363,7 @@ def run(
         return
 
     app = QApplication.instance()
+
     if _pycharm_has_eventloop(app):
         # explicit check for PyCharm pydev console
         return


Test patch: