Move default config to file
This commit is contained in:
parent
d349a987c7
commit
99aba6d9c0
187
qutebrowser/qutebrowser.conf
Normal file
187
qutebrowser/qutebrowser.conf
Normal file
@ -0,0 +1,187 @@
|
||||
# vim: ft=dosini
|
||||
|
||||
# Configfile for qutebrowser.
|
||||
#
|
||||
# This configfile is parsed by python's configparser in extended interpolation
|
||||
# mode. The format is very INI-like, so there are categories like [general]
|
||||
# with "key = value"-pairs.
|
||||
#
|
||||
# Comments start with ; or # and may only start at the beginning of a line.
|
||||
#
|
||||
# Interpolation looks like ${value} or ${section:value} and will be replaced
|
||||
# by the respective value.
|
||||
#
|
||||
# This is the default config, so if you want to remove anything from here (as
|
||||
# opposed to change/add), for example a keybinding, set it to an empty value.
|
||||
|
||||
[general]
|
||||
# show_completion: bool, whether to show the autocompletion window or not.
|
||||
# ignorecase: bool, whether to do case-insensitive searching.
|
||||
# wrapsearch: bool, whether to wrap search to the top when arriving at the end.
|
||||
# startpage: The default pages to open at the start, multiple pages can be
|
||||
# separated with commas.
|
||||
# addressbar_dns_lookup: bool, whether to do a lookup in the DNS to figure out
|
||||
# if something is a search term or not. Might be slow.
|
||||
# auto_search: bool, whether to start a search automatically when something
|
||||
# which is not an url is entered.
|
||||
show_completion = true
|
||||
ignorecase = true
|
||||
wrapsearch = true
|
||||
startpage = http://www.duckduckgo.com/
|
||||
addressbar_dns_lookup = false
|
||||
auto_search = true
|
||||
|
||||
[tabbar]
|
||||
# movable: bool, whether tabs should be movable
|
||||
# closebuttons: bool, whether tabs should have a close button
|
||||
# scrollbuttons: bool, whether there should be scroll buttons if there are too
|
||||
# many tabs open.
|
||||
# position: Position of the tab bar, either north, south, east or west.
|
||||
# select_on_remove: Which tab to select when the focused tab is removed. Either
|
||||
# 'previous', 'left' or 'right'.
|
||||
# last_close; Behavour when the last tab is closed - 'ignore' (don't do
|
||||
# anything), 'blank' (load about:blank) or 'quit' (quit
|
||||
# qutebrowser).
|
||||
movable = true
|
||||
closebuttons = false
|
||||
scrollbuttons = false
|
||||
position = north
|
||||
select_on_remove = previous
|
||||
last_close = quit
|
||||
|
||||
[searchengines]
|
||||
# Definitions of search engines which can be used via the address bar.
|
||||
# The searchengine named DEFAULT is used when general.auto_search is true and
|
||||
# something else than an URL was entered to be opened.
|
||||
# Other search engines can be used via the bang-syntax, e.g.
|
||||
# "qutebrowser !google". The string "{}" will be replaced by the search term,
|
||||
# use "{{" and "}}" for literal {/} signs.
|
||||
DEFAULT = ${duckduckgo}
|
||||
duckduckgo = https://duckduckgo.com/?q={}
|
||||
ddg = ${duckduckgo}
|
||||
google = https://encrypted.google.com/search?q={}
|
||||
g = ${google}
|
||||
wikipedia = http://en.wikipedia.org/w/index.php?title=Special:Search&search={}
|
||||
wiki = ${wikipedia}
|
||||
|
||||
[keybind]
|
||||
# Bindings from a key(chain) to a command. For special keys (can't be part of a
|
||||
# keychain), enclose them in @-signs. For modifiers, you can use either - or +
|
||||
# as delimiters, and these names:
|
||||
# Control: Control, Ctrl
|
||||
# Meta: Meta, Windows, Mod4
|
||||
# Alt: Alt, Mod1
|
||||
# Shift: Shift
|
||||
# For simple keys (no @ signs), a capital letter means the key is pressed with
|
||||
# Shift. For modifier keys (with @ signs), you need to explicitely add "Shift-"
|
||||
# to match a key pressed with shift.
|
||||
o = open
|
||||
go = opencur
|
||||
O = tabopen
|
||||
gO = tabopencur
|
||||
ga = tabopen about:blank
|
||||
d = tabclose
|
||||
J = tabnext
|
||||
K = tabprev
|
||||
r = reload
|
||||
H = back
|
||||
L = forward
|
||||
h = scroll -50 0
|
||||
j = scroll 0 50
|
||||
k = scroll 0 -50
|
||||
l = scroll 50 0
|
||||
u = undo
|
||||
gg = scroll_perc_y 0
|
||||
G = scroll_perc_y
|
||||
n = nextsearch
|
||||
yy = yank
|
||||
yY = yank sel
|
||||
yt = yanktitle
|
||||
yT = yanktitle sel
|
||||
pp = paste
|
||||
pP = paste sel
|
||||
Pp = tabpaste
|
||||
PP = tabpaste sel
|
||||
@Ctrl-Q@ = quit
|
||||
@Ctrl-Shift-T@ = undo
|
||||
@Ctrl-W@ = tabclose
|
||||
@Ctrl-T@ = tabopen about:blank
|
||||
@Ctrl-F@ = scroll_page 0 1
|
||||
@Ctrl-B@ = scroll_page 0 -1
|
||||
@Ctrl-D@ = scroll_page 0 0.5
|
||||
@Ctrl-U@ = scroll_page 0 -0.5
|
||||
|
||||
[colors]
|
||||
# Colors used in the UI. A value can be in one of the following format:
|
||||
# - #RGB/#RRGGBB/#RRRGGGBBB/#RRRRGGGGBBBB
|
||||
# - A SVG color name as specified in [1].
|
||||
# - transparent (no color)
|
||||
# - rgb(r, g, b) / rgba(r, g, b, a) (values 0-255 or percentages)
|
||||
# - hsv(h, s, v) / hsva(h, s, v, a) (values 0-255, hue 0-359)
|
||||
# - A gradient as explained at [2] under "Gradient"
|
||||
# [1] http://www.w3.org/TR/SVG/types.html#ColorKeywords
|
||||
# [2] http://qt-project.org/doc/qt-4.8/stylesheet-reference.html#list-of-property-types
|
||||
#
|
||||
## Completion widget
|
||||
# Text color
|
||||
completion.fg = #333333
|
||||
# Background of a normal item
|
||||
completion.item.bg = white
|
||||
# Background of a category header
|
||||
completion.category.bg = qlineargradient(x1:0, y1:0, x2:0, y2:1,
|
||||
stop:0 #e4e4e4, stop:1 #dbdbdb)
|
||||
# Borders of a category header
|
||||
completion.category.border.top = #808080
|
||||
completion.category.border.bottom = #bbbbbb
|
||||
# Text/background color for the currently selected item
|
||||
completion.item.selected.fg = #333333
|
||||
completion.item.selected.bg = #ffec8b
|
||||
# Borders for the selected item
|
||||
completion.item.selected.border.top = #f2f2c0
|
||||
completion.item.selected.border.bottom = #e6e680
|
||||
# Matched text in a completion
|
||||
completion.match.fg = red
|
||||
## Statusbar widget
|
||||
# Normal colors for the statusbar.
|
||||
statusbar.bg = black
|
||||
statusbar.fg = white
|
||||
# Statusbar colors when there is an error
|
||||
statusbar.bg.error = red
|
||||
# Colors of the progress bar
|
||||
statusbar.progress.bg = white
|
||||
# Colors of the URL shown in the statusbar
|
||||
# Unknown/default status
|
||||
statusbar.url.fg = ${statusbar.fg}
|
||||
# Page loaded successfully
|
||||
statusbar.url.fg.success = lime
|
||||
# Error while loading page
|
||||
statusbar.url.fg.error = orange
|
||||
# Warning while loading page
|
||||
statusbar.url.fg.warn = yellow
|
||||
# Link under the mouse cursor
|
||||
statusbar.url.fg.hover = aqua
|
||||
## Tabbar
|
||||
# Tabbar colors
|
||||
tab.fg = white
|
||||
tab.bg = grey
|
||||
# Color of the selected tab
|
||||
tab.bg.selected = black
|
||||
# Seperator between tabs
|
||||
tab.seperator = white
|
||||
|
||||
[fonts]
|
||||
# Fonts used for the UI, with optional style/weight/size.
|
||||
# Style: normal/italic/oblique
|
||||
# Weight: normal, bold, 100..900
|
||||
# Size: Number + px/pt
|
||||
#
|
||||
# Default monospace fonts
|
||||
_monospace = Monospace, "DejaVu Sans Mono", Consolas, Monaco,
|
||||
"Bitstream Vera Sans Mono", "Andale Mono", "Liberation Mono",
|
||||
"Courier New", Courier, monospace, Fixed, Terminal
|
||||
# Font used in the completion widget.
|
||||
completion = 8pt ${_monospace}
|
||||
# Font used in the tabbar
|
||||
tabbar = 8pt ${_monospace}
|
||||
# Font used in the statusbar.
|
||||
statusbar = 8pt ${_monospace}
|
@ -19,7 +19,6 @@
|
||||
|
||||
config -- The main Config object.
|
||||
colordict -- All configured colors.
|
||||
default_config -- The default config as dict.
|
||||
MONOSPACE -- A list of suitable monospace fonts.
|
||||
|
||||
"""
|
||||
@ -30,111 +29,12 @@ import os.path
|
||||
import logging
|
||||
from configparser import ConfigParser, ExtendedInterpolation
|
||||
|
||||
from qutebrowser.utils.misc import read_file
|
||||
|
||||
config = None
|
||||
colordict = {}
|
||||
fontdict = {}
|
||||
|
||||
default_config = """
|
||||
[general]
|
||||
show_completion = true
|
||||
ignorecase = true
|
||||
wrapsearch = true
|
||||
startpage = http://www.duckduckgo.com/
|
||||
addressbar_dns_lookup = false
|
||||
auto_search = true
|
||||
|
||||
[tabbar]
|
||||
movable = true
|
||||
closebuttons = false
|
||||
scrollbuttons = false
|
||||
# north, south, east, west
|
||||
position = north
|
||||
# previous, left, right
|
||||
select_on_remove = previous
|
||||
# ignore, blank, quit
|
||||
last_close = quit
|
||||
|
||||
[searchengines]
|
||||
DEFAULT = ${duckduckgo}
|
||||
duckduckgo = https://duckduckgo.com/?q={}
|
||||
ddg = ${duckduckgo}
|
||||
google = https://encrypted.google.com/search?q={}
|
||||
g = ${google}
|
||||
wikipedia = http://en.wikipedia.org/w/index.php?title=Special:Search&search={}
|
||||
wiki = ${wikipedia}
|
||||
|
||||
[keybind]
|
||||
o = open
|
||||
go = opencur
|
||||
O = tabopen
|
||||
gO = tabopencur
|
||||
ga = tabopen about:blank
|
||||
d = tabclose
|
||||
J = tabnext
|
||||
K = tabprev
|
||||
r = reload
|
||||
H = back
|
||||
L = forward
|
||||
h = scroll -50 0
|
||||
j = scroll 0 50
|
||||
k = scroll 0 -50
|
||||
l = scroll 50 0
|
||||
u = undo
|
||||
gg = scroll_perc_y 0
|
||||
G = scroll_perc_y
|
||||
n = nextsearch
|
||||
yy = yank
|
||||
yY = yank sel
|
||||
yt = yanktitle
|
||||
yT = yanktitle sel
|
||||
pp = paste
|
||||
pP = paste sel
|
||||
Pp = tabpaste
|
||||
PP = tabpaste sel
|
||||
@Ctrl-Q@ = quit
|
||||
@Ctrl-Shift-T@ = undo
|
||||
@Ctrl-W@ = tabclose
|
||||
@Ctrl-T@ = tabopen about:blank
|
||||
@Ctrl-F@ = scroll_page 0 1
|
||||
@Ctrl-B@ = scroll_page 0 -1
|
||||
@Ctrl-D@ = scroll_page 0 0.5
|
||||
@Ctrl-U@ = scroll_page 0 -0.5
|
||||
|
||||
[colors]
|
||||
completion.fg = #333333
|
||||
completion.item.bg = white
|
||||
completion.category.bg = qlineargradient(x1:0, y1:0, x2:0, y2:1,
|
||||
stop:0 #e4e4e4, stop:1 #dbdbdb)
|
||||
completion.category.border.top = #808080
|
||||
completion.category.border.bottom = #bbbbbb
|
||||
completion.item.selected.fg = #333333
|
||||
completion.item.selected.bg = #ffec8b
|
||||
completion.item.selected.border.top = #f2f2c0
|
||||
completion.item.selected.border.bottom = #e6e680
|
||||
completion.match.fg = red
|
||||
statusbar.progress.bg = white
|
||||
statusbar.bg = black
|
||||
statusbar.fg = white
|
||||
statusbar.bg.error = red
|
||||
statusbar.url.fg = ${statusbar.fg}
|
||||
statusbar.url.fg.success = lime
|
||||
statusbar.url.fg.error = orange
|
||||
statusbar.url.fg.warn = yellow
|
||||
statusbar.url.fg.hover = aqua
|
||||
tab.bg = grey
|
||||
tab.bg.selected = black
|
||||
tab.fg = white
|
||||
tab.seperator = white
|
||||
|
||||
[fonts]
|
||||
_monospace = Monospace, "DejaVu Sans Mono", Consolas, Monaco,
|
||||
"Bitstream Vera Sans Mono", "Andale Mono", "Liberation Mono",
|
||||
"Courier New", Courier, monospace, Fixed, Terminal
|
||||
completion = 8pt ${_monospace}
|
||||
tabbar = 8pt ${_monospace}
|
||||
statusbar = 8pt ${_monospace}
|
||||
"""
|
||||
|
||||
|
||||
def init(confdir):
|
||||
"""Initialize the global objects based on the config in configdir."""
|
||||
@ -245,7 +145,7 @@ class Config(ConfigParser):
|
||||
super().__init__(interpolation=ExtendedInterpolation())
|
||||
self.default_cp = ConfigParser(interpolation=ExtendedInterpolation())
|
||||
self.default_cp.optionxform = lambda opt: opt # be case-insensitive
|
||||
self.default_cp.read_string(default_config)
|
||||
self.default_cp.read_string(read_file('qutebrowser.conf'))
|
||||
if not self.configdir:
|
||||
return
|
||||
self.optionxform = lambda opt: opt # be case-insensitive
|
||||
|
Loading…
Reference in New Issue
Block a user