51 lines
1.5 KiB
Python
51 lines
1.5 KiB
Python
#!/usr/bin/env python3
|
|
|
|
from PyQt6.QtCore import QUrl
|
|
from qutebrowser.api import interceptor
|
|
|
|
def rewrite(request: interceptor.Request):
|
|
url = request.request_url
|
|
host = url.host()
|
|
|
|
# Avoid redirect loops
|
|
if "reddit.com" in host and "safereddit.com" not in host:
|
|
new_url = QUrl("https://safereddit.com")
|
|
new_url.setPath(url.path())
|
|
new_url.setQuery(url.query())
|
|
request.redirect(new_url)
|
|
|
|
#interceptor.register(rewrite)
|
|
|
|
# Load existing settings made via :set
|
|
config.load_autoconfig()
|
|
|
|
c.qt.highdpi = True
|
|
c.fonts.default_size = "15pt"
|
|
c.fonts.tabs.selected = "13pt default_family"
|
|
c.fonts.tabs.unselected = "13pt default_family"
|
|
c.zoom.default = "130%"
|
|
c.content.javascript.enabled = False
|
|
c.downloads.location.directory = "~/dls"
|
|
c.editor.command = ["alacritty", "-e", "nvim", "{}"]
|
|
c.editor.encoding = "utf-8"
|
|
c.auto_save.session = True
|
|
c.colors.webpage.preferred_color_scheme = "dark"
|
|
|
|
# privacy
|
|
c.content.cookies.accept = "no-3rdparty"
|
|
c.content.webrtc_ip_handling_policy = "default-public-interface-only"
|
|
c.content.site_specific_quirks.enabled = False
|
|
c.content.headers.user_agent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.5112.79 Safari/537.36"
|
|
|
|
config.bind("j", "scroll-px 0 100")
|
|
config.bind("k", "scroll-px 0 -100")
|
|
config.bind("K", "tab-next")
|
|
config.bind("J", "tab-prev")
|
|
|
|
c.url.searchengines = {
|
|
"DEFAULT": "https://duckduckgo.com/?q={}",
|
|
}
|
|
|
|
c.url.start_pages = ["https://start.duckduckgo.com"]
|
|
|