dotfiles/.config/qutebrowser/config.py

90 lines
2.8 KiB
Python
Raw Normal View History

from qutebrowser.config.configfiles import ConfigAPI # noqa: F401
from qutebrowser.config.config import ConfigContainer # noqa: F401
import os
2019-05-16 12:25:19 +00:00
# Autogenerated config.py
# Documentation:
# qute://help/configuring.html
# qute://help/settings.html
# Uncomment this to still load settings configured via autoconfig.yml
config.load_autoconfig()
2019-05-16 12:25:19 +00:00
# Enable JavaScript.
# Type: Bool
config.set('content.javascript.enabled', True, 'file://*')
# Enable JavaScript.
# Type: Bool
config.set('content.javascript.enabled', True, 'chrome://*/*')
# Enable JavaScript.
# Type: Bool
config.set('content.javascript.enabled', True, 'qute://*/*')
c.editor.command = ["alacritty", "-e", "nvim", "-f", "{file}"]
# LOOK
# ----
# Tab-Bar
# have tab bar on the right, not on the top
c.tabs.position = "right"
c.tabs.width = "15%"
# give the browser nice nord theme colors
config.source('nordtheme.py')
# Status bar
# should be visible to prevent 'jumping' bug, see https://github.com/qutebrowser/qutebrowser/issues/2236
# TODO think about implementing a simple toggle for the statusbar, like for the tabs
c.statusbar.hide = False
# CSS
DARK_STYLESHEET = config.configdir / \
"stylesheets/solarized-dark.css"
LIGHT_STYLESHEET = config.configdir / \
"stylesheets/solarized-light.css"
if DARK_STYLESHEET.exists() and LIGHT_STYLESHEET.exists():
css = [str(DARK_STYLESHEET), str(LIGHT_STYLESHEET)]
# FUNCTION
# --------
# Prevents *all* tabs from being loaded on restore, only loads on activating them
c.session.lazy_restore = True
# Binds
# 'Leader' key binding
leader = "<Space>"
# toggles ('cycles') between tabs always showing, or only when switching between them
config.bind('tt', 'config-cycle -t tabs.show always switching')
# bind mpv to play the current page/links, using a single instance which queues the next link passed
config.bind('M', 'spawn umpv {url}')
config.bind('m', 'hint links spawn umpv {hint-url}')
# Let me close tabs more easily, and 'unclose' them with the same key
config.bind('x', 'tab-close', mode='normal')
config.bind('X', 'undo', mode='normal')
# Use q for quitting a tab (mimicks vim buffer) - qa is used for exiting
c.aliases["q"] = "tab-close"
# if we save sessions with w, load sessions with e (again, mimicks vim)
c.aliases["e"] = "session-load"
# bookmarklet aliases:
# wallabag add current page, either with walla command, or <leader>ra
c.aliases["wallabag-add"] = "spawn --userscript wallabag_add.sh"
config.bind(leader + 'ra', 'wallabag-add', mode='normal')
# set stylesheets for the browser to use
# leader - ss to remove all applied stylesheets
config.bind(leader + 'ss', 'set content.user_stylesheets ""')
# leader - sd for dark mode solarized
config.bind(leader + 'sd', 'set content.user_stylesheets ' + str(css[0]) )
# leader - sl for light mode solarized
config.bind(leader + 'sl', 'set content.user_stylesheets ' + str(css[1]) )