diff options
| author | Mohammad Reza Karimi <m.r.karimi.j@gmail.com> | 2026-01-04 21:28:36 -0500 |
|---|---|---|
| committer | Mohammad Reza Karimi <m.r.karimi.j@gmail.com> | 2026-01-04 21:28:36 -0500 |
| commit | 06d1242317f7159ccf3014f0a1480e7c56236ebb (patch) | |
| tree | 89863b3287ae2c7cc88cd532220f18c38e8d8657 /qute | |
| parent | 5a41da5881a11ba3fdc3890c342aa3b7eb53e0cf (diff) | |
add all sorts of things
Diffstat (limited to 'qute')
| -rw-r--r-- | qute/dot-config/qutebrowser/autoconfig.yml | 34 | ||||
| -rw-r--r-- | qute/dot-config/qutebrowser/config.py | 29 | ||||
| -rw-r--r-- | qute/dot-config/qutebrowser/greasemonkey/whatsapp.js | 29 | ||||
| -rw-r--r-- | qute/dot-config/qutebrowser/greasemonkey/yt-ads.js | 227 | ||||
| -rw-r--r-- | qute/dot-config/qutebrowser/quickmarks | 13 | ||||
| -rw-r--r-- | qute/dot-config/qutebrowser/startpage.html | 42 |
6 files changed, 372 insertions, 2 deletions
diff --git a/qute/dot-config/qutebrowser/autoconfig.yml b/qute/dot-config/qutebrowser/autoconfig.yml new file mode 100644 index 0000000..46b73d3 --- /dev/null +++ b/qute/dot-config/qutebrowser/autoconfig.yml @@ -0,0 +1,34 @@ +# If a config.py file exists, this file is ignored unless it's explicitly loaded +# via config.load_autoconfig(). For more information, see: +# https://github.com/qutebrowser/qutebrowser/blob/main/doc/help/configuring.asciidoc#loading-autoconfigyml +# DO NOT edit this file by hand, qutebrowser will overwrite it. +# Instead, create a config.py - see :help for details. + +config_version: 2 +settings: + content.blocking.hosts.lists: + global: + - https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts + content.headers.user_agent: + https://accounts.google.com/*: Mozilla/5.0 ({os_info}; rv:131.0) Gecko/20100101 + Firefox/131.0 + content.javascript.clipboard: + https://github.com: access-paste + content.notifications.enabled: + https://web.whatsapp.com: true + content.register_protocol_handler: + https://calendar.google.com?cid=%25s: true + https://outlook.office.com?mailtouri=%25s: false + content.user_stylesheets: + global: null + downloads.location.suggestion: + global: both + spellcheck.languages: + global: + - en-US + tabs.last_close: + global: close + url.default_page: + global: file:///home/moreka/.config/qutebrowser/startpage.html + url.start_pages: + global: file:///home/moreka/.config/qutebrowser/startpage.html diff --git a/qute/dot-config/qutebrowser/config.py b/qute/dot-config/qutebrowser/config.py index 1a5c3ee..54f3f6d 100644 --- a/qute/dot-config/qutebrowser/config.py +++ b/qute/dot-config/qutebrowser/config.py @@ -18,6 +18,10 @@ c.completion.open_categories = [ "filesystem", ] +c.new_instance_open_target = "tab-bg" + +c.tabs.show = "multiple" + config.load_autoconfig() # load settings done via the gui config.bind( @@ -37,13 +41,34 @@ config.bind( "spawn --userscript qute-pass --otp-only --username-pattern='login: (.*)' --username-target=secret", ) +config.bind( + ",m", + "spawn mpv {url}", +) + +config.bind( + ",M", + "hint links spawn spawn mpv {hint-url}", +) + c.editor.command = ["alacritty", "-e", "nvim", "{file}", "-c", "normal {line}G{column}"] +c.colors.statusbar.private.bg = "#CF87E8" + +c.colors.webpage.preferred_color_scheme = "dark" +# c.colors.webpage.darkmode.enabled = True +# c.colors.webpage.darkmode.algorithm = "lightness-cielab" +# c.colors.webpage.darkmode.threshold.foreground = 150 +# c.colors.webpage.darkmode.threshold.background = 100 +# c.colors.webpage.darkmode.policy.images = "smart" + +# config.set("colors.webpage.bg", "#282828") + # NOTE: to make Slack sign-in work: -# c.content.unknown_url_scheme_policy = "allow-all" +c.content.unknown_url_scheme_policy = "allow-all" c.content.blocking.enabled = True -c.content.blocking.method = "adblock" +c.content.blocking.method = "both" # c.content.blocking.adblock.lists = [ # "https://github.com/uBlockOrigin/uAssets/raw/master/filters/legacy.txt", diff --git a/qute/dot-config/qutebrowser/greasemonkey/whatsapp.js b/qute/dot-config/qutebrowser/greasemonkey/whatsapp.js new file mode 100644 index 0000000..a7c9a42 --- /dev/null +++ b/qute/dot-config/qutebrowser/greasemonkey/whatsapp.js @@ -0,0 +1,29 @@ +// ==UserScript== +// @name Whatsapp quircks +// @version 1.0.0 +// @description Some Whatsapp quircks that I have to set +// @author moreka +// @match *://*.whatsapp.com/* +// @run-at document-end +// ==/UserScript== + +(function() { + 'use strict'; + + document.addEventListener('load', () => { + if (document.getElementById("farsi-style") === null) { + var style = document.createElement('style'); + style.id = "farsi-style"; + style.innerHTML = `span[data-testid="selectable-text"][dir="rtl"] span { + font-family: "Vazirmatn RD UI" !important; + } + span[dir="rtl"] { + font-family: "Vazirmatn RD UI" !important; + } + footer p[dir="rtl"] span { + font-family: "Vazirmatn RD UI" !important; + }`; + document.head.appendChild(style); + } + }, true); +})(); diff --git a/qute/dot-config/qutebrowser/greasemonkey/yt-ads.js b/qute/dot-config/qutebrowser/greasemonkey/yt-ads.js new file mode 100644 index 0000000..db98c6b --- /dev/null +++ b/qute/dot-config/qutebrowser/greasemonkey/yt-ads.js @@ -0,0 +1,227 @@ +// ==UserScript== +// for more updated scripts, see: https://greasyfork.org/en/scripts/by-site/youtube.com +// @name Auto Skip YouTube Ads +// @version 1.1.0 +// @description Speed up and skip YouTube ads automatically +// @author jso8910 and others +// @match *://*.youtube.com/* +// ==/UserScript== + +// NOTE: this is the previous version I had +// document.addEventListener('load', () => { +// const btn = document.querySelector('.videoAdUiSkipButton,.ytp-ad-skip-button-modern') +// if (btn) { +// btn.click() +// } +// const ad = [...document.querySelectorAll('.ad-showing')][0]; +// if (ad) { +// document.querySelector('video').currentTime = 9999999999; +// } +// }, true); + + +// this newer version is from +// https://greasyfork.org/en/scripts/553239-auto-skip-youtube-ads/ + +function skipAd() { + if (checkIsYouTubeShorts()) return + + // This element appears when a video ad appears. + const adShowing = document.querySelector('.ad-showing') + + // Timed pie countdown ad. + const pieCountdown = document.querySelector('.ytp-ad-timed-pie-countdown-container') + + // Survey questions in video player. + const surveyQuestions = document.querySelector('.ytp-ad-survey-questions') + + if (adShowing === null && pieCountdown === null && surveyQuestions === null) return + + const moviePlayerEl = document.querySelector('#movie_player') + let playerEl + let player + + if (isYouTubeMobile || isYouTubeMusic) { + playerEl = moviePlayerEl + player = playerEl + } else { + playerEl = document.querySelector('#ytd-player') + player = playerEl && playerEl.getPlayer() + } + + if (playerEl === null || player === null) { + console.log({ + message: 'Player not found', + timeStamp: getCurrentTimeString() + }) + return + } + + // ad.classList.remove('ad-showing') + + let adVideo = null + + if (pieCountdown === null && surveyQuestions === null) { + adVideo = document.querySelector( + '#ytd-player video.html5-main-video, #song-video video.html5-main-video' + ) + + console.table({ + message: 'Ad video', + video: adVideo !== null, + src: adVideo?.src, + paused: adVideo?.paused, + currentTime: adVideo?.currentTime, + duration: adVideo?.duration, + timeStamp: getCurrentTimeString() + }) + + if (adVideo !== null) { + adVideo.muted = true + } + if (adVideo === null || !adVideo.src || adVideo.paused || isNaN(adVideo.duration)) { + return + } + + console.log({ + message: 'Ad video has finished loading', + timeStamp: getCurrentTimeString() + }) + } + + if (isYouTubeMusic && adVideo !== null) { + adVideo.currentTime = adVideo.duration + + console.table({ + message: 'Ad skipped', + timeStamp: getCurrentTimeString(), + adShowing: adShowing !== null, + pieCountdown: pieCountdown !== null, + surveyQuestions: surveyQuestions !== null + }) + } else { + const videoData = player.getVideoData() + const videoId = videoData.video_id + const start = Math.floor(player.getCurrentTime()) + + if (moviePlayerEl !== null && moviePlayerEl.isSubtitlesOn()) { + window.setTimeout(moviePlayerEl.toggleSubtitlesOn, 1000) + } + + if ('loadVideoWithPlayerVars' in playerEl) { + playerEl.loadVideoWithPlayerVars({ videoId, start }) + } else { + playerEl.loadVideoByPlayerVars({ videoId, start }) + } + + console.table({ + message: 'Ad skipped', + videoId, + start, + title: videoData.title, + timeStamp: getCurrentTimeString(), + adShowing: adShowing !== null, + pieCountdown: pieCountdown !== null, + surveyQuestions: surveyQuestions !== null + }) + } +} + +function checkIsYouTubeShorts() { + return location.pathname.startsWith('/shorts/') +} + +function getCurrentTimeString() { + return new Date().toTimeString().split(' ', 1)[0] +} + +function addCss() { + const adsSelectors = [ + // Ad banner in the upper right corner, above the video playlist. + '#player-ads', + '#panels > ytd-engagement-panel-section-list-renderer[target-id="engagement-panel-ads"]', + + // Masthead ad on home page. + '#masthead-ad', + + // Sponsored ad video items on home page. + // 'ytd-ad-slot-renderer', + + // '.ytp-suggested-action', + '.yt-mealbar-promo-renderer', + + // Featured product ad banner at the bottom left of the video. + '.ytp-featured-product', + + // Products shelf ad banner below the video description. + 'ytd-merch-shelf-renderer', + + // YouTube Music Premium trial promotion dialog, bottom left corner. + 'ytmusic-mealbar-promo-renderer', + + // YouTube Music Premium trial promotion banner on home page. + 'ytmusic-statement-banner-renderer' + ] + const adsSelector = adsSelectors.join(',') + const css = `${adsSelector} { display: none !important; }` + const style = document.createElement('style') + style.textContent = css + document.head.appendChild(style) +} + +/** + * Remove ad elements using JavaScript because these selectors require the use of the CSS + * `:has` selector which is not supported in older browser versions. + */ +function removeAdElements() { + const adSelectors = [ + // Sponsored ad video items on home page. + // ['ytd-rich-item-renderer', '.ytd-ad-slot-renderer'], + + // ['ytd-rich-section-renderer', '.ytd-statement-banner-renderer'], + + // Ad videos on YouTube Shorts. + ['ytd-reel-video-renderer', '.ytd-ad-slot-renderer'] + + // Ad blocker warning dialog. + // ['tp-yt-paper-dialog', '#feedback.ytd-enforcement-message-view-model'], + + // Survey dialog on home page, located at bottom right. + // ['tp-yt-paper-dialog', ':scope > ytd-checkbox-survey-renderer'], + + // Survey to rate suggested content, located at bottom right. + // ['tp-yt-paper-dialog', ':scope > ytd-single-option-survey-renderer'] + ] + for (const adSelector of adSelectors) { + const adEl = document.querySelector(adSelector[0]) + if (adEl === null) continue + const neededEl = adEl.querySelector(adSelector[1]) + if (neededEl === null) continue + adEl.remove() + } +} + +const isYouTubeMobile = location.hostname === 'm.youtube.com' +const isYouTubeDesktop = !isYouTubeMobile + +const isYouTubeMusic = location.hostname === 'music.youtube.com' +const isYouTubeVideo = !isYouTubeMusic + +addCss() + +if (isYouTubeVideo) { +window.setInterval(removeAdElements, 1000) +removeAdElements() +} + +window.setInterval(skipAd, 500) +skipAd() + + +// const observer = new MutationObserver(skipAd) +// observer.observe(document.body, { +// attributes: true, +// attributeFilter: ['class'], +// childList: true, +// subtree: true +// }) diff --git a/qute/dot-config/qutebrowser/quickmarks b/qute/dot-config/qutebrowser/quickmarks new file mode 100644 index 0000000..f1aabfe --- /dev/null +++ b/qute/dot-config/qutebrowser/quickmarks @@ -0,0 +1,13 @@ +vim plaintext mail https://aliquote.org/post/wrap-and-reflow/ +neovim markdown https://aliquote.org/post/neovim-markdown/ +aliquote https://aliquote.org/post/ +color picker https://bottosson.github.io/misc/colorpicker/ +site example http://bettermotherfuckingwebsite.com/ +htmx https://pleasejusttryhtmx.com/ +productivity txt https://jeffhuang.com/productivity_text_file/ +replace js with just html https://www.htmhell.dev/adventcalendar/2025/27/ +christian final lecture https://video.ethz.ch/speakers/lecture/v/:5c417d5c-314b-4f11-bffc-5b3810a08c1a +typography https://practicaltypography.com/ +nice font https://lambdaland.org/posts/2025-06-24_reading_blogs/ +nice https://henry.codes/writing/a-website-to-destroy-all-websites/ +reboot https://takes.jamesomalley.co.uk/p/this-might-be-oversharing diff --git a/qute/dot-config/qutebrowser/startpage.html b/qute/dot-config/qutebrowser/startpage.html new file mode 100644 index 0000000..51b294b --- /dev/null +++ b/qute/dot-config/qutebrowser/startpage.html @@ -0,0 +1,42 @@ +<!DOCTYPE html> +<html> +<head> + <title>about:blank</title> + <style> + body { + background-color: #2e3440; /* Dark background example */ + /* color: #eceff4; */ + font-family: "Bitter Pro"; + letter-spacing: 1px; + display: flex; + justify-content: center; + align-items: center; + height: 100vh; + margin: 0; + } + h1 { + margin: 0; + font-weight: 400; + font-size: 40px; + text-align: center; + color: #f35626; + background-image: -webkit-linear-gradient(92deg, #f35626, #feab3a); + -webkit-background-clip: text; + -webkit-text-fill-color: transparent; + -webkit-animation: hue 10s infinite linear; + } + + @-webkit-keyframes hue { + from { + -webkit-filter: hue-rotate(0deg); + } + to { + -webkit-filter: hue-rotate(-360deg); + } + } + </style> +</head> +<body> + <h1>Welcome to QuteBrowser!</h1> +</body> +</html> |
