code: def on_window_losefocus(self, window, event):
          
          if not HidePrevention(self.window).may_hide():
              return
  
          value = self.settings.general.get_boolean('window-losefocus')
          visible = window.get_property('visible')
          self.losefocus_time = get_server_time(self.window)
          if visible and value:
              log.info("Hiding on focus lose")
              self.hide()
docs: Hides terminal main window when it loses the focus and if
          the window_losefocus gconf variable is True.