summaryrefslogtreecommitdiffstats
path: root/.config/qutebrowser
diff options
context:
space:
mode:
Diffstat (limited to '.config/qutebrowser')
-rwxr-xr-x.config/qutebrowser/config.py111
-rwxr-xr-x.config/qutebrowser/greasemonkey/boursorama-css.js18
-rwxr-xr-x.config/qutebrowser/greasemonkey/duckduckgo.js12
-rwxr-xr-x.config/qutebrowser/greasemonkey/github-css.js12
-rwxr-xr-x.config/qutebrowser/greasemonkey/imgur-to-imgin.js8
-rwxr-xr-x.config/qutebrowser/greasemonkey/instagram-to-bibliogram.js8
-rwxr-xr-x.config/qutebrowser/greasemonkey/medium-to-scribe.js8
-rwxr-xr-x.config/qutebrowser/greasemonkey/miniflux.js83
-rwxr-xr-x.config/qutebrowser/greasemonkey/minimal-css.js16
-rwxr-xr-x.config/qutebrowser/greasemonkey/no-sticky-headers.js15
-rwxr-xr-x.config/qutebrowser/greasemonkey/reddit-to-teddit.js9
-rwxr-xr-x.config/qutebrowser/greasemonkey/scaleway-css.js11
-rwxr-xr-x.config/qutebrowser/greasemonkey/scribe-css.js16
-rwxr-xr-x.config/qutebrowser/greasemonkey/stackoverflow-css.js15
-rwxr-xr-x.config/qutebrowser/greasemonkey/twitter-to-nitter.js9
-rwxr-xr-x.config/qutebrowser/greasemonkey/youtube-to-yewtube.js9
16 files changed, 360 insertions, 0 deletions
diff --git a/.config/qutebrowser/config.py b/.config/qutebrowser/config.py
new file mode 100755
index 0000000..13dca3f
--- /dev/null
+++ b/.config/qutebrowser/config.py
@@ -0,0 +1,111 @@
+
+# ~/.config/qutebrowser/config.py
+# rgoncalves.se
+
+import logging
+import os
+import re
+import subprocess
+import platform
+
+logging.basicConfig(level=logging.DEBUG)
+
+"""
+Bypass flake8 warnings.
+"""
+try:
+ config
+except NameError:
+ config = None
+
+
+def select_rendering_method():
+ """
+ Select best rendering method depending on hardware and system.
+ """
+ method = 'none'
+
+ if platform.uname().system in 'Linux':
+ lspci_bin = subprocess.run(['lspci'], stdout=subprocess.PIPE)
+ if re.search('NVIDIA', lspci_bin.stdout.decode('utf-8')) is None:
+ method = 'qt-quick'
+
+ return method
+
+
+def select_qt_arguments():
+ """
+ Select best arguments for launching qutebrowser.
+ Empty by default, it picks lag free options for musl systems.
+ """
+ args = []
+ ls_bin = os.popen("ldd /bin/ls").read()
+
+ if re.search('musl', ls_bin) is not None:
+ args.append('disable-seccomp-filter-sandbox')
+
+ return args
+
+
+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', select_rendering_method())
+config.set('qt.args', select_qt_arguments())
+
+config.bind(',m', 'spawn mpv {url}')
+
+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.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('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('content.autoplay', False)
+config.set('content.cookies.accept', 'no-3rdparty')
diff --git a/.config/qutebrowser/greasemonkey/boursorama-css.js b/.config/qutebrowser/greasemonkey/boursorama-css.js
new file mode 100755
index 0000000..4d1c29e
--- /dev/null
+++ b/.config/qutebrowser/greasemonkey/boursorama-css.js
@@ -0,0 +1,18 @@
+// ==UserScript==
+// @name boursorama css
+// @match *://*.boursorama.com/*
+// @grant none
+// ==/UserScript==
+
+GM_addStyle(`
+ .chatbot,
+ .c-promotional-cards-wrapper,
+ .c-articles-wrapper,
+ .c-offers__entry-card {
+ width: 0px !important;
+ height: 0px !important;
+ visibility: hidden;
+ margin: 0px;
+ padding: 0px;
+ }
+`)
diff --git a/.config/qutebrowser/greasemonkey/duckduckgo.js b/.config/qutebrowser/greasemonkey/duckduckgo.js
new file mode 100755
index 0000000..d4d971f
--- /dev/null
+++ b/.config/qutebrowser/greasemonkey/duckduckgo.js
@@ -0,0 +1,12 @@
+// ==UserScript==
+// @name custom duckduckgo
+// @match https://duckduckgo.com/*
+// @grant none
+// ==/UserScript==
+
+GM_addStyle(`
+ .result--ads {
+ visibility: hidden !important;
+ height: 0px !important;
+ }
+`)
diff --git a/.config/qutebrowser/greasemonkey/github-css.js b/.config/qutebrowser/greasemonkey/github-css.js
new file mode 100755
index 0000000..7b32636
--- /dev/null
+++ b/.config/qutebrowser/greasemonkey/github-css.js
@@ -0,0 +1,12 @@
+// ==UserScript==
+// @name github css
+// @match *://github.com/*
+// @match *://gist.github.com/*
+// @grant none
+// ==/UserScript==
+
+GM_addStyle(`
+ *, .BtnGroup-item {
+ border-radius: 0px !important;
+ }
+`)
diff --git a/.config/qutebrowser/greasemonkey/imgur-to-imgin.js b/.config/qutebrowser/greasemonkey/imgur-to-imgin.js
new file mode 100755
index 0000000..d4ac434
--- /dev/null
+++ b/.config/qutebrowser/greasemonkey/imgur-to-imgin.js
@@ -0,0 +1,8 @@
+// ==UserScript==
+// @name imgur to imgin
+// @match *://imgur.com/*
+// @grant none
+// @run-at document-start
+// ==/UserScript==
+
+top.location.hostname = "imgin.voidnet.tech";
diff --git a/.config/qutebrowser/greasemonkey/instagram-to-bibliogram.js b/.config/qutebrowser/greasemonkey/instagram-to-bibliogram.js
new file mode 100755
index 0000000..a608059
--- /dev/null
+++ b/.config/qutebrowser/greasemonkey/instagram-to-bibliogram.js
@@ -0,0 +1,8 @@
+// ==UserScript==
+// @name instagram to biliogram
+// @match *://*.instagram.com/*
+// @grant none
+// @run-at document-start
+// ==/UserScript==
+
+top.location.hostname = "bibliogram.art";
diff --git a/.config/qutebrowser/greasemonkey/medium-to-scribe.js b/.config/qutebrowser/greasemonkey/medium-to-scribe.js
new file mode 100755
index 0000000..5a94ab0
--- /dev/null
+++ b/.config/qutebrowser/greasemonkey/medium-to-scribe.js
@@ -0,0 +1,8 @@
+// ==UserScript==
+// @name medium to scribe
+// @match *://*.medium.com/*
+// @grant none
+// @run-at document-start
+// ==/UserScript==
+
+top.location.hostname = "scribe.rip";
diff --git a/.config/qutebrowser/greasemonkey/miniflux.js b/.config/qutebrowser/greasemonkey/miniflux.js
new file mode 100755
index 0000000..4b17b17
--- /dev/null
+++ b/.config/qutebrowser/greasemonkey/miniflux.js
@@ -0,0 +1,83 @@
+// ==UserScript==
+// @name custom miniflux
+// @match *://miniflux.rgoncalves.se/*NONE
+// @grant none
+// ==/UserScript==
+
+function get_img_content(content) {
+ var object = document.createElement("div");
+ object.innerHTML = content;
+
+ try {
+ url = object.getElementsByTagName("img")[0].src;
+ } catch (error) {
+ url = undefined;
+ }
+
+ return url;
+}
+
+function add_entry_images(article) {
+ var article_meta = article.getElementsByClassName("item-meta")[0];
+ var article_frame = document.createElement("div");
+ var article_id = article.getElementsByClassName("item-title")[0]
+ .getElementsByTagName("a")[0]
+ .href
+ .split("/")
+ .splice(-1, 1);
+
+ article_meta.appendChild(article_frame);
+
+ fetch(`/v1/entries/${article_id}`)
+ .then(res => res.json())
+ .then((res) => {
+ var url;
+
+ try {
+ url = res["enclosures"][0]["url"];
+ } catch (error) {
+ url = get_img_content(res["content"]);
+ }
+
+ if (typeof url === 'undefined') {
+ return;
+ }
+
+ console.log(url);
+
+ img = document.createElement("img");
+ img.src = url;
+ img.style.width = "100%";
+ img.style.minHeight = "100px";
+ img.loading = "lazy";
+
+ article_frame.appendChild(img);
+ })
+}
+
+function has_displayable_image(article) {
+ category = article.getElementsByClassName("category")[0]
+ .getElementsByTagName("a")[0]
+ .innerText;
+
+ return category === "blog"
+ || category === "hn"
+ || category === "social"
+ || category === "yt";
+}
+
+details = document.getElementsByTagName("details");
+
+for (let detail of details) {
+ detail.open = true;
+}
+
+articles = document.getElementsByTagName("article");
+
+for (let article of articles) {
+ if (! has_displayable_image(article)) {
+ continue;
+ }
+
+ add_entry_images(article);
+}
diff --git a/.config/qutebrowser/greasemonkey/minimal-css.js b/.config/qutebrowser/greasemonkey/minimal-css.js
new file mode 100755
index 0000000..1fe1414
--- /dev/null
+++ b/.config/qutebrowser/greasemonkey/minimal-css.js
@@ -0,0 +1,16 @@
+// ==UserScript==
+// @name minimal css
+// @match *://www.google.com
+// @match *://www.google.com/search*
+// @match *://cliq.zoho.eu/chats/*
+// @match *://www.pinterest.com/*
+// @grant none
+// ==/UserScript==
+
+GM_addStyle(`
+ * {
+ border-radius: 0px !important;
+ transition: none !important;
+ animation: none !important;
+ }
+`)
diff --git a/.config/qutebrowser/greasemonkey/no-sticky-headers.js b/.config/qutebrowser/greasemonkey/no-sticky-headers.js
new file mode 100755
index 0000000..e5eefa1
--- /dev/null
+++ b/.config/qutebrowser/greasemonkey/no-sticky-headers.js
@@ -0,0 +1,15 @@
+// ==UserScript==
+// @name no sticky header
+// @match *://*.substack.com/*
+// @grant none
+// ==/UserScript==
+
+(function () {
+ var i, elements = document.querySelectorAll('body *');
+
+ for (i = 0; i < elements.length; i++) {
+ if (getComputedStyle(elements[i]).position === 'fixed') {
+ elements[i].parentNode.removeChild(elements[i]);
+ }
+ }
+})();
diff --git a/.config/qutebrowser/greasemonkey/reddit-to-teddit.js b/.config/qutebrowser/greasemonkey/reddit-to-teddit.js
new file mode 100755
index 0000000..8c1ee6b
--- /dev/null
+++ b/.config/qutebrowser/greasemonkey/reddit-to-teddit.js
@@ -0,0 +1,9 @@
+// ==UserScript==
+// @name reddit to teddit
+// @match *://*.reddit.com/*
+// @match *://reddit.com/*
+// @grant none
+// @run-at document-start
+// ==/UserScript==
+
+top.location.hostname = "teddit.net";
diff --git a/.config/qutebrowser/greasemonkey/scaleway-css.js b/.config/qutebrowser/greasemonkey/scaleway-css.js
new file mode 100755
index 0000000..99955ca
--- /dev/null
+++ b/.config/qutebrowser/greasemonkey/scaleway-css.js
@@ -0,0 +1,11 @@
+// ==UserScript==
+// @name scaleway css
+// @match *://*.scaleway.com/*
+// @grant none
+// ==/UserScript==
+
+GM_addStyle(`
+ #outdated {
+ visibility: hidden;
+ }
+`)
diff --git a/.config/qutebrowser/greasemonkey/scribe-css.js b/.config/qutebrowser/greasemonkey/scribe-css.js
new file mode 100755
index 0000000..60fc0e2
--- /dev/null
+++ b/.config/qutebrowser/greasemonkey/scribe-css.js
@@ -0,0 +1,16 @@
+// ==UserScript==
+// @name scribe css
+// @match *://scribe.rip/*
+// @grant none
+// ==/UserScript==
+
+GM_addStyle(`
+ body {
+ background-color: #ffffff;
+ font-family: monospace, monospace;
+ }
+ img {
+ border: 1px solid #000000;
+ }
+`)
+
diff --git a/.config/qutebrowser/greasemonkey/stackoverflow-css.js b/.config/qutebrowser/greasemonkey/stackoverflow-css.js
new file mode 100755
index 0000000..6c98466
--- /dev/null
+++ b/.config/qutebrowser/greasemonkey/stackoverflow-css.js
@@ -0,0 +1,15 @@
+// ==UserScript==
+// @name stackoverflow css
+// @match *://*.stackoverflow.com/*
+// @match *://*.stackexchange.com/*
+// @match *://*.superuser.com/*
+// @match *://*.serverfault.com/*
+// @grant none
+// ==/UserScript==
+
+GM_addStyle(`
+ .js-consent-banner,
+ .js-freemium-cta {
+ visibility: hidden;
+ }
+`)
diff --git a/.config/qutebrowser/greasemonkey/twitter-to-nitter.js b/.config/qutebrowser/greasemonkey/twitter-to-nitter.js
new file mode 100755
index 0000000..f4c3518
--- /dev/null
+++ b/.config/qutebrowser/greasemonkey/twitter-to-nitter.js
@@ -0,0 +1,9 @@
+// ==UserScript==
+// @name twitter to nitter
+// @match *://*.twitter.com/*
+// @match *://twitter.com/*
+// @grant none
+// @run-at document-start
+// ==/UserScript==
+
+top.location.hostname = "nitter.net";
diff --git a/.config/qutebrowser/greasemonkey/youtube-to-yewtube.js b/.config/qutebrowser/greasemonkey/youtube-to-yewtube.js
new file mode 100755
index 0000000..c8f73f1
--- /dev/null
+++ b/.config/qutebrowser/greasemonkey/youtube-to-yewtube.js
@@ -0,0 +1,9 @@
+// ==UserScript==
+// @name youtube to yewtube
+// @match *://*.youtube.com/*
+// @match *://youtube.com/*
+// @grant none
+// @run-at document-start
+// ==/UserScript==
+
+top.location.hostname = "yewtu.be";
remember that computers suck.