title-format-pinned initial work
Created configuration configdata. Load and use template defined on configdata. TODO: ability to conserve information between restart TODO: ability to update title on configuration change
This commit is contained in:
parent
b24ac0ae78
commit
4f0034911a
@ -679,6 +679,23 @@ def data(readonly=False):
|
||||
"* `{scroll_pos}`: The page scroll position.\n"
|
||||
"* `{host}`: The host of the current web page."),
|
||||
|
||||
('title-format-pinned',
|
||||
SettingValue(typ.FormatString(
|
||||
fields=['perc', 'perc_raw', 'title', 'title_sep', 'index',
|
||||
'id', 'scroll_pos', 'host'], none_ok=True),
|
||||
'{index}'),
|
||||
"The format to use for the pinned tab title."
|
||||
" The following placeholders are defined:\n\n"
|
||||
"* `{perc}`: The percentage as a string like `[10%]`.\n"
|
||||
"* `{perc_raw}`: The raw percentage, e.g. `10`\n"
|
||||
"* `{title}`: The title of the current web page\n"
|
||||
"* `{title_sep}`: The string ` - ` if a title is set, empty "
|
||||
"otherwise.\n"
|
||||
"* `{index}`: The index of this tab.\n"
|
||||
"* `{id}`: The internal tab ID of this tab.\n"
|
||||
"* `{scroll_pos}`: The page scroll position.\n"
|
||||
"* `{host}`: The host of the current web page."),
|
||||
|
||||
('title-alignment',
|
||||
SettingValue(typ.TextAlignment(), 'left'),
|
||||
"Alignment of the text inside of tabs"),
|
||||
|
@ -107,9 +107,10 @@ class TabWidget(QTabWidget):
|
||||
fields['index'] = idx + 1
|
||||
|
||||
fmt = config.get('tabs', 'title-format')
|
||||
fmt_pinned = config.get('tabs', 'title-format-pinned')
|
||||
|
||||
if fields['pinned']:
|
||||
title = '{index}'.format(**fields)
|
||||
title = fmt_pinned.format(**fields)
|
||||
else:
|
||||
title = '' if fmt is None else fmt.format(**fields)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user