Make hinting configurable
This commit is contained in:
parent
3bd1470b20
commit
5dd74d39fd
@ -17,6 +17,10 @@
|
|||||||
|
|
||||||
"""A HintManager to draw hints over links."""
|
"""A HintManager to draw hints over links."""
|
||||||
|
|
||||||
|
import logging
|
||||||
|
|
||||||
|
import qutebrowser.config.config as config
|
||||||
|
|
||||||
|
|
||||||
class HintManager:
|
class HintManager:
|
||||||
|
|
||||||
@ -44,14 +48,11 @@ class HintManager:
|
|||||||
}
|
}
|
||||||
|
|
||||||
HINT_CSS = """
|
HINT_CSS = """
|
||||||
background: -webkit-gradient(linear, left top, left bottom,
|
color: {config[colors][hints.fg]};
|
||||||
color-stop(0%,#FFF785), color-stop(100%,#FFC542));
|
background: {config[colors][hints.bg]};
|
||||||
border: 1px solid #E3BE23;
|
font: {config[fonts][hints]};
|
||||||
opacity: 0.7;
|
border: {config[hints][border]};
|
||||||
color: black;
|
opacity: {config[hints][opacity]};
|
||||||
font-weight: bold;
|
|
||||||
font-family: monospace;
|
|
||||||
font-size: 12px;
|
|
||||||
z-index: 100000;
|
z-index: 100000;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: {left}px;
|
left: {left}px;
|
||||||
@ -71,7 +72,15 @@ class HintManager:
|
|||||||
def _draw_label(self, elem):
|
def _draw_label(self, elem):
|
||||||
"""Draw a hint label over an element."""
|
"""Draw a hint label over an element."""
|
||||||
rect = elem.geometry()
|
rect = elem.geometry()
|
||||||
css = HintManager.HINT_CSS.format(left=rect.x(), top=rect.y())
|
if rect.x() == 0 and rect.y() == 0:
|
||||||
|
logging.warn("Element is at 0/0...")
|
||||||
|
return
|
||||||
|
logging.debug("rect: {}/{}".format(rect.x(), rect.y()))
|
||||||
|
css = HintManager.HINT_CSS.format(
|
||||||
|
left=rect.x(),
|
||||||
|
top=rect.y(),
|
||||||
|
config=config.instance)
|
||||||
|
logging.debug("css: {}".format(css))
|
||||||
doc = self._frame.documentElement()
|
doc = self._frame.documentElement()
|
||||||
doc.appendInside('<span class="qutehint" style="{}">foo</span>'.format(
|
doc.appendInside('<span class="qutehint" style="{}">foo</span>'.format(
|
||||||
css))
|
css))
|
||||||
|
@ -56,6 +56,7 @@ SECTION_DESC = {
|
|||||||
'general': 'General/misc. options',
|
'general': 'General/misc. options',
|
||||||
'tabbar': 'Configuration of the tab bar.',
|
'tabbar': 'Configuration of the tab bar.',
|
||||||
'webkit': 'Webkit settings.',
|
'webkit': 'Webkit settings.',
|
||||||
|
'hints': 'Hinting settings.',
|
||||||
'searchengines': (
|
'searchengines': (
|
||||||
'Definitions of search engines which can be used via the address '
|
'Definitions of search engines which can be used via the address '
|
||||||
'bar.\n'
|
'bar.\n'
|
||||||
@ -303,6 +304,15 @@ DATA = OrderedDict([
|
|||||||
"This setting enables WebKit's workaround for broken sites."),
|
"This setting enables WebKit's workaround for broken sites."),
|
||||||
)),
|
)),
|
||||||
|
|
||||||
|
('hints', sect.KeyValue(
|
||||||
|
('border',
|
||||||
|
SettingValue(types.String, "1px solid #E3BE23"),
|
||||||
|
"CSS border value for hints."),
|
||||||
|
('opacity',
|
||||||
|
SettingValue(types.Float, "0.7"),
|
||||||
|
"Opacity for hints."),
|
||||||
|
)),
|
||||||
|
|
||||||
('searchengines', sect.ValueList(
|
('searchengines', sect.ValueList(
|
||||||
types.SearchEngineName, types.SearchEngineUrl,
|
types.SearchEngineName, types.SearchEngineUrl,
|
||||||
('DEFAULT', '${duckduckgo}'),
|
('DEFAULT', '${duckduckgo}'),
|
||||||
@ -460,6 +470,16 @@ DATA = OrderedDict([
|
|||||||
('tab.seperator',
|
('tab.seperator',
|
||||||
SettingValue(types.Color, "white"),
|
SettingValue(types.Color, "white"),
|
||||||
"Color for the tab seperator."),
|
"Color for the tab seperator."),
|
||||||
|
|
||||||
|
('hints.fg',
|
||||||
|
SettingValue(types.CssColor, "black"),
|
||||||
|
"Font color for hints."),
|
||||||
|
|
||||||
|
('hints.bg',
|
||||||
|
SettingValue(types.CssColor, "-webkit-gradient(linear, left top, "
|
||||||
|
"left bottom, color-stop(0%,#FFF785), "
|
||||||
|
"color-stop(100%,#FFC542))"),
|
||||||
|
"Background color for hints."),
|
||||||
)),
|
)),
|
||||||
|
|
||||||
('fonts', sect.KeyValue(
|
('fonts', sect.KeyValue(
|
||||||
@ -475,5 +495,8 @@ DATA = OrderedDict([
|
|||||||
SettingValue(types.Font, "8pt Monospace"),
|
SettingValue(types.Font, "8pt Monospace"),
|
||||||
"Font used in the statusbar."),
|
"Font used in the statusbar."),
|
||||||
|
|
||||||
|
('hints',
|
||||||
|
SettingValue(types.Font, "bold 12px Monospace"),
|
||||||
|
"Font used for the hints."),
|
||||||
)),
|
)),
|
||||||
])
|
])
|
||||||
|
Loading…
Reference in New Issue
Block a user