Make hinting configurable
This commit is contained in:
parent
3bd1470b20
commit
5dd74d39fd
@ -17,6 +17,10 @@
|
||||
|
||||
"""A HintManager to draw hints over links."""
|
||||
|
||||
import logging
|
||||
|
||||
import qutebrowser.config.config as config
|
||||
|
||||
|
||||
class HintManager:
|
||||
|
||||
@ -44,14 +48,11 @@ class HintManager:
|
||||
}
|
||||
|
||||
HINT_CSS = """
|
||||
background: -webkit-gradient(linear, left top, left bottom,
|
||||
color-stop(0%,#FFF785), color-stop(100%,#FFC542));
|
||||
border: 1px solid #E3BE23;
|
||||
opacity: 0.7;
|
||||
color: black;
|
||||
font-weight: bold;
|
||||
font-family: monospace;
|
||||
font-size: 12px;
|
||||
color: {config[colors][hints.fg]};
|
||||
background: {config[colors][hints.bg]};
|
||||
font: {config[fonts][hints]};
|
||||
border: {config[hints][border]};
|
||||
opacity: {config[hints][opacity]};
|
||||
z-index: 100000;
|
||||
position: absolute;
|
||||
left: {left}px;
|
||||
@ -71,7 +72,15 @@ class HintManager:
|
||||
def _draw_label(self, elem):
|
||||
"""Draw a hint label over an element."""
|
||||
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.appendInside('<span class="qutehint" style="{}">foo</span>'.format(
|
||||
css))
|
||||
|
@ -56,6 +56,7 @@ SECTION_DESC = {
|
||||
'general': 'General/misc. options',
|
||||
'tabbar': 'Configuration of the tab bar.',
|
||||
'webkit': 'Webkit settings.',
|
||||
'hints': 'Hinting settings.',
|
||||
'searchengines': (
|
||||
'Definitions of search engines which can be used via the address '
|
||||
'bar.\n'
|
||||
@ -303,6 +304,15 @@ DATA = OrderedDict([
|
||||
"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(
|
||||
types.SearchEngineName, types.SearchEngineUrl,
|
||||
('DEFAULT', '${duckduckgo}'),
|
||||
@ -460,6 +470,16 @@ DATA = OrderedDict([
|
||||
('tab.seperator',
|
||||
SettingValue(types.Color, "white"),
|
||||
"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(
|
||||
@ -475,5 +495,8 @@ DATA = OrderedDict([
|
||||
SettingValue(types.Font, "8pt Monospace"),
|
||||
"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