1import sys23c = c4config = config56config.load_autoconfig(False)78# Userscripts:9# https://github.com/qutebrowser/qutebrowser/tree/main/misc/userscripts1011# copy from https://paste.sr.ht/~fossdd/00306cb5d781594ad4f365447300953ed56362701213c.auto_save.session = True1415c.changelog_after_upgrade = "patch"16c.completion.web_history.max_items = 1000000017# c.content.javascript.enabled = False18c.content.headers.accept_language = "en-US,en;q=0.5"19c.content.headers.custom = {20 "accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"21}2223c.content.notifications.enabled = False24c.content.pdfjs = False25c.downloads.location.directory = "~/downloads"26c.downloads.location.prompt = False27c.downloads.position = "bottom"28c.hints.border = "1px solid #522B8D"29c.content.prefers_reduced_motion = True30c.qt.chromium.experimental_web_platform_features = "always"31c.qt.chromium.low_end_device_mode = "never"32c.scrolling.bar = "never"33c.tabs.background = True34c.tabs.last_close = "close"35c.tabs.pinned.frozen = False36c.tabs.select_on_remove = "last-used"37c.tabs.show = "multiple"38c.url.start_pages = ["https://www.google.com.hk/"]39c.url.searchengines = {'DEFAULT': "https://www.google.com.hk/search?q={}"}40# c.url.default_page = c.url.start_pages41c.window.hide_decoration = True42c.window.title_format = "{perc}qutebrowser"43c.aliases["mpv"] = "spawn --userscript view_in_mpv"44c.aliases["o"] = "open"45c.aliases["pw"] = "spawn --userscript qute-pass"46c.colors.webpage.darkmode.enabled = False47c.colors.webpage.darkmode.policy.images = "never"48c.colors.webpage.preferred_color_scheme = "light"49c.content.proxy = "socks5://localhost:14080"5051config.bind("<Ctrl+Shift+Tab>", "tab-prev")52config.bind("<Ctrl+Tab>", "tab-next")53config.bind("pa", "pw -w")54config.bind("po", "pw -o")55config.bind("pr", "TODO proxy")56config.bind("pw", "pw")5758c.input.match_counts = False59c.input.insert_mode.plugins = True60c.input.insert_mode.auto_load = True61c.input.forward_unbound_keys = "all"62ESC_BIND = 'clear-keychain ;; search ;; fullscreen --leave'63c.bindings.default['normal'] = {}64# Bindings65c.bindings.commands['normal'] = {66 # Navigation67 '<ctrl-v>': 'scroll-page 0 0.9',68 '<alt-v>': 'scroll-page 0 -0.9',69 '<Backspace>': 'scroll-page 0 -0.9',70 # '<Space>': 'scroll-page 0 0.9',71 '<alt-shift-,>': 'scroll-to-perc',72 '<alt-shift-.>': 'scroll-to-perc 0',737475 # Commands76 '<alt-x>': 'cmd-set-text :',77 '<ctrl-x><ctrl-c>': 'quit',7879 # searching80 '<ctrl-s>': 'cmd-set-text /',81 '<ctrl-r>': 'cmd-set-text ?',8283 # hinting84 '<f>': 'hint all',85 '<ctrl-u><f>': 'hint all hover',86 '<shift-f>': 'hint all tab-bg',87 '<ctrl-u><shift-e>': 'hint all tab-fg',88 '<w><l>': 'hint all yank-primary',89 '<w><w>': 'yank url',90 '<d>': 'yank all download',9192 # history93 '<shift-f>': 'forward',94 '<shift-b>': 'back',95 '<ctrl-c><ctrl-f>': 'forward',96 '<ctrl-c><ctrl-b>': 'back',97 '<shift-h>': 'history',9899 # bookmarks100 'm': 'bookmark-add',101 'M': 'open qute://bookmarks',102103104 # tabs105 '<ctrl-tab>': 'tab-next',106 '<ctrl-shift-tab>': 'tab-prev',107 '<alt-n>': 'tab-next',108 '<shift-alt-n>': 'tab-move +',109 '<alt-p>': 'tab-prev',110 '<shift-alt-p>': 'tab-move -',111 '<ctrl-x><b>': 'cmd-set-text -s :buffer',112 '<ctrl-x><k>': 'tab-close',113 '<ctrl-c><p>': 'tab-pin',114 '<ctrl-c><m>': 'tab-mute',115 '<ctrl-x><0>': 'tab-close',116 '<ctrl-x><1>': 'tab-only',117 '<Alt-1>': 'tab-focus 1',118 '<Alt-2>': 'tab-focus 2',119 '<Alt-3>': 'tab-focus 3',120 '<Alt-4>': 'tab-focus 4',121 '<Alt-5>': 'tab-focus 5',122 '<Alt-6>': 'tab-focus 6',123 '<Alt-7>': 'tab-focus 7',124 '<Alt-8>': 'tab-focus 8',125 '<Alt-9>': 'tab-focus -1',126127 # frames128 '<ctrl-x><5><0>': 'close',129 '<ctrl-x><5><1>': 'window-only',130 '<ctrl-x><5><2>': 'cmd-set-text -s :open -w',131 '<ctrl-u><ctrl-x><5><2>': 'cmd-set-text -s :open -p',132133 # open links134 '<g>': 'cmd-set-text -s :open',135 '<shift-g>': 'cmd-set-text -s :open -t',136137 # editing138 '<ctrl-f>': 'fake-key <Right>',139 '<ctrl-b>': 'fake-key <Left>',140 '<ctrl-a>': 'fake-key <Home>',141 '<ctrl-e>': 'fake-key <End>',142 '<ctrl-n>': 'fake-key <Down>',143 '<ctrl-p>': 'fake-key <Up>',144 '<alt-f>': 'fake-key <Ctrl-Right>',145 '<alt-b>': 'fake-key <Ctrl-Left>',146 '<ctrl-d>': 'fake-key <Delete>',147 '<alt-d>': 'fake-key <Ctrl-Delete>',148 '<alt-backspace>': 'fake-key <Ctrl-Backspace>',149 '<ctrl-w>': 'fake-key <Ctrl-backspace>',150 '<ctrl-y>': 'insert-text {primary}',151152 # misc153 '<ctrl-c><v>': 'spawn --userscript ~/.bin/open_in_mpv.sh',154155 # Help156 '<ctrl-h><b>': 'open qute://bindings',157 '<ctrl-h><h>': 'cmd-set-text -s :help',158159 # escape hatch160 '<ctrl-g>': ESC_BIND,161162 '<ctrl-->': 'zoom-out',163 '<ctrl-=>': 'zoom-in',164 '<ctrl-l>': 'reload'165}166167168c.bindings.commands['command'] = {169 '<ctrl-s>': 'search-next',170 '<ctrl-r>': 'search-prev',171172 '<ctrl-p>': 'completion-item-focus prev',173 '<ctrl-n>': 'completion-item-focus next',174175 '<alt-p>': 'command-history-prev',176 '<alt-n>': 'command-history-next',177178 # escape hatch179 '<ctrl-g>': 'mode-leave',180}181182c.bindings.commands['hint'] = {183 # escape hatch184 '<ctrl-g>': 'mode-leave',185}186187188c.bindings.commands['caret'] = {189 # escape hatch190 '<ctrl-g>': 'mode-leave',191}192193c.bindings.commands['insert'] = {194 # editing195 '<ctrl-f>': 'fake-key <Right>',196 '<ctrl-b>': 'fake-key <Left>',197 '<ctrl-a>': 'fake-key <Home>',198 '<ctrl-e>': 'fake-key <End>',199 '<ctrl-n>': 'fake-key <Down>',200 '<ctrl-p>': 'fake-key <Up>',201 '<alt-f>': 'fake-key <Ctrl-Right>',202 '<alt-b>': 'fake-key <Ctrl-Left>',203 '<ctrl-d>': 'fake-key <Delete>',204 '<alt-d>': 'fake-key <Ctrl-Delete>',205 '<alt-backspace>': 'fake-key <Ctrl-Backspace>',206 '<ctrl-w>': 'fake-key <Ctrl-backspace>',207 '<ctrl-y>': 'insert-text {primary}',208 '<ctrl-g>': 'mode-leave'209}210211def emacs_keybinds():212 pass213214def colors():215 blue = [216 "colors.completion.category.bg",217 "colors.completion.item.selected.bg",218 "colors.completion.item.selected.border.bottom",219 "colors.completion.item.selected.border.top",220 "colors.contextmenu.selected.bg",221 "colors.hints.bg",222 "colors.tabs.selected.even.bg",223 "colors.tabs.selected.odd.bg",224 ]225226 black = [227 "colors.completion.even.bg",228 "colors.completion.odd.bg",229 "colors.completion.scrollbar.bg",230 "colors.contextmenu.menu.bg",231 "colors.statusbar.normal.bg",232 "colors.tabs.even.bg",233 "colors.tabs.odd.bg",234 "colors.webpage.bg",235 ]236237 white = [238 "colors.completion.category.fg",239 "colors.completion.item.selected.fg",240 "colors.completion.scrollbar.fg",241 "colors.contextmenu.menu.fg",242 "colors.contextmenu.selected.fg",243 "colors.hints.fg",244 "colors.messages.error.fg",245 "colors.messages.warning.fg",246 "colors.prompts.fg",247 "colors.statusbar.url.success.https.fg",248 "colors.tabs.even.fg",249 "colors.tabs.odd.fg",250 ]251252 c.colors.completion.fg = ["#fff", "#fff", "#fff"]253 c.colors.hints.match.fg = "yellow"254255 for color in blue:256 config.set(color, "#522B8D")257 for color in white:258 config.set(color, "#fff")259 for color in black:260 config.set(color, "#000")261262263def adblock():264 c.content.blocking.hosts.lists = [265 # Links extracted from <https://github.com/mullvad/dns-blocklists>266 # Last update: 204a240267 #268 # Trackers269 "https://v.firebog.net/hosts/Easyprivacy.txt",270 "https://cdn.jsdelivr.net/gh/hagezi/dns-blocklists@latest/domains/native.amazon.txt",271 "https://cdn.jsdelivr.net/gh/hagezi/dns-blocklists@latest/domains/native.apple.txt",272 "https://cdn.jsdelivr.net/gh/hagezi/dns-blocklists@latest/domains/native.huawei.txt",273 "https://cdn.jsdelivr.net/gh/hagezi/dns-blocklists@latest/domains/native.winoffice.txt",274 "https://cdn.jsdelivr.net/gh/hagezi/dns-blocklists@latest/domains/native.tiktok.extended.txt",275 "https://cdn.jsdelivr.net/gh/hagezi/dns-blocklists@latest/domains/native.lgwebos.txt",276 "https://cdn.jsdelivr.net/gh/hagezi/dns-blocklists@latest/domains/native.vivo.txt",277 "https://cdn.jsdelivr.net/gh/hagezi/dns-blocklists@latest/domains/native.oppo-realme.txt",278 "https://cdn.jsdelivr.net/gh/hagezi/dns-blocklists@latest/domains/native.xiaomi.txt",279 "https://raw.githubusercontent.com/mullvad/dns-blocklists/main/files/tracker",280 # Ads281 "https://small.oisd.nl/rpz",282 "https://raw.githubusercontent.com/lassekongo83/Frellwits-filter-lists/master/Frellwits-Swedish-Hosts-File.txt",283 "https://v.firebog.net/hosts/AdguardDNS.txt",284 # Adult285 "https://nsfw.oisd.nl/rpz",286 # Gambling287 "https://raw.githubusercontent.com/hagezi/dns-blocklists/main/wildcard/gambling-onlydomains.txt",288 # Social289 # "https://raw.githubusercontent.com/mullvad/dns-blocklists/main/files/social",290 # Malware291 "https://urlhaus.abuse.ch/downloads/hostfile",292 "https://cdn.jsdelivr.net/gh/hagezi/dns-blocklists@latest/rpz/tif.mini.txt",293 ]294 c.content.blocking.method = "both"295296297emacs_keybinds()298colors()299adblock()300