aboutsummaryrefslogtreecommitdiff
path: root/dotfiles/.config/qutebrowser/config.py
blob: a40c127ffffd30ee2f0297886eee6b50dd94efd5 (plain)
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
import os
import subprocess

# Still load settings configured via autoconfig.yml
config.load_autoconfig()

# ------------ Color scheme ----------------

ultramar = {
    'light0': '#faf6e5',
    'light1': '#e6e3d6',
    'light2': '#d2d0c8',
    'light3': '#b0afa8',
    'dark0': '#151517',
    'dark1': '#232328',
    'dark2': '#33333a',
    'dark3': '#404049',
    'yellow': '#e2b55a',
    'orange': '#af5539',
    'red': '#b73030',
    'magenta': '#b48ead',
    'violet': '#9c6992',
    'blue': '#3f6e90',
    'cyan': '#5b8277',
    'cyan2': '#7fac96',
    'green': '#6d974b'
}

## Notifications for websites are retarded

c.content.notifications.enabled = False

## Disable JS by default
c.content.javascript.enabled = False

# Read separate whitelist file and enable JS for those sites
with open(os.path.expanduser("~/.config/qutebrowser/jswhitelist")) as f:
    for line in f:
        site = line.rstrip('\n')
        with config.pattern(site) as p:
            p.content.javascript.enabled = True

## Disable 3rd party cookies
c.content.cookies.accept = "no-3rdparty"

# Pretend that we are the latest version of Chrome, since some retarded sites
# think it is fine to pester me with ads to install Firefox or Chrome or
# whatever upon seeing a non-standard user agent string. I swear the web is just
# getting worse day by day. Just when you think it can't get worse they come up
# with some new crap worse than anything else before. Why can't a person just
# browse the web peacefully, reading content without being annoyed by ads,
# spyware, pop ups and broken javascript written by soydevs that don't know how
# to make a proper website without adding a ton of javascript, or at least
# degrade gracefully if the latest webshit "standard" isn't being used because I
# don't want my web browser to be a second OS on top of my actual OS.
chrome_ver = subprocess.check_output("pacman -Si chromium | grep Version | sed 's/^.*: \([0-9]*\.[0-9]*\.[0-9]*\.[0-9]*\).*$/\\1/g'", shell=True).decode('ascii').rstrip()
c.content.headers.user_agent = "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/{0} Safari/537.36".format(chrome_ver)

## Downloads

# Automatically remove finished downloads from list
c.downloads.remove_finished = 3000

## Default search engine

# c.url.searchengines = { "DEFAULT": "https://searx.bar/search?q={}" }
c.url.searchengines = { "DEFAULT": "https://srx.yaroslavps.com/search?q={}" }

# c.url.default_page = "https://searx.bar"
c.url.default_page = "https://srx.yaroslavps.com"

# c.url.start_pages = "https://searx.bar"
c.url.start_pages = "https://srx.yaroslavps.com"

## Default fonts
c.fonts.default_size = "10pt"

## Prefer dark mode in websites that support it
c.colors.webpage.preferred_color_scheme = "dark"

## Background color of the completion widget category headers.
## Type: QssColor
c.colors.completion.category.bg = ultramar['dark0']

## Bottom border color of the completion widget category headers.
## Type: QssColor
c.colors.completion.category.border.bottom = ultramar['dark0']

## Top border color of the completion widget category headers.
## Type: QssColor
c.colors.completion.category.border.top = ultramar['dark0']

## Foreground color of completion widget category headers.
## Type: QtColor
c.colors.completion.category.fg = ultramar['light1']

## Background color of the completion widget for even rows.
## Type: QssColor
c.colors.completion.even.bg = ultramar['dark1']

## Text color of the completion widget.
## Type: QtColor
c.colors.completion.fg = ultramar['light1']

## Background color of the selected completion item.
## Type: QssColor
c.colors.completion.item.selected.bg = ultramar['cyan']

## Bottom border color of the selected completion item.
## Type: QssColor
c.colors.completion.item.selected.border.bottom = ultramar['cyan']

## Top border color of the completion widget category headers.
## Type: QssColor
c.colors.completion.item.selected.border.top = ultramar['cyan']

## Foreground color of the selected completion item.
## Type: QtColor
c.colors.completion.item.selected.fg = ultramar['dark0']

## Foreground color of the matched text in the completion.
## Type: QssColor
c.colors.completion.match.fg = ultramar['yellow']

## Background color of the completion widget for odd rows.
## Type: QssColor
c.colors.completion.odd.bg = ultramar['dark3']

## Color of the scrollbar in completion view
## Type: QssColor
c.colors.completion.scrollbar.bg = ultramar['dark3']

## Color of the scrollbar handle in completion view.
## Type: QssColor
c.colors.completion.scrollbar.fg = ultramar['light2']

## Background color for the download bar.
## Type: QssColor
c.colors.downloads.bar.bg = ultramar['dark0']

## Background color for downloads with errors.
## Type: QtColor
c.colors.downloads.error.bg = ultramar['red']

## Foreground color for downloads with errors.
## Type: QtColor
c.colors.downloads.error.fg = ultramar['light1']

## 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 = ultramar['light1']

## 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 = ultramar['light1']

## 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'

## CSS border value for hints
c.hints.border = '1px solid ' + ultramar['dark0'];

## Background color for hints. Note that you can use a `rgba(...)` value
## for transparency.
## Type: QssColor
c.colors.hints.bg = ultramar['cyan']

## Font color for hints.
## Type: QssColor
c.colors.hints.fg = ultramar['light1']

## Font color for the matched part of hints.
## Type: QssColor
c.colors.hints.match.fg = ultramar['dark0']

## Background color of the keyhint widget.
## Type: QssColor
c.colors.keyhint.bg = 'rgba(27, 30, 37, 80%)'

## Text color for the keyhint widget.
## Type: QssColor
c.colors.keyhint.fg = ultramar['light1']

## Highlight color for keys to complete the current keychain.
## Type: QssColor
c.colors.keyhint.suffix.fg = ultramar['yellow']

## Background color of an error message.
## Type: QssColor
c.colors.messages.error.bg = ultramar['red']

## Border color of an error message.
## Type: QssColor
c.colors.messages.error.border = ultramar['red']

## Foreground color of an error message.
## Type: QssColor
c.colors.messages.error.fg = ultramar['light1']

## Background color of an info message.
## Type: QssColor
c.colors.messages.info.bg = ultramar['dark0']

## Border color of an info message.
## Type: QssColor
c.colors.messages.info.border = ultramar['dark0']

## Foreground color an info message.
## Type: QssColor
c.colors.messages.info.fg = ultramar['light1']

## Background color of a warning message.
## Type: QssColor
c.colors.messages.warning.bg = ultramar['orange']

## Border color of a warning message.
## Type: QssColor
c.colors.messages.warning.border = ultramar['orange']

## Foreground color a warning message.
## Type: QssColor
c.colors.messages.warning.fg = ultramar['light1']

## Background color for prompts.
## Type: QssColor
c.colors.prompts.bg = ultramar['dark1']

## Border used around UI elements in prompts.
## Type: String
c.colors.prompts.border = '1px solid ' + ultramar['light1']

## Foreground color for prompts.
## Type: QssColor
c.colors.prompts.fg = ultramar['light1']

## Background color for the selected item in filename prompts.
## Type: QssColor
c.colors.prompts.selected.bg = ultramar['dark0']

## Background color of the statusbar in caret mode.
## Type: QssColor
c.colors.statusbar.caret.bg = ultramar['violet']

## Foreground color of the statusbar in caret mode.
## Type: QssColor
c.colors.statusbar.caret.fg = ultramar['light1']

## Background color of the statusbar in caret mode with a selection.
## Type: QssColor
c.colors.statusbar.caret.selection.bg = ultramar['violet']

## Foreground color of the statusbar in caret mode with a selection.
## Type: QssColor
c.colors.statusbar.caret.selection.fg = ultramar['light1']

## Background color of the statusbar in command mode.
## Type: QssColor
c.colors.statusbar.command.bg = ultramar['dark0']

## Foreground color of the statusbar in command mode.
## Type: QssColor
c.colors.statusbar.command.fg = ultramar['light1']

## Background color of the statusbar in private browsing + command mode.
## Type: QssColor
c.colors.statusbar.command.private.bg = ultramar['magenta']

## Foreground color of the statusbar in private browsing + command mode.
## Type: QssColor
c.colors.statusbar.command.private.fg = ultramar['light1']

## Background color of the statusbar in insert mode.
## Type: QssColor
c.colors.statusbar.insert.bg = ultramar['green']

## Foreground color of the statusbar in insert mode.
## Type: QssColor
c.colors.statusbar.insert.fg = ultramar['dark3']

## Background color of the statusbar.
## Type: QssColor
c.colors.statusbar.normal.bg = ultramar['dark0']

## Foreground color of the statusbar.
## Type: QssColor
c.colors.statusbar.normal.fg = ultramar['light1']

## Background color of the statusbar in passthrough mode.
## Type: QssColor
c.colors.statusbar.passthrough.bg = ultramar['blue']

## Foreground color of the statusbar in passthrough mode.
## Type: QssColor
c.colors.statusbar.passthrough.fg = ultramar['light1']

## Background color of the statusbar in private browsing mode.
## Type: QssColor
c.colors.statusbar.private.bg = ultramar['magenta']

## Foreground color of the statusbar in private browsing mode.
## Type: QssColor
c.colors.statusbar.private.fg = ultramar['light1']

## Background color of the progress bar.
## Type: QssColor
c.colors.statusbar.progress.bg = ultramar['light1']

## Foreground color of the URL in the statusbar on error.
## Type: QssColor
c.colors.statusbar.url.error.fg = ultramar['red']

## Default foreground color of the URL in the statusbar.
## Type: QssColor
c.colors.statusbar.url.fg = ultramar['light1']

## Foreground color of the URL in the statusbar for hovered links.
## Type: QssColor
c.colors.statusbar.url.hover.fg = ultramar['blue']

## Foreground color of the URL in the statusbar on successful load
## (http).
## Type: QssColor
c.colors.statusbar.url.success.http.fg = ultramar['light1']

## Foreground color of the URL in the statusbar on successful load
## (https).
## Type: QssColor
c.colors.statusbar.url.success.https.fg = ultramar['cyan']

## Foreground color of the URL in the statusbar when there's a warning.
## Type: QssColor
c.colors.statusbar.url.warn.fg = ultramar['yellow']

## Background color of the tab bar.
## Type: QtColor
c.colors.tabs.bar.bg = ultramar['dark0']

## Background color of unselected even tabs.
## Type: QtColor
c.colors.tabs.even.bg = ultramar['dark0']

## Foreground color of unselected even tabs.
## Type: QtColor
c.colors.tabs.even.fg = ultramar['light2']

## Color for the tab indicator on errors.
## Type: QtColor
c.colors.tabs.indicator.error = ultramar['red']

## Color gradient start for the tab indicator.
## Type: QtColor
c.colors.tabs.indicator.start = ultramar['blue']

## Color gradient end for the tab indicator.
## Type: QtColor
c.colors.tabs.indicator.stop = ultramar['cyan']

## 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 = ultramar['dark2']

## Foreground color of unselected odd tabs.
## Type: QtColor
c.colors.tabs.odd.fg = ultramar['light2']

## Background color of selected even tabs.
## Type: QtColor
c.colors.tabs.selected.even.bg = ultramar['cyan2']

## Foreground color of selected even tabs.
## Type: QtColor
c.colors.tabs.selected.even.fg = ultramar['dark0']

## Background color of selected odd tabs.
## Type: QtColor
c.colors.tabs.selected.odd.bg = ultramar['cyan2']

## Foreground color of selected odd tabs.
## Type: QtColor
c.colors.tabs.selected.odd.fg = ultramar['dark0']

## Background color for webpages if unset (or empty to use the theme's
## color)
## Type: QtColor
# c.colors.webpage.bg = ultramar['dark0']

# ------------ Key bindings ----------------

# Why end the shortcuts in 9 when you still have one more useful key (0)?
config.bind('<Alt-9>', 'tab-focus 9', mode='normal')
config.bind('<Alt-0>', 'tab-focus -1', mode='normal')

# Open links externally with xdg-open (i.e. to open youtube videos with mpv, or
# images with sxiv or imv, etc.)
config.bind(',x', 'spawn xdg-open {url}')
config.bind(',X', 'hint links spawn xdg-open {hint-url}')

# Bindings for Russian keyboard layout (my most used bindings)

config.bind('Р', 'back', mode='normal')
config.bind('О', 'tab-next', mode='normal')
config.bind('Л', 'tab-prev', mode='normal')
config.bind('Д', 'forward', mode='normal')

config.bind('щ', 'set-cmd-text :open ', mode='normal')
config.bind('Щ', 'set-cmd-text :open -t ', mode='normal')
config.bind('пщ', 'set-cmd-text :open {url:pretty}', mode='normal')
config.bind('пЩ', 'set-cmd-text :open -t -r {url:pretty}', mode='normal')

config.bind('г', 'undo', mode='normal')
config.bind('в', 'tab-close', mode='normal')
config.bind('В', 'tab-close -o', mode='normal')
config.bind('пС', 'tab-clone', mode='normal')

config.bind('а', 'hint', mode='normal')
config.bind('А', 'hint all tab', mode='normal')

config.bind('ш', 'reload', mode='normal')
config.bind('Ш', 'reload -f', mode='normal')

config.bind('р', 'scroll left', mode='normal')
config.bind('о', 'scroll down', mode='normal')
config.bind('л', 'scroll up', mode='normal')
config.bind('д', 'scroll right', mode='normal')
config.bind('пп', 'scroll-to-perc 0', mode='normal')
config.bind('П', 'scroll-to-perc', mode='normal')

config.bind('ш', 'mode-enter insert', mode='normal')

config.bind('Т', 'search-prev', mode='normal')
config.bind('т', 'search-next', mode='normal')