diff --git a/qutebrowser/app.py b/qutebrowser/app.py index 68397bbd3..49f06c764 100644 --- a/qutebrowser/app.py +++ b/qutebrowser/app.py @@ -210,14 +210,17 @@ def _load_session(name): name: The name of the session to load, or None to read state file. """ state_config = objreg.get('state-config') + session_manager = objreg.get('session-manager') if name is None: try: name = state_config['general']['session'] except KeyError: # No session given as argument and none in the session file -> # start without loading a session - return - session_manager = objreg.get('session-manager') + if session_manager.exists('_autosave'): + name = '_autosave' + else: + return try: session_manager.load(name) except sessions.SessionNotFoundError: @@ -723,6 +726,7 @@ class Quitter: # Now we can hopefully quit without segfaults log.destroy.debug("Deferring QApplication::exit...") objreg.get('signal-handler').deactivate() + objreg.get('session-manager').session_delete('_autosave', force = True) # We use a singleshot timer to exit here to minimize the likelihood of # segfaults. QTimer.singleShot(0, functools.partial(qApp.exit, status)) diff --git a/qutebrowser/browser/browsertab.py b/qutebrowser/browser/browsertab.py index cc27c335f..193f1695e 100644 --- a/qutebrowser/browser/browsertab.py +++ b/qutebrowser/browser/browsertab.py @@ -685,9 +685,8 @@ class AbstractTab(QWidget): @pyqtSlot(bool) def _on_load_finished(self, ok): - if config.get('general', 'auto-save-session'): - sess_manager = objreg.get('session-manager') - sess_manager.session_save() + sess_manager = objreg.get('session-manager') + sess_manager.session_save('_autosave', quiet = True, force = True) if ok and not self._has_ssl_errors: if self.url().scheme() == 'https': self._set_load_status(usertypes.LoadStatus.success_https) diff --git a/qutebrowser/config/configdata.py b/qutebrowser/config/configdata.py index 3d13bf563..ea3939a44 100644 --- a/qutebrowser/config/configdata.py +++ b/qutebrowser/config/configdata.py @@ -160,11 +160,6 @@ def data(readonly=False): SettingValue(typ.Bool(), 'true'), "Whether to save the config automatically on quit."), - ('auto-save-session', - SettingValue(typ.Bool(), 'false'), - "Whether to save the session automatically when a page finishes " - "loading."), - ('auto-save-interval', SettingValue(typ.Int(minval=0, maxval=MAXVALS['int']), '15000'), "How often (in milliseconds) to auto-save config/cookies/etc."),