diff options
Diffstat (limited to '.config/qutebrowser')
-rwxr-xr-x | .config/qutebrowser/config.py | 189 | ||||
-rwxr-xr-x | .config/qutebrowser/greasemonkey/1337x.js | 12 | ||||
-rwxr-xr-x | .config/qutebrowser/greasemonkey/amazon.js | 62 | ||||
-rwxr-xr-x | .config/qutebrowser/greasemonkey/boursobank.js (renamed from .config/qutebrowser/greasemonkey/boursorama.js) | 2 | ||||
-rwxr-xr-x | .config/qutebrowser/greasemonkey/gitlab.js | 2 | ||||
-rwxr-xr-x | .config/qutebrowser/greasemonkey/imgur-to-rimgo.js | 3 | ||||
-rwxr-xr-x | .config/qutebrowser/greasemonkey/old-wiki.js | 30 | ||||
-rwxr-xr-x | .config/qutebrowser/greasemonkey/quora-to-quetre.js | 8 | ||||
-rwxr-xr-x | .config/qutebrowser/greasemonkey/reddit-to-teddit.js | 6 | ||||
-rwxr-xr-x | .config/qutebrowser/greasemonkey/unsplash.js | 9 | ||||
-rwxr-xr-x | .config/qutebrowser/greasemonkey/yewtube.js | 2 |
11 files changed, 228 insertions, 97 deletions
diff --git a/.config/qutebrowser/config.py b/.config/qutebrowser/config.py index e24591b..4a44eef 100755 --- a/.config/qutebrowser/config.py +++ b/.config/qutebrowser/config.py @@ -1,4 +1,3 @@ - # ~/.config/qutebrowser/config.py # rgoncalves.se @@ -8,12 +7,10 @@ import os import re import socket -from PyQt5.QtCore import QUrl +from PyQt6.QtCore import QUrl from qutebrowser.api import cmdutils -from qutebrowser.browser.urlmarks import ( - AlreadyExistsError as UrlAlreadyExistsError -) +from qutebrowser.browser.urlmarks import AlreadyExistsError as UrlAlreadyExistsError from qutebrowser.browser.urlmarks import UrlMarkManager from qutebrowser.config.config import ConfigContainer from qutebrowser.config.configfiles import ConfigAPI @@ -27,13 +24,11 @@ c: ConfigContainer = c # noqa: F821 pylint: disable=E0602,C0103 logging.basicConfig(level=logging.DEBUG) -UrlMarkManager.save = ( - lambda manager: urlmarkmanager_save(manager, config.configdir) -) +UrlMarkManager.save = lambda manager: urlmarkmanager_save(manager, config.configdir) def is_musl_system() -> bool: - return bool(re.search('musl', os.popen('ldd /bin/ls').read())) + return bool(re.search("musl", os.popen("ldd /bin/ls").read())) def get_qt_arguments() -> list: @@ -41,24 +36,24 @@ def get_qt_arguments() -> list: Select best arguments for launching qutebrowser. Empty by default, it picks lag free options for musl systems. """ - filters = { - 'disable-seccomp-filter-sandbox': is_musl_system() - } + filters = {"disable-seccomp-filter-sandbox": is_musl_system()} - return list( - filter(lambda x: x, map(lambda x: x[1], list(filters.items()))) - ) + return list(filter(lambda x: x, map(lambda x: x[1], list(filters.items())))) try: + @cmdutils.register() def bookmark_save(url: QUrl): """Save the current page as a bookmark.""" - manager = objreg.get('bookmark-manager') + manager = objreg.get("bookmark-manager") tags = message.ask( title="Add bookmark:", mode=PromptMode.text, - url=url.toString(QUrl.RemovePassword | QUrl.FullyEncoded), + url=url.toString( + QUrl.UrlFormattingOption.RemovePassword + | QUrl.ComponentFormattingOption.FullyEncoded + ), text=( "Please enter bookmark tags for<br/><b>" f"{html.escape(url.toDisplayString())}</b>" @@ -72,90 +67,102 @@ try: manager.add(url, tags) except UrlAlreadyExistsError: message.warning("Bookmark already exists.") + except ValueError: pass config.load_autoconfig(False) -config.set('auto_save.session', True) -config.set('scrolling.smooth', False) -config.set('qt.highdpi', False) -config.set('qt.force_software_rendering', 'none') -config.set('qt.args', get_qt_arguments()) -config.set('messages.timeout', 2500) - -config.set('content.images', True, 'chrome-devtools://*') -config.set('content.images', True, 'devtools://*') -config.set('content.javascript.enabled', True, 'chrome-devtools://*') -config.set('content.javascript.enabled', True, 'devtools://*') -config.set('content.javascript.enabled', True, 'chrome://*/*') -config.set('content.javascript.enabled', True, 'qute://*/*') - -config.set('content.notifications.enabled', False) -config.set('content.notifications.enabled', True, '*://*.zoho.eu/*') -config.set('content.notifications.enabled', True, '*://*.viperdev.io/*') -config.set('content.notifications.enabled', True, '*://*.rgoncalves.se/*') -config.set('content.notifications.enabled', True, '*://app.slack.com/*') -config.set('content.notifications.enabled', True, '*://mail.google.com/*') - -config.set('content.register_protocol_handler', False) -config.set('content.geolocation', False) +config.set("auto_save.session", True) +config.set("scrolling.smooth", False) +config.set("scrolling.bar", "always") +config.set("qt.highdpi", False) +config.set("qt.force_software_rendering", "none") +config.set("qt.args", get_qt_arguments()) +config.set("messages.timeout", 2500) + +config.set("content.images", True, "chrome-devtools://*") +config.set("content.images", True, "devtools://*") +config.set("content.javascript.enabled", True, "chrome-devtools://*") +config.set("content.javascript.enabled", True, "devtools://*") +config.set("content.javascript.enabled", True, "chrome://*/*") +config.set("content.javascript.enabled", True, "qute://*/*") + +config.set("content.notifications.enabled", False) +config.set("content.notifications.enabled", True, "*://*.zoho.eu/*") +config.set("content.notifications.enabled", True, "*://*.viperdev.io/*") +config.set("content.notifications.enabled", True, "*://*.rgoncalves.se/*") +config.set("content.notifications.enabled", True, "*://app.slack.com/*") +config.set("content.notifications.enabled", True, "*://mail.google.com/*") + +config.set("content.register_protocol_handler", False) +config.set("content.geolocation", False) # config.set('content.media.audio_video_capture', True, '*://*.zoho.eu/*') # config.set('content.media.audio_capture', True, '*://*.zoho.eu/*') # config.set('content.media.video_capture', True, '*://*.zoho.eu/*') -config.set('content.media.audio_video_capture', True, 'https://meet.google.com/*') -config.set('content.media.audio_capture', True, 'https://meet.google.com/*') -config.set('content.media.video_capture', True, 'https://meet.google.com/*') - -config.set('completion.web_history.max_items', 0) -config.set('tabs.background', True) -config.set('tabs.indicator.width', 3) -config.set('tabs.indicator.padding', - {'bottom': 0, 'left': 1, 'right': 4, 'top': 0}) - -config.set('fonts.default_family', 'Terminus') -config.set('fonts.default_size', '12pt') - -config.set('colors.tabs.bar.bg', '#000000') -config.set('colors.tabs.even.bg', '#000000') -config.set('colors.tabs.even.fg', '#ffffff') -config.set('colors.tabs.odd.bg', '#000000') -config.set('colors.tabs.odd.fg', '#ffffff') -config.set('colors.tabs.indicator.system', 'none') -config.set('colors.tabs.selected.even.bg', '#ffffff') -config.set('colors.tabs.selected.even.fg', '#000000') -config.set('colors.tabs.selected.odd.bg', '#ffffff') -config.set('colors.tabs.selected.odd.fg', '#000000') -config.set('colors.tabs.pinned.selected.even.bg', '#ffffff') -config.set('colors.tabs.pinned.selected.odd.bg', '#ffffff') -config.set('colors.tabs.pinned.selected.even.fg', '#000000') -config.set('colors.tabs.pinned.selected.odd.fg', '#000000') -config.set('colors.tabs.indicator.error', '#ff0000') - -config.set('content.prefers_reduced_motion', True) -config.set('content.headers.referer', 'same-domain') -config.set('url.default_page', 'https://lite.duckduckgo.com/lite/') -config.set('url.start_pages', 'https://lite.duckduckgo.com/lite/') -config.set( - 'url.searchengines', {'DEFAULT': 'https://lite.duckduckgo.com/lite/?q={}'} -) - -config.set('downloads.location.directory', f'{os.environ["HOME"]}/downloads') -config.set('downloads.prevent_mixed_content', False) -config.set('content.autoplay', False) -config.set('content.cookies.accept', 'no-3rdparty') -config.set('content.javascript.alert', False) - -config.set('content.headers.do_not_track', False, '*://*.thetrainline.com/*') -config.set('content.blocking.enabled', False, '*://*.thetrainline.com/*') -config.set('content.cookies.accept', 'all', '*://*.thetrainline.com/*') +config.set("content.media.audio_video_capture", True, "https://meet.google.com/*") +config.set("content.media.audio_capture", True, "https://meet.google.com/*") +config.set("content.media.video_capture", True, "https://meet.google.com/*") + +config.set("completion.web_history.max_items", 0) +config.set("tabs.background", True) +config.set("tabs.indicator.width", 3) +config.set("tabs.indicator.padding", {"bottom": 0, "left": 1, "right": 4, "top": 0}) + +config.set("fonts.default_family", "Terminus") +config.set("fonts.default_size", "12pt") + +config.set("colors.tabs.bar.bg", "#000000") +config.set("colors.tabs.even.bg", "#000000") +config.set("colors.tabs.even.fg", "#ffffff") +config.set("colors.tabs.odd.bg", "#000000") +config.set("colors.tabs.odd.fg", "#ffffff") +config.set("colors.tabs.indicator.system", "none") +config.set("colors.tabs.selected.even.bg", "#ffffff") +config.set("colors.tabs.selected.even.fg", "#000000") +config.set("colors.tabs.selected.odd.bg", "#ffffff") +config.set("colors.tabs.selected.odd.fg", "#000000") +config.set("colors.tabs.pinned.selected.even.bg", "#ffffff") +config.set("colors.tabs.pinned.selected.odd.bg", "#ffffff") +config.set("colors.tabs.pinned.selected.even.fg", "#000000") +config.set("colors.tabs.pinned.selected.odd.fg", "#000000") +config.set("colors.tabs.indicator.error", "#ff0000") +config.set("tabs.padding", {"bottom": 0, "left": 4, "right": 4, "top": 0}) + +config.set("content.prefers_reduced_motion", True) +config.set("content.headers.referer", "same-domain") +# config.set('url.default_page', 'https://lite.duckduckgo.com/lite/') +# config.set('url.start_pages', 'https://lite.duckduckgo.com/lite/') +config.set("url.default_page", "qute://start") +config.set("url.start_pages", "qute://start") +config.set("url.searchengines", {"DEFAULT": "https://lite.duckduckgo.com/lite/?q={}"}) + +config.set("downloads.location.directory", f'{os.environ["HOME"]}/downloads') +config.set("downloads.prevent_mixed_content", False) +config.set("content.autoplay", False) +config.set("content.cookies.accept", "no-3rdparty") +config.set("content.javascript.alert", False) + +config.set("content.headers.do_not_track", False, "*://*.thetrainline.com/*") +config.set("content.blocking.enabled", False, "*://*.thetrainline.com/*") +config.set("content.cookies.accept", "all", "*://*.thetrainline.com/*") config.set( - 'editor.command', ["st", "nvim", "+normal {line}G{column0}l", "{file}"] + "content.blocking.adblock.lists", + [ + "https://easylist.to/easylist/easylist.txt", + "https://easylist.to/easylist/easyprivacy.txt", + "https://easylist-downloads.adblockplus.org/easylistdutch.txt", + "https://easylist-downloads.adblockplus.org/abp-filters-anti-cv.txt", + "https://www.i-dont-care-about-cookies.eu/abp/", + "https://secure.fanboy.co.nz/fanboy-cookiemonster.txt", + ], ) -config.bind(',m', 'spawn mpv --force-window=immediate {url}') -config.bind('M', 'bookmark-save {url}') +config.set("editor.command", ["st", "nvim", "+normal {line}G{column0}l", "{file}"]) + +config.bind(",m", "spawn mpv --force-window=immediate {url}") +config.bind("M", "bookmark-save {url}") -if socket.gethostname() == 'ws-work01': - config.set('fonts.default_size', '14pt') +if socket.gethostname() == "ws-work01": + config.set("fonts.default_size", "14pt") diff --git a/.config/qutebrowser/greasemonkey/1337x.js b/.config/qutebrowser/greasemonkey/1337x.js new file mode 100755 index 0000000..e892ba9 --- /dev/null +++ b/.config/qutebrowser/greasemonkey/1337x.js @@ -0,0 +1,12 @@ +// ==UserScript== +// @name 1337x css +// @match *://1337x.to/* +// @grant none +// ==/UserScript== + +GM_addStyle(` + body > a:nth-last-child(2), + body > a:nth-last-child(1) { + z-index: -1 !important; + } +`) diff --git a/.config/qutebrowser/greasemonkey/amazon.js b/.config/qutebrowser/greasemonkey/amazon.js new file mode 100755 index 0000000..0edf4fd --- /dev/null +++ b/.config/qutebrowser/greasemonkey/amazon.js @@ -0,0 +1,62 @@ +// ==UserScript== +// @name Amazon CamelCamelCamel + Keepa Price Charts +// @version 1.0.8 +// @description Add a CamelCamelCamel and Keepa price charts to Amazon product pages. +// @author miki.it +// @namespace null +// @homepage https://github.com/mikispag/userscripts/ +// @include https://www.amazon.*/* +// @include https://smile.amazon.*/* +// @run-at document-end +// @downloadURL https://update.greasyfork.org/scripts/416590/Amazon%20CamelCamelCamel%20%2B%20Keepa%20Price%20Charts.user.js +// @updateURL https://update.greasyfork.org/scripts/416590/Amazon%20CamelCamelCamel%20%2B%20Keepa%20Price%20Charts.meta.js +// ==/UserScript== + +function getASIN() { + var asinElement = document.getElementById("ASIN") || document.evaluate("//@data-asin", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue; + if (!asinElement) { + throw new Error("Amazon CamelCamelCamel + Keepa Price Charts: unable to find ASIN!"); + } + return asinElement.value; +} + +window.addEventListener("load", function() { + var tld = document.domain.split(".").pop(); + var country = tld; + if (tld == "com") { + country = "us"; + } + + var asin = getASIN(); + if (!asin) { + throw new Error("Amazon CamelCamelCamel + Keepa Price Charts: unable to get ASIN!"); + } + + var parentElement = document.getElementById("unifiedPrice_feature_div") || document.getElementById("MediaMatrix"); + if (!parentElement) { + throw new Error("Amazon CamelCamelCamel + Keepa Price Charts: unable to get parent element!"); + } + + var camelChartContainer = document.createElement("div"); + var camelLink = document.createElement("a"); + camelLink.target = "_blank"; + camelLink.href = "https://" + country + ".camelcamelcamel.com/product/" + asin; + var camelChart = new Image(500, 400); + camelChart.src = "https://charts.camelcamelcamel.com/" + country + "/" + asin + "/amazon-new-used.png?force=1&zero=0&w=500&h=400&desired=false&legend=1&ilt=1&tp=all&fo=0"; + camelLink.appendChild(camelChart); + camelChartContainer.appendChild(camelLink); + + var keepaChartContainer = document.createElement("div"); + var keepaLink = document.createElement("a"); + keepaLink.target = "_blank"; + keepaLink.href = "https://keepa.com/#!product/8-" + asin; + var keepaChart = new Image(500, 200); + keepaChart.src = "https://graph.keepa.com/pricehistory.png?used=1&asin=" + asin + "&domain=" + tld; + keepaLink.appendChild(keepaChart); + keepaChartContainer.appendChild(keepaLink); + + var chartsContainer = document.createElement("div"); + chartsContainer.appendChild(camelChartContainer); + chartsContainer.appendChild(keepaChartContainer); + parentElement.appendChild(chartsContainer); +}, false); diff --git a/.config/qutebrowser/greasemonkey/boursorama.js b/.config/qutebrowser/greasemonkey/boursobank.js index 771bc38..6752ce3 100755 --- a/.config/qutebrowser/greasemonkey/boursorama.js +++ b/.config/qutebrowser/greasemonkey/boursobank.js @@ -1,6 +1,6 @@ // ==UserScript== // @name boursorama css -// @match *://*.boursorama.com/* +// @match *://*.boursobank.com/* // @grant none // ==/UserScript== diff --git a/.config/qutebrowser/greasemonkey/gitlab.js b/.config/qutebrowser/greasemonkey/gitlab.js index 5ebb8a3..987ca72 100755 --- a/.config/qutebrowser/greasemonkey/gitlab.js +++ b/.config/qutebrowser/greasemonkey/gitlab.js @@ -1,6 +1,6 @@ // ==UserScript== // @name gitlab -// @match *://*/* +// @match *://*gitlab*/* // @run-at document-end // @grant none // ==/UserScript== diff --git a/.config/qutebrowser/greasemonkey/imgur-to-rimgo.js b/.config/qutebrowser/greasemonkey/imgur-to-rimgo.js index d0735cb..7c0e240 100755 --- a/.config/qutebrowser/greasemonkey/imgur-to-rimgo.js +++ b/.config/qutebrowser/greasemonkey/imgur-to-rimgo.js @@ -5,4 +5,5 @@ // @run-at document-start // ==/UserScript== -top.location.hostname = "rimgo.pussthecat.org"; +// top.location.hostname = "rimgo.pussthecat.org"; +top.location.hostname = "rimgo.ducks.party"; diff --git a/.config/qutebrowser/greasemonkey/old-wiki.js b/.config/qutebrowser/greasemonkey/old-wiki.js new file mode 100755 index 0000000..d14775b --- /dev/null +++ b/.config/qutebrowser/greasemonkey/old-wiki.js @@ -0,0 +1,30 @@ +// ==UserScript== +// @name old wiki vector style +// @match *://*.wikipedia.org/* +// @match *://*.wiki.archlinux.org/* +// @grant none +// ==/UserScript== + +(function() { + const url = new URL(window.location.href); + + if(url.toString().indexOf('useskin') === -1){ + url.searchParams.set('useskin', 'vector'); + location.replace(url); + } + + const a = document.getElementsByTagName('a'); + + for (var i = 0; i < a.length; ++i){ + if(a[i].href.indexOf(window.location.host) === -1){ + continue; + } + + let href = new URL(a[i].href); + href.searchParams.set('useskin', 'vector'); + a[i].href = href; + } + + url.searchParams.delete('useskin'); + history.replaceState(null, document.title, url.href); +})(); diff --git a/.config/qutebrowser/greasemonkey/quora-to-quetre.js b/.config/qutebrowser/greasemonkey/quora-to-quetre.js new file mode 100755 index 0000000..8379119 --- /dev/null +++ b/.config/qutebrowser/greasemonkey/quora-to-quetre.js @@ -0,0 +1,8 @@ +// ==UserScript== +// @name quora to quetre +// @match *://www.quora.com/* +// @grant none +// @run-at document-start +// ==/UserScript== + +top.location.hostname = "quetre.pussthecat.org"; diff --git a/.config/qutebrowser/greasemonkey/reddit-to-teddit.js b/.config/qutebrowser/greasemonkey/reddit-to-teddit.js index 8c1ee6b..788fecd 100755 --- a/.config/qutebrowser/greasemonkey/reddit-to-teddit.js +++ b/.config/qutebrowser/greasemonkey/reddit-to-teddit.js @@ -1,9 +1,11 @@ // ==UserScript== // @name reddit to teddit -// @match *://*.reddit.com/* // @match *://reddit.com/* +// @match *://www.reddit.com/* +// @exclude *://www.reddit.com/media* // @grant none // @run-at document-start // ==/UserScript== -top.location.hostname = "teddit.net"; +// top.location.hostname = "teddit.net"; +top.location.hostname = "old.reddit.com"; diff --git a/.config/qutebrowser/greasemonkey/unsplash.js b/.config/qutebrowser/greasemonkey/unsplash.js index 7d65781..17b117b 100755 --- a/.config/qutebrowser/greasemonkey/unsplash.js +++ b/.config/qutebrowser/greasemonkey/unsplash.js @@ -12,6 +12,7 @@ console.log("AAAAAAAA"); e.remove(); }); + })(); GM_addStyle(` @@ -21,3 +22,11 @@ GM_addStyle(` height: 0; } `) + +const text = 'Unsplash+'; +for (const container of document.querySelectorAll('figure')) { + if (container.textContent.includes(text)) { + container.remove(); + } + console.log(container); +} diff --git a/.config/qutebrowser/greasemonkey/yewtube.js b/.config/qutebrowser/greasemonkey/yewtube.js index c9f592b..f67db1b 100755 --- a/.config/qutebrowser/greasemonkey/yewtube.js +++ b/.config/qutebrowser/greasemonkey/yewtube.js @@ -6,4 +6,4 @@ // @run-at document-start // ==/UserScript== -document.cookie = "PREFS=%7B%22annotations%22%3Atrue%2C%22annotations_subscribed%22%3Afalse%2C%22autoplay%22%3Atrue%2C%22automatic_instance_redirect%22%3Atrue%2C%22captions%22%3A%5B%22%22%2C%22%22%2C%22%22%5D%2C%22comments%22%3A%5B%22youtube%22%2C%22reddit%22%5D%2C%22continue%22%3Afalse%2C%22continue_autoplay%22%3Atrue%2C%22dark_mode%22%3A%22light%22%2C%22latest_only%22%3Afalse%2C%22listen%22%3Afalse%2C%22local%22%3Atrue%2C%22watch_history%22%3Afalse%2C%22vr_mode%22%3Atrue%2C%22show_nick%22%3Afalse%2C%22locale%22%3A%22en-US%22%2C%22region%22%3A%22US%22%2C%22max_results%22%3A40%2C%22notifications_only%22%3Afalse%2C%22player_style%22%3A%22invidious%22%2C%22quality%22%3A%22dash%22%2C%22quality_dash%22%3A%221080p%22%2C%22default_home%22%3A%22%22%2C%22feed_menu%22%3A%5B%22Popular%22%2C%22Trending%22%5D%2C%22related_videos%22%3Atrue%2C%22sort%22%3A%22published%22%2C%22speed%22%3A1.0%2C%22thin_mode%22%3Afalse%2C%22unseen_only%22%3Afalse%2C%22video_loop%22%3Afalse%2C%22extend_desc%22%3Afalse%2C%22volume%22%3A50%2C%22save_player_pos%22%3Afalse%7D" +// document.cookie = "PREFS=%7B%22annotations%22%3Atrue%2C%22annotations_subscribed%22%3Afalse%2C%22autoplay%22%3Atrue%2C%22automatic_instance_redirect%22%3Atrue%2C%22captions%22%3A%5B%22%22%2C%22%22%2C%22%22%5D%2C%22comments%22%3A%5B%22youtube%22%2C%22reddit%22%5D%2C%22continue%22%3Afalse%2C%22continue_autoplay%22%3Atrue%2C%22dark_mode%22%3A%22light%22%2C%22latest_only%22%3Afalse%2C%22listen%22%3Afalse%2C%22local%22%3Atrue%2C%22watch_history%22%3Afalse%2C%22vr_mode%22%3Atrue%2C%22show_nick%22%3Afalse%2C%22locale%22%3A%22en-US%22%2C%22region%22%3A%22US%22%2C%22max_results%22%3A40%2C%22notifications_only%22%3Afalse%2C%22player_style%22%3A%22invidious%22%2C%22quality%22%3A%22dash%22%2C%22quality_dash%22%3A%221080p%22%2C%22default_home%22%3A%22%22%2C%22feed_menu%22%3A%5B%22Popular%22%2C%22Trending%22%5D%2C%22related_videos%22%3Atrue%2C%22sort%22%3A%22published%22%2C%22speed%22%3A1.0%2C%22thin_mode%22%3Afalse%2C%22unseen_only%22%3Afalse%2C%22video_loop%22%3Afalse%2C%22extend_desc%22%3Afalse%2C%22volume%22%3A50%2C%22save_player_pos%22%3Afalse%7D" |