Merge branch 'url-color' of https://github.com/neeasade/qutebrowser into neeasade-url-color
This commit is contained in:
commit
91ce3ed672
@ -35,8 +35,8 @@ from qutebrowser.utils import message, log, usertypes, utils, qtutils, objreg
|
|||||||
from qutebrowser.browser import webpage, hints, webelem
|
from qutebrowser.browser import webpage, hints, webelem
|
||||||
|
|
||||||
|
|
||||||
LoadStatus = usertypes.enum('LoadStatus', ['none', 'success', 'error', 'warn',
|
LoadStatus = usertypes.enum('LoadStatus', ['none', 'success', 'success_https',
|
||||||
'loading'])
|
'error', 'warn', 'loading'])
|
||||||
|
|
||||||
|
|
||||||
tab_id_gen = itertools.count(0)
|
tab_id_gen = itertools.count(0)
|
||||||
@ -423,7 +423,11 @@ class WebView(QWebView):
|
|||||||
"""
|
"""
|
||||||
ok = not self.page().error_occurred
|
ok = not self.page().error_occurred
|
||||||
if ok and not self._has_ssl_errors:
|
if ok and not self._has_ssl_errors:
|
||||||
|
if self.cur_url.scheme() == 'https':
|
||||||
|
self._set_load_status(LoadStatus.success_https)
|
||||||
|
else:
|
||||||
self._set_load_status(LoadStatus.success)
|
self._set_load_status(LoadStatus.success)
|
||||||
|
|
||||||
elif ok:
|
elif ok:
|
||||||
self._set_load_status(LoadStatus.warn)
|
self._set_load_status(LoadStatus.warn)
|
||||||
else:
|
else:
|
||||||
|
@ -878,7 +878,7 @@ def data(readonly=False):
|
|||||||
|
|
||||||
('statusbar.bg',
|
('statusbar.bg',
|
||||||
SettingValue(typ.QssColor(), 'black'),
|
SettingValue(typ.QssColor(), 'black'),
|
||||||
"Foreground color of the statusbar."),
|
"Background color of the statusbar."),
|
||||||
|
|
||||||
('statusbar.fg.error',
|
('statusbar.fg.error',
|
||||||
SettingValue(typ.QssColor(), '${statusbar.fg}'),
|
SettingValue(typ.QssColor(), '${statusbar.fg}'),
|
||||||
@ -947,9 +947,14 @@ def data(readonly=False):
|
|||||||
"Default foreground color of the URL in the statusbar."),
|
"Default foreground color of the URL in the statusbar."),
|
||||||
|
|
||||||
('statusbar.url.fg.success',
|
('statusbar.url.fg.success',
|
||||||
|
SettingValue(typ.QssColor(), 'white'),
|
||||||
|
"Foreground color of the URL in the statusbar on successful "
|
||||||
|
"load (http)."),
|
||||||
|
|
||||||
|
('statusbar.url.fg.success.https',
|
||||||
SettingValue(typ.QssColor(), 'lime'),
|
SettingValue(typ.QssColor(), 'lime'),
|
||||||
"Foreground color of the URL in the statusbar on successful "
|
"Foreground color of the URL in the statusbar on successful "
|
||||||
"load."),
|
"load (https)."),
|
||||||
|
|
||||||
('statusbar.url.fg.error',
|
('statusbar.url.fg.error',
|
||||||
SettingValue(typ.QssColor(), 'orange'),
|
SettingValue(typ.QssColor(), 'orange'),
|
||||||
|
@ -28,8 +28,8 @@ from qutebrowser.utils import usertypes
|
|||||||
|
|
||||||
|
|
||||||
# Note this has entries for success/error/warn from widgets.webview:LoadStatus
|
# Note this has entries for success/error/warn from widgets.webview:LoadStatus
|
||||||
UrlType = usertypes.enum('UrlType', ['success', 'error', 'warn', 'hover',
|
UrlType = usertypes.enum('UrlType', ['success', 'success_https', ' error',
|
||||||
'normal'])
|
'warn', 'hover', 'normal'])
|
||||||
|
|
||||||
|
|
||||||
class UrlText(textbase.TextBase):
|
class UrlText(textbase.TextBase):
|
||||||
@ -61,6 +61,10 @@ class UrlText(textbase.TextBase):
|
|||||||
{{ color['statusbar.url.fg.success'] }}
|
{{ color['statusbar.url.fg.success'] }}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QLabel#UrlText[urltype="success_https"] {
|
||||||
|
{{ color['statusbar.url.fg.success.https'] }}
|
||||||
|
}
|
||||||
|
|
||||||
QLabel#UrlText[urltype="error"] {
|
QLabel#UrlText[urltype="error"] {
|
||||||
{{ color['statusbar.url.fg.error'] }}
|
{{ color['statusbar.url.fg.error'] }}
|
||||||
}
|
}
|
||||||
@ -116,7 +120,9 @@ class UrlText(textbase.TextBase):
|
|||||||
status_str: The LoadStatus as string.
|
status_str: The LoadStatus as string.
|
||||||
"""
|
"""
|
||||||
status = webview.LoadStatus[status_str]
|
status = webview.LoadStatus[status_str]
|
||||||
if status in (webview.LoadStatus.success, webview.LoadStatus.error,
|
if status in (webview.LoadStatus.success,
|
||||||
|
webview.LoadStatus.success_https,
|
||||||
|
webview.LoadStatus.error,
|
||||||
webview.LoadStatus.warn):
|
webview.LoadStatus.warn):
|
||||||
self._normal_url_type = UrlType[status_str]
|
self._normal_url_type = UrlType[status_str]
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user