code: def get_focus_client(self):
          
          widget = QApplication.focusWidget()
          for client in self.get_clients():
              if widget is client or widget is client.notebookwidget:
                  return client
docs: Return current notebook with focus, if any.