code: def visibility_changed(self, enable):
          
          SpyderPluginWidget.visibility_changed(self, enable)
          if self.dockwidget is None:
              return
          if self.dockwidget.isWindow():
              self.dock_toolbar.show()
          else:
              self.dock_toolbar.hide()
          if enable:
              self.refresh_plugin()
          self.sig_update_plugin_title.emit()
docs: DockWidget visibility has changed