Showing with 37 additions and 4 deletions.
  1. +2 −0 CHANGELOG.asciidoc
  2. +1 −0 README.asciidoc
  3. +2 −0 doc/help/settings.asciidoc
  4. +7 −4 qutebrowser/config/configdata.py
  5. +16 −0 qutebrowser/mainwindow/tabbedbrowser.py
  6. +9 −0 qutebrowser/mainwindow/tabwidget.py
@@ -27,6 +27,8 @@ Added
- `view_in_mpv` to open a video in mpv and remove it from the page.
- New setting `content -> host-blocking-whitelist` to whitelist certain domains
from the adblocker.
- `{scroll_pos}` can now be used in `ui -> window-title-format` and
`tabs -> title-format`.
Changed
~~~~~~~
@@ -152,6 +152,7 @@ Contributors, sorted by the number of commits in descending order:
* John ShaggyTwoDope Jenkins
* Jimmy
* Zach-Button
* Alexey Nabrodov
* rikn00
* Patric Schmitz
* Martin Zimmermann
@@ -609,6 +609,7 @@ The format to use for the window title. The following placeholders are defined:
* `{title}`: The title of the current web page
* `{title_sep}`: The string ` - ` if a title is set, empty otherwise.
* `{id}`: The internal window ID of this window.
* `{scroll_pos}`: The page scroll position.

Default: +pass:[{perc}{title}{title_sep}qutebrowser]+

@@ -1094,6 +1095,7 @@ The format to use for the tab title. The following placeholders are defined:
* `{title_sep}`: The string ` - ` if a title is set, empty otherwise.
* `{index}`: The index of this tab.
* `{id}`: The internal tab ID of this tab.
* `{scroll_pos}`: The page scroll position.

Default: +pass:[{index}: {title}]+

@@ -299,7 +299,8 @@ def data(readonly=False):

('window-title-format',
SettingValue(typ.FormatString(fields=['perc', 'perc_raw', 'title',
'title_sep', 'id']),
'title_sep', 'id',
'scroll_pos']),
'{perc}{title}{title_sep}qutebrowser'),
"The format to use for the window title. The following "
"placeholders are defined:\n\n"
@@ -308,7 +309,8 @@ def data(readonly=False):
"* `{title}`: The title of the current web page\n"
"* `{title_sep}`: The string ` - ` if a title is set, empty "
"otherwise.\n"
"* `{id}`: The internal window ID of this window."),
"* `{id}`: The internal window ID of this window.\n"
"* `{scroll_pos}`: The page scroll position."),

('hide-mouse-cursor',
SettingValue(typ.Bool(), 'false'),
@@ -534,7 +536,7 @@ def data(readonly=False):
('title-format',
SettingValue(typ.FormatString(
fields=['perc', 'perc_raw', 'title', 'title_sep', 'index',
'id']), '{index}: {title}'),
'id', 'scroll_pos']), '{index}: {title}'),
"The format to use for the tab title. The following placeholders "
"are defined:\n\n"
"* `{perc}`: The percentage as a string like `[10%]`.\n"
@@ -543,7 +545,8 @@ def data(readonly=False):
"* `{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."),
"* `{id}`: The internal tab ID of this tab.\n"
"* `{scroll_pos}`: The page scroll position."),

('mousewheel-tab-switching',
SettingValue(typ.Bool(), 'true'),
@@ -165,6 +165,15 @@ def update_window_title(self):
fields['title'] = tabtitle
fields['title_sep'] = ' - ' if tabtitle else ''
fields['id'] = self._win_id
y = widget.scroll_pos[1]
if y <= 0:
scroll_pos = 'top'
elif y >= 100:
scroll_pos = 'bot'
else:
scroll_pos = '{:2}%'.format(y)

fields['scroll_pos'] = scroll_pos
fmt = config.get('ui', 'window-title-format')
self.window().setWindowTitle(fmt.format(**fields))

@@ -185,6 +194,7 @@ def _connect_tab_signals(self, tab):
self._filter.create(self.cur_statusbar_message, tab))
tab.scroll_pos_changed.connect(
self._filter.create(self.cur_scroll_perc_changed, tab))
tab.scroll_pos_changed.connect(self.on_scroll_pos_changed)
tab.url_text_changed.connect(
self._filter.create(self.cur_url_text_changed, tab))
tab.load_status_changed.connect(
@@ -577,6 +587,12 @@ def on_load_finished(self, tab):
if idx == self.currentIndex():
self.update_window_title()

@pyqtSlot()
def on_scroll_pos_changed(self):
"""Update tab and window title when scroll position changed."""
self.update_window_title()
self.update_tab_titles()

def resizeEvent(self, e):
"""Extend resizeEvent of QWidget to emit a resized signal afterwards.
@@ -112,6 +112,15 @@ def update_tab_title(self, idx):
fields['index'] = idx + 1
fields['id'] = widget.tab_id
fields['title_sep'] = ' - ' if page_title else ''
y = widget.scroll_pos[1]
if y <= 0:
scroll_pos = 'top'
elif y >= 100:
scroll_pos = 'bot'
else:
scroll_pos = '{:2}%'.format(y)

fields['scroll_pos'] = scroll_pos

fmt = config.get('tabs', 'title-format')
self.tabBar().setTabText(idx, fmt.format(**fields))