-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtabbedbrowser.patch
43 lines (40 loc) · 1.8 KB
/
tabbedbrowser.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
--- /tmp/tabbedbrowser.py 2024-03-24 13:44:55.631260852 +0100
+++ tabbedbrowser.py 2024-03-24 14:51:06.982818360 +0100
@@ -8,6 +8,7 @@
import functools
import weakref
import datetime
+import shutil
import dataclasses
from typing import (
Any, Deque, List, Mapping, MutableMapping, MutableSequence, Optional, Tuple)
@@ -19,7 +20,7 @@
from qutebrowser.keyinput import modeman
from qutebrowser.mainwindow import tabwidget, mainwindow
from qutebrowser.browser import signalfilter, browsertab, history
-from qutebrowser.utils import (log, usertypes, utils, qtutils,
+from qutebrowser.utils import (standarddir, log, usertypes, utils, qtutils,
urlutils, message, jinja, version)
from qutebrowser.misc import quitter, objects
@@ -519,6 +520,23 @@
else:
self.undo_stack[-1].append(entry)
+ # Patch closed-tabs-history for qute-plugin-fzfhistory
+ closed_history=standarddir.data() + "/closed-tabs-history"
+ tmp_ch="/tmp/qute_closed_history_tmp"
+ url_str = tab.url().toDisplayString() + "\n"
+ now=datetime.datetime.now().strftime("%Y %B %d %H:%M:%S")
+
+ with open(closed_history, 'r') as chf:
+ with open(tmp_ch, "w") as tmpf:
+ # If the url already saved, delete the old entry
+ for line in (chf.readlines() [-99:]):
+ if url_str not in line:
+ tmpf.write(line)
+ # Append the file with the current closed tab data
+ tmpf.write(now + "|" + tab.title() + "|" + url_str)
+
+ shutil.copy(tmp_ch, closed_history)
+
tab.private_api.shutdown()
self.widget.removeTab(idx)