code: def visibility_changed(self, enable):
          
          if self.dockwidget is None:
              return
          if enable:
              self.dockwidget.raise_()
              widget = self.get_focus_widget()
              if widget is not None and self.undocked_window is not None:
                  widget.setFocus()
          visible = self.dockwidget.isVisible() or self.ismaximized
          if self.DISABLE_ACTIONS_WHEN_HIDDEN:
              toggle_actions(self.plugin_actions, visible)
          self.isvisible = enable and visible
          if self.isvisible:
              self.refresh_plugin()
docs: Dock widget visibility has changed.