Repository: napari/napari

Issue:
Status bar doesn't update when layer selection changes
## 🐛 Bug

<!-- A clear and concise description of what the bug is. -->
The status bar at the bottom of the window shows the value of the pixel under the hovering cursor in the current image layer. As the cursor is moved around in the viewer, this value changes. When selecting a different image layer, the value should change to be the pixel value in this layer, but it doesn't. It only updates once the cursor is moved.  

## To Reproduce

Steps to reproduce the behavior:

1. Open two different image layers.
2. Click on one layer to select it.
3. Move the mouse to hover over a pixel in the viewer.
4. Press the up or down key to select the other layer.
5. The status bar fails to update when the layer selection is changed. It doesn't update until the cursor is moved.

<!-- If you have a code sample, error messages, stack traces, please provide it here as well -->

## Expected behavior

<!-- A clear and concise description of what you expected to happen. -->
When the selected image layer is changed, the status bar should update and display the new pixel value. It seems there is a missing callback (to ViewerModel's _update_status_bar_from_cursor?) that would update the status bar when the LayerList selection changes. 

## Environment

napari: 0.4.17rc8
Platform: Windows-10-10.0.19045-SP0
Python: 3.8.13 | packaged by conda-forge | (default, Mar 25 2022, 05:59:45) [MSC v.1929 64 bit (AMD64)]
Qt: 5.15.6
PySide2: 5.15.6
NumPy: 1.23.4
SciPy: 1.9.3
Dask: 2022.10.2
VisPy: 0.11.0
magicgui: 0.6.0
superqt: 0.3.8
in-n-out: 0.1.5
app-model: 0.1.0
npe2: 0.6.1

OpenGL:
- GL version: 4.6.0 - Build 27.20.100.9565
- MAX_TEXTURE_SIZE: 16384

Screens:
- screen 1: resolution 1920x1080, scale 1.0
- screen 2: resolution 1920x1200, scale 1.0

## Additional context

<!-- Add any other context about the problem here. -->
First issue, hope for many more to come. 😃 Napari is great, amazing work! 


Discussion:
This function 
https://github.com/napari/napari/blob/95356e45ef7573e6e5f48abde0639388a0cea007/napari/components/viewer_model.py#L460

It should be not only connected to mouse move event:
https://github.com/napari/napari/blob/95356e45ef7573e6e5f48abde0639388a0cea007/napari/components/viewer_model.py#L232-L234

But also in the event of a change selection of layers. 
Like here:
https://github.com/napari/napari/blob/95356e45ef7573e6e5f48abde0639388a0cea007/napari/components/viewer_model.py#L239

or called at the end of this function 
https://github.com/napari/napari/blob/95356e45ef7573e6e5f48abde0639388a0cea007/napari/components/viewer_model.py#L405

If you make PR I will be happy to review it. 

Resolving patch:
diff --git a/napari/components/viewer_model.py b/napari/components/viewer_model.py
--- a/napari/components/viewer_model.py
+++ b/napari/components/viewer_model.py
@@ -414,6 +414,7 @@ def _on_active_layer(self, event):
             self.cursor.size = active_layer.cursor_size
             self.camera.mouse_pan = active_layer.mouse_pan
             self.camera.mouse_zoom = active_layer.mouse_zoom
+            self._update_status_bar_from_cursor()
 
     @staticmethod
     def rounded_division(min_val, max_val, precision):


Test patch: