Qutebrowser Configuration
Table of Contents
1. Configuration
1.1. Imports
We start with imports:
from pathlib import Path from urllib.parse import urlparse # import catppuccin
We import pathlib to get our home directory.
1.2. Theming
I am experimenting with many themes right now, and one of them is the city-lights theme. Another one I have used is the catppuccin theme.
# config.source('themes/qute-city-lights/city-lights-theme.py') config.source('gruvbox.py')
1.3. Variables
We need the location of the home directory.
home = str(Path.home())
1.4. Fonts
We are using Fira Code for the font in all the non-webpage ui elements.
c.fonts.hints = '14pt FiraCode Nerd Font' c.fonts.keyhint = '14pt FiraCode Nerd Font' c.fonts.prompts = '14pt FiraCode Nerd Font' c.fonts.downloads = '14pt FiraCode Nerd Font' c.fonts.statusbar = '14pt FiraCode Nerd Font' c.fonts.contextmenu = '14pt FiraCode Nerd Font' c.fonts.messages.info = '14pt FiraCode Nerd Font' c.fonts.debug_console = '14pt FiraCode Nerd Font' c.fonts.completion.entry = '14pt FiraCode Nerd Font' c.fonts.completion.category = '14pt FiraCode Nerd Font' c.fonts.tabs.selected = '14pt FiraCode Nerd Font' c.fonts.tabs.unselected = '14pt FiraCode Nerd Font'
1.5. Search Engine
We should set our default search engine to google because duckduckgo is useless, and we should give other search engine bang options.
c.url.searchengines = { 'DEFAULT': 'https://google.com/search?hl=en&q={}', '!a': 'https://www.amazon.com/s?k={}', '!d': 'https://duckduckgo.com/?ia=web&q={}', '!dd': 'https://thefreedictionary.com/{}', '!e': 'https://www.ebay.com/sch/i.html?_nkw={}', '!fb': 'https://www.facebook.com/s.php?q={}', '!gh': 'https://github.com/search?o=desc&q={}&s=stars', '!gist': 'https://gist.github.com/search?q={}', '!gi': 'https://www.google.com/search?tbm=isch&q={}&tbs=imgo:1', '!gn': 'https://news.google.com/search?q={}', '!ig': 'https://www.instagram.com/explore/tags/{}', '!m': 'https://www.google.com/maps/search/{}', '!p': 'https://pry.sh/{}', '!r': 'https://www.reddit.com/search?q={}', '!sd': 'https://slickdeals.net/newsearch.php?q={}&searcharea=deals&searchin=first', '!t': 'https://www.thesaurus.com/browse/{}', '!tw': 'https://twitter.com/search?q={}', '!w': 'https://en.wikipedia.org/wiki/{}', '!yelp': 'https://www.yelp.com/search?find_desc={}', '!yt': 'https://www.youtube.com/results?search_query={}' }
1.6. Start Page
Set the default start page to my own website.
c.url.start_pages = ["file:///home/preston/website_html/index.html"] c.url.default_page = "file:///home/preston/website_html/index.html"
1.7. Keybindings
Now we define our keybindings for useful programs while browsing:
config.bind('xm', 'hint links spawn mpv {hint-url}') config.bind('xy', 'hint links spawn yt-dlp {hint-url} -o "~/videos/youtube/%(title)s.%(ext)s"') config.bind('xr', 'hint links spawn bash -c "echo \'*** {hint-url}\' >> ~/org/elfeed.org"') config.bind('xj', 'spawn bash -c "echo {url} >> ~/.config/qutebrowser/js_blacklist.txt"')
1.8. Paywall Bypassing
Sometimes websites like the New York Times try to make money. I won't let that happen.
with open(f"{home}/.config/qutebrowser/js_blacklist.txt") as f: js_blacklist = f.read().splitlines() for item in js_blacklist: domain = urlparse(item).netloc config.set('content.javascript.enabled', False, f"*://{domain}/*") config.set('content.javascript.enabled', False, f"*://www.{domain}/*")
1.9. Misc.
Doing mundane things like setting the downloads directory to not use an upper case letter.
c.downloads.location.directory = "~/Downloads"
1.10. End of Config
config.load_autoconfig() # catppuccin.setup(c, 'mocha', False)