code: def sync_focus(self, *_):
          
          # Pop-up displayed?
          if self.display_popup:
              self.app.layout.focus(self.layout_manager.popup_dialog)
              return
  
          # Confirm.
          if self.confirm_text:
              return
  
          # Custom prompt.
          if self.prompt_command:
              return # Focus prompt
  
          # Command mode.
          if self.command_mode:
              return # Focus command
  
          # No windows left, return. We will quit soon.
          if not self.pymux.arrangement.windows:
              return
  
          pane = self.pymux.arrangement.get_active_pane()
          self.app.layout.focus(pane.terminal)
docs: Focus the focused window from the pymux arrangement.