From ade7004f8f4429affc27a8f5b03ad783ca994ca9 Mon Sep 17 00:00:00 2001 From: "mhm@mhm.com" Date: Sat, 18 Nov 2017 00:48:31 +0100 Subject: [PATCH] lazy sessions --- qutebrowser/browser/qutescheme.py | 2 ++ qutebrowser/misc/sessions.py | 10 ++++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/qutebrowser/browser/qutescheme.py b/qutebrowser/browser/qutescheme.py index f943fcba4..3881a0d2e 100644 --- a/qutebrowser/browser/qutescheme.py +++ b/qutebrowser/browser/qutescheme.py @@ -424,6 +424,7 @@ def qute_settings(url): confget=config.instance.get_str) return 'text/html', html + @add_handler('back') def qute_back(url): """Handler for qute://back. Simple page to free ram / lazy load a site, @@ -432,6 +433,7 @@ def qute_back(url): html = jinja.render('back.html', title='Suspended') return 'text/html', html + @add_handler('configdiff') def qute_configdiff(url): """Handler for qute://configdiff.""" diff --git a/qutebrowser/misc/sessions.py b/qutebrowser/misc/sessions.py index 471805da9..4784f796a 100644 --- a/qutebrowser/misc/sessions.py +++ b/qutebrowser/misc/sessions.py @@ -348,8 +348,8 @@ class SessionManager(QObject): new_tab.data.pinned = histentry['pinned'] active = (histentry.get('active', False) and - (not config.val.session_lazy_restore or - histentry['url'].startswith('qute://'))) + (not config.val.session_lazy_restore or + histentry['url'].startswith('qute://'))) url = QUrl.fromEncoded(histentry['url'].encode('ascii')) if 'original-url' in histentry: orig_url = QUrl.fromEncoded( @@ -370,8 +370,10 @@ class SessionManager(QObject): active = last.get('active', False) if not last['url'].startswith('qute://'): - entries.append(TabHistoryItem(url=QUrl.fromEncoded(url.encode('ascii')), - title=title, active=active, user_data={})) + entries.append(TabHistoryItem( + url=QUrl.fromEncoded(url.encode('ascii')), + title=title, active=active, user_data={})) + if active: new_tab.title_changed.emit(title)