code: def toggle_lock(self, value):
          
          self.interface_locked = value
          CONF.set('main', 'panes_locked', value)
  
          # Apply lock to panes
          for plugin in (self.widgetlist + self.thirdparty_plugins):
              if self.interface_locked:
                  if plugin.dockwidget.isFloating():
                      plugin.dockwidget.setFloating(False)
                  plugin.dockwidget.setTitleBarWidget(QWidget())
              else:
                  plugin.dockwidget.set_title_bar()
  
          # Apply lock to toolbars
          for toolbar in self.toolbarslist:
              if self.interface_locked:
                  toolbar.setMovable(False)
              else:
                  toolbar.setMovable(True)
docs: Lock/Unlock dockwidgets and toolbars