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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
|
import subprocess
import os
from qutebrowser.api import interceptor
c.content.cookies.accept = "no-3rdparty"
c.content.cookies.store = True
c.downloads.location.directory = '/home/lxf/temp/'
c.downloads.location.suggestion = "both"
c.downloads.remove_finished = 20
c.spellcheck.languages = ["en-US"]
c.auto_save.session = True
c.content.pdfjs = True
c.session.lazy_restore = True
c.tabs.background = True
c.tabs.position = "top"
c.content.autoplay = False
c.editor.command = ['foot', 'nvim', '{}']
c.url.default_page = "about:blank"
# searches
c.url.searchengines['DEFAULT'] = 'https://duckduckgo.com/?q={}'
c.url.searchengines['s'] = 'https://www.startpage.com/rvd/search?query={}&language=auto'
c.url.searchengines['g'] = 'http://www.google.com/search?hl=en&source=hp&ie=ISO-8859-l&q={}'
c.url.searchengines['a'] = 'https://wiki.archlinux.org/?search={}'
c.url.searchengines['y'] = 'https://www.youtube.com/results?search_query={}'
c.url.searchengines['ap'] = 'https://www.archlinux.org/packages/?sort=&q={}'
c.url.searchengines['w'] = 'https://www.google.com/search?q={}+site%3Awired.com'
c.url.searchengines['t'] = 'https://duckduckgo.com/?q={}+site%3Ahttps%3A%2F%2Fwww.elliotoracle.com%2Fblog%2F&t=fpas&ia=web'
# block JS out of the box:
c.content.javascript.enabled = False
js_whitelist = [
"*://localhost/*",
"*://127.0.0.1/*",
"*://github.com/*",
"*://gitlab.com/*",
"*://duckduckgo.com/*",
"*://*.youtube.com/*",
"*://*.luxagraf.net/*"
"*://translate.google.com/*",
"*://schoolsfirst.com/*",
]
private_whitelist = os.path.expanduser("~/.config/qutebrowser/private-whitelist")
if os.path.exists(private_whitelist):
with open(private_whitelist) as f:
js_whitelist += filter(lambda l: bool(l), f.read().split("\n"))
for site in js_whitelist:
with config.pattern(site) as p:
p.content.javascript.enabled = True
# ================== Youtube Add Blocking ======================= {{{
def filter_yt(info: interceptor.Request):
"""Block the given request if necessary."""
url = info.request_url
if (
url.host() == "www.youtube.com"
and url.path() == "/get_video_info"
and "&adformat=" in url.query()
):
info.block()
interceptor.register(filter_yt)
# }}}
# keybinds
# fix J/K
config.unbind('J', mode='normal')
config.unbind('K', mode='normal')
config.bind('J', 'tab-prev', mode='normal')
config.bind('K', 'tab-next', mode='normal')
# get rid of things I always hit accidentally
config.unbind('<Ctrl+v>')
config.unbind('<Ctrl+q>')
config.unbind('<Ctrl+h>')
# Userscripts
# call readability on page
config.bind (',r', 'spawn --userscript myread.py', mode='normal')
#download current or hinted video
config.bind(';y', 'spawn --userscript youtube-dl')
config.bind(';yh', 'hint links --userscript youtube-dl')
# watch current or hinted video
config.bind(',yl', 'hint links spawn --detach mpv --force-window yes {hint-url}')
config.bind(',yv', 'spawn --detach mpv --force-window yes {url}')
config.bind(',ys', 'spawn --userscript youtube-dl')
# open selected text in tab
config.bind (',f', 'open {primary}')
config.bind (',F', 'open --tab {primary}')
config.bind (',e', 'open-editor')
# clear cookies
config.bind('co', 'spawn bisc', mode='normal')
#config.set("colors.webpage.darkmode.enabled", True)
# save bookmark to luxagraf
config.bind(',s', "jseval --quiet if(document.getSelection){s=document.getSelection();}else{s='';};document.location='https://live.luxagraf.net/admin/links/link/add?&url='+encodeURIComponent(location.href)+'&description='+encodeURIComponent(s)+'&title='+encodeURIComponent(document.title);")
import sys, os
sys.path.append(os.path.join(sys.path[0], "jblock"))
config.source("jblock/jblock/integrations/qutebrowser.py")
config.set(
"content.host_blocking.lists",
[
"https://easylist.to/easylist/fanboy-annoyance.txt",
"https://raw.githubusercontent.com/uBlockOrigin/uAssets/master/filters/filters.txt",
"https://raw.githubusercontent.com/uBlockOrigin/uAssets/master/filters/annoyances.txt",
"https://raw.githubusercontent.com/uBlockOrigin/uAssets/master/filters/badware.txt",
"https://raw.githubusercontent.com/uBlockOrigin/uAssets/master/filters/privacy.txt",
"https://raw.githubusercontent.com/uBlockOrigin/uAssets/master/filters/resource-abuse.txt",
"https://raw.githubusercontent.com/uBlockOrigin/uAssets/master/filters/unbreak.txt",
"https://www.malwaredomainlist.com/hostslist/hosts.txt",
],
)
config.set(
"content.host_blocking.whitelist",
[
"duckduckgo.com",
],
)
solarized = {
'base03': '#002b36',
'base02': '#073642',
'base01': '#586e75',
'base00': '#657b83',
'base0': '#839496',
'base1': '#93a1a1',
'base2': '#eee8d5',
'base3': '#fdf6e3',
'yellow': '#b58900',
'orange': '#cb4b16',
'red': '#dc322f',
'magenta': '#d33682',
'violet': '#6c71c4',
'blue': '#268bd2',
'cyan': '#2aa198',
'green': '#859900'
}
## This is here so configs done via the GUI are still loaded.
## Remove it to not load settings done via the GUI.
config.load_autoconfig()
## Background color of the completion widget category headers.
## Type: QssColor
c.colors.completion.category.bg = solarized['base03']
## Bottom border color of the completion widget category headers.
## Type: QssColor
c.colors.completion.category.border.bottom = solarized['base03']
## Top border color of the completion widget category headers.
## Type: QssColor
c.colors.completion.category.border.top = solarized['base03']
## Foreground color of completion widget category headers.
## Type: QtColor
c.colors.completion.category.fg = solarized['base3']
## Background color of the completion widget for even rows.
## Type: QssColor
c.colors.completion.even.bg = solarized['base02']
## Text color of the completion widget.
## Type: QtColor
c.colors.completion.fg = solarized['base1']
## Background color of the selected completion item.
## Type: QssColor
c.colors.completion.item.selected.bg = solarized['violet']
## Bottom border color of the selected completion item.
## Type: QssColor
c.colors.completion.item.selected.border.bottom = solarized['violet']
## Top border color of the completion widget category headers.
## Type: QssColor
c.colors.completion.item.selected.border.top = solarized['violet']
## Foreground color of the selected completion item.
## Type: QtColor
c.colors.completion.item.selected.fg = solarized['base3']
## Foreground color of the matched text in the completion.
## Type: QssColor
c.colors.completion.match.fg = solarized['base2']
## Background color of the completion widget for odd rows.
## Type: QssColor
c.colors.completion.odd.bg = solarized['base02']
## Color of the scrollbar in completion view
## Type: QssColor
c.colors.completion.scrollbar.bg = solarized['base1']
## Color of the scrollbar handle in completion view.
## Type: QssColor
c.colors.completion.scrollbar.fg = solarized['base2']
## Background color for the download bar.
## Type: QssColor
c.colors.downloads.bar.bg = solarized['base03']
## Background color for downloads with errors.
## Type: QtColor
c.colors.downloads.error.bg = solarized['red']
## Foreground color for downloads with errors.
## Type: QtColor
c.colors.downloads.error.fg = solarized['base3']
## Color gradient start for download backgrounds.
## Type: QtColor
# c.colors.downloads.start.bg = '#0000aa'
## Color gradient start for download text.
## Type: QtColor
c.colors.downloads.start.fg = solarized['base3']
## Color gradient stop for download backgrounds.
## Type: QtColor
# c.colors.downloads.stop.bg = '#00aa00'
## Color gradient end for download text.
## Type: QtColor
# c.colors.downloads.stop.fg = solarized['base3']
## Color gradient interpolation system for download backgrounds.
## Type: ColorSystem
## Valid values:
## - rgb: Interpolate in the RGB color system.
## - hsv: Interpolate in the HSV color system.
## - hsl: Interpolate in the HSL color system.
## - none: Don't show a gradient.
# c.colors.downloads.system.bg = 'rgb'
## Color gradient interpolation system for download text.
## Type: ColorSystem
## Valid values:
## - rgb: Interpolate in the RGB color system.
## - hsv: Interpolate in the HSV color system.
## - hsl: Interpolate in the HSL color system.
## - none: Don't show a gradient.
# c.colors.downloads.system.fg = 'rgb'
## Background color for hints. Note that you can use a `rgba(...)` value
## for transparency.
## Type: QssColor
c.colors.hints.bg = solarized['violet']
## Font color for hints.
## Type: QssColor
c.colors.hints.fg = solarized['base3']
## Font color for the matched part of hints.
## Type: QssColor
c.colors.hints.match.fg = solarized['base1']
## Background color of the keyhint widget.
## Type: QssColor
# c.colors.keyhint.bg = 'rgba(0, 0, 0, 80%)'
## Text color for the keyhint widget.
## Type: QssColor
c.colors.keyhint.fg = solarized['base3']
## Highlight color for keys to complete the current keychain.
## Type: QssColor
c.colors.keyhint.suffix.fg = solarized['yellow']
## Background color of an error message.
## Type: QssColor
c.colors.messages.error.bg = solarized['red']
## Border color of an error message.
## Type: QssColor
c.colors.messages.error.border = solarized['red']
## Foreground color of an error message.
## Type: QssColor
c.colors.messages.error.fg = solarized['base3']
## Background color of an info message.
## Type: QssColor
c.colors.messages.info.bg = solarized['base03']
## Border color of an info message.
## Type: QssColor
c.colors.messages.info.border = solarized['base03']
## Foreground color an info message.
## Type: QssColor
c.colors.messages.info.fg = solarized['base3']
## Background color of a warning message.
## Type: QssColor
c.colors.messages.warning.bg = solarized['orange']
## Border color of a warning message.
## Type: QssColor
c.colors.messages.warning.border = solarized['orange']
## Foreground color a warning message.
## Type: QssColor
c.colors.messages.warning.fg = solarized['base3']
## Background color for prompts.
## Type: QssColor
c.colors.prompts.bg = solarized['base02']
## Border used around UI elements in prompts.
## Type: String
c.colors.prompts.border = '1px solid ' + solarized['base3']
## Foreground color for prompts.
## Type: QssColor
c.colors.prompts.fg = solarized['base3']
## Background color for the selected item in filename prompts.
## Type: QssColor
c.colors.prompts.selected.bg = solarized['base01']
## Background color of the statusbar in caret mode.
## Type: QssColor
c.colors.statusbar.caret.bg = solarized['blue']
## Foreground color of the statusbar in caret mode.
## Type: QssColor
c.colors.statusbar.caret.fg = solarized['base1']
## Background color of the statusbar in caret mode with a selection.
## Type: QssColor
c.colors.statusbar.caret.selection.bg = solarized['violet']
## Foreground color of the statusbar in caret mode with a selection.
## Type: QssColor
c.colors.statusbar.caret.selection.fg = solarized['base1']
## Background color of the statusbar in command mode.
## Type: QssColor
c.colors.statusbar.command.bg = solarized['base03']
## Foreground color of the statusbar in command mode.
## Type: QssColor
c.colors.statusbar.command.fg = solarized['base1']
## Background color of the statusbar in private browsing + command mode.
## Type: QssColor
c.colors.statusbar.command.private.bg = solarized['base01']
## Foreground color of the statusbar in private browsing + command mode.
## Type: QssColor
c.colors.statusbar.command.private.fg = solarized['base3']
## Background color of the statusbar in insert mode.
## Type: QssColor
c.colors.statusbar.insert.bg = solarized['base02']
## Foreground color of the statusbar in insert mode.
## Type: QssColor
c.colors.statusbar.insert.fg = solarized['base1']
## Background color of the statusbar.
## Type: QssColor
c.colors.statusbar.normal.bg = solarized['base03']
## Foreground color of the statusbar.
## Type: QssColor
c.colors.statusbar.normal.fg = solarized['base1']
## Background color of the statusbar in passthrough mode.
## Type: QssColor
c.colors.statusbar.passthrough.bg = solarized['base02']
## Foreground color of the statusbar in passthrough mode.
## Type: QssColor
c.colors.statusbar.passthrough.fg = solarized['base1']
## Background color of the statusbar in private browsing mode.
## Type: QssColor
c.colors.statusbar.private.bg = solarized['base01']
## Foreground color of the statusbar in private browsing mode.
## Type: QssColor
c.colors.statusbar.private.fg = solarized['base3']
## Background color of the progress bar.
## Type: QssColor
c.colors.statusbar.progress.bg = solarized['base1']
## Foreground color of the URL in the statusbar on error.
## Type: QssColor
c.colors.statusbar.url.error.fg = solarized['red']
## Default foreground color of the URL in the statusbar.
## Type: QssColor
c.colors.statusbar.url.fg = solarized['base1']
## Foreground color of the URL in the statusbar for hovered links.
## Type: QssColor
c.colors.statusbar.url.hover.fg = solarized['base2']
## Foreground color of the URL in the statusbar on successful load
## (http).
## Type: QssColor
c.colors.statusbar.url.success.http.fg = solarized['violet']
## Foreground color of the URL in the statusbar on successful load
## (https).
## Type: QssColor
c.colors.statusbar.url.success.https.fg = solarized['base1']
## Foreground color of the URL in the statusbar when there's a warning.
## Type: QssColor
c.colors.statusbar.url.warn.fg = solarized['yellow']
## Background color of the tab bar.
## Type: QtColor
# c.colors.tabs.bar.bg = '#555555'
## Background color of unselected even tabs.
## Type: QtColor
c.colors.tabs.even.bg = solarized['base02']
## Foreground color of unselected even tabs.
## Type: QtColor
c.colors.tabs.even.fg = solarized['base1']
## Color for the tab indicator on errors.
## Type: QtColor
c.colors.tabs.indicator.error = solarized['red']
## Color gradient start for the tab indicator.
## Type: QtColor
c.colors.tabs.indicator.start = solarized['violet']
## Color gradient end for the tab indicator.
## Type: QtColor
c.colors.tabs.indicator.stop = solarized['orange']
## Color gradient interpolation system for the tab indicator.
## Type: ColorSystem
## Valid values:
## - rgb: Interpolate in the RGB color system.
## - hsv: Interpolate in the HSV color system.
## - hsl: Interpolate in the HSL color system.
## - none: Don't show a gradient.
# c.colors.tabs.indicator.system = 'rgb'
## Background color of unselected odd tabs.
## Type: QtColor
c.colors.tabs.odd.bg = solarized['base03']
## Foreground color of unselected odd tabs.
## Type: QtColor
c.colors.tabs.odd.fg = solarized['base1']
## Background color of selected even tabs.
## Type: QtColor
c.colors.tabs.selected.even.bg = solarized['violet']
## Foreground color of selected even tabs.
## Type: QtColor
c.colors.tabs.selected.even.fg = solarized['base2']
## Background color of selected odd tabs.
## Type: QtColor
c.colors.tabs.selected.odd.bg = solarized['violet']
## Foreground color of selected odd tabs.
## Type: QtColor
c.colors.tabs.selected.odd.fg = solarized['base2']
## Background color for webpages if unset (or empty to use the theme's
## color)
## Type: QtColor
# c.colors.webpage.bg = 'white'
|