Upgrade indicator to show recentlyAudible status
This commit is contained in:
parent
0642695c7d
commit
ae04da7b78
@ -650,6 +650,7 @@ class AbstractTab(QWidget):
|
|||||||
renderer_process_terminated = pyqtSignal(TerminationStatus, int)
|
renderer_process_terminated = pyqtSignal(TerminationStatus, int)
|
||||||
predicted_navigation = pyqtSignal(QUrl)
|
predicted_navigation = pyqtSignal(QUrl)
|
||||||
audio_muted_changed = pyqtSignal(bool)
|
audio_muted_changed = pyqtSignal(bool)
|
||||||
|
recently_audible_changed = pyqtSignal(bool)
|
||||||
|
|
||||||
def __init__(self, *, win_id, mode_manager, private, parent=None):
|
def __init__(self, *, win_id, mode_manager, private, parent=None):
|
||||||
self.private = private
|
self.private = private
|
||||||
@ -932,3 +933,7 @@ class AbstractTab(QWidget):
|
|||||||
def is_muted(self):
|
def is_muted(self):
|
||||||
"""Whether this tab is muted."""
|
"""Whether this tab is muted."""
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
|
def is_recently_audible(self):
|
||||||
|
"""Whether this tab has had audio playing recently."""
|
||||||
|
raise NotImplementedError
|
||||||
|
@ -1093,6 +1093,7 @@ class WebEngineTab(browsertab.AbstractTab):
|
|||||||
page.contentsSizeChanged.connect(self.contents_size_changed)
|
page.contentsSizeChanged.connect(self.contents_size_changed)
|
||||||
page.navigation_request.connect(self._on_navigation_request)
|
page.navigation_request.connect(self._on_navigation_request)
|
||||||
page.audioMutedChanged.connect(self.audio_muted_changed)
|
page.audioMutedChanged.connect(self.audio_muted_changed)
|
||||||
|
page.recentlyAudibleChanged.connect(self.recently_audible_changed)
|
||||||
|
|
||||||
view.titleChanged.connect(self.title_changed)
|
view.titleChanged.connect(self.title_changed)
|
||||||
view.urlChanged.connect(self._on_url_changed)
|
view.urlChanged.connect(self._on_url_changed)
|
||||||
@ -1125,3 +1126,7 @@ class WebEngineTab(browsertab.AbstractTab):
|
|||||||
def is_muted(self):
|
def is_muted(self):
|
||||||
page = self._widget.page()
|
page = self._widget.page()
|
||||||
return page.isAudioMuted()
|
return page.isAudioMuted()
|
||||||
|
|
||||||
|
def is_recently_audible(self):
|
||||||
|
page = self._widget.page()
|
||||||
|
return page.recentlyAudible()
|
||||||
|
@ -835,3 +835,7 @@ class WebKitTab(browsertab.AbstractTab):
|
|||||||
def is_muted(self):
|
def is_muted(self):
|
||||||
# Dummy value for things that read muted status
|
# Dummy value for things that read muted status
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
def is_recently_audible(self):
|
||||||
|
# Dummy value for things that read audible status
|
||||||
|
return False
|
||||||
|
@ -1344,7 +1344,7 @@ tabs.title.alignment:
|
|||||||
desc: Alignment of the text inside of tabs.
|
desc: Alignment of the text inside of tabs.
|
||||||
|
|
||||||
tabs.title.format:
|
tabs.title.format:
|
||||||
default: '{index}: {title}'
|
default: '{audio}{index}: {title}'
|
||||||
type:
|
type:
|
||||||
name: FormatString
|
name: FormatString
|
||||||
fields:
|
fields:
|
||||||
@ -1359,7 +1359,7 @@ tabs.title.format:
|
|||||||
- private
|
- private
|
||||||
- current_url
|
- current_url
|
||||||
- protocol
|
- protocol
|
||||||
- muted
|
- audio
|
||||||
none_ok: true
|
none_ok: true
|
||||||
desc: |
|
desc: |
|
||||||
Format to use for the tab title.
|
Format to use for the tab title.
|
||||||
@ -1377,7 +1377,7 @@ tabs.title.format:
|
|||||||
* `{private}`: Indicates when private mode is enabled.
|
* `{private}`: Indicates when private mode is enabled.
|
||||||
* `{current_url}`: URL of the current web page.
|
* `{current_url}`: URL of the current web page.
|
||||||
* `{protocol}`: Protocol (http/https/...) of the current web page.
|
* `{protocol}`: Protocol (http/https/...) of the current web page.
|
||||||
* `{muted}`: Icon if the tab is muted
|
* `{audio}`: Cookie for audio/mute status
|
||||||
|
|
||||||
tabs.title.format_pinned:
|
tabs.title.format_pinned:
|
||||||
default: '{index}'
|
default: '{index}'
|
||||||
@ -1395,7 +1395,7 @@ tabs.title.format_pinned:
|
|||||||
- private
|
- private
|
||||||
- current_url
|
- current_url
|
||||||
- protocol
|
- protocol
|
||||||
- muted
|
- audio
|
||||||
none_ok: true
|
none_ok: true
|
||||||
desc: Format to use for the tab title for pinned tabs. The same placeholders
|
desc: Format to use for the tab title for pinned tabs. The same placeholders
|
||||||
like for `tabs.title.format` are defined.
|
like for `tabs.title.format` are defined.
|
||||||
@ -1563,7 +1563,7 @@ window.title_format:
|
|||||||
- private
|
- private
|
||||||
- current_url
|
- current_url
|
||||||
- protocol
|
- protocol
|
||||||
- muted
|
- audio
|
||||||
default: '{perc}{title}{title_sep}qutebrowser'
|
default: '{perc}{title}{title_sep}qutebrowser'
|
||||||
desc: |
|
desc: |
|
||||||
Format to use for the window title. The same placeholders like for
|
Format to use for the window title. The same placeholders like for
|
||||||
@ -2366,6 +2366,7 @@ bindings.default:
|
|||||||
<Ctrl-Return>: follow-selected -t
|
<Ctrl-Return>: follow-selected -t
|
||||||
.: repeat-command
|
.: repeat-command
|
||||||
<Ctrl-p>: tab-pin
|
<Ctrl-p>: tab-pin
|
||||||
|
<Alt-m>: tab-mute
|
||||||
q: record-macro
|
q: record-macro
|
||||||
"@": run-macro
|
"@": run-macro
|
||||||
tsh: config-cycle -p -t -u *://{url:host}/* content.javascript.enabled ;; reload
|
tsh: config-cycle -p -t -u *://{url:host}/* content.javascript.enabled ;; reload
|
||||||
|
@ -239,7 +239,9 @@ class TabbedBrowser(QWidget):
|
|||||||
tab.renderer_process_terminated.connect(
|
tab.renderer_process_terminated.connect(
|
||||||
functools.partial(self._on_renderer_process_terminated, tab))
|
functools.partial(self._on_renderer_process_terminated, tab))
|
||||||
tab.audio_muted_changed.connect(
|
tab.audio_muted_changed.connect(
|
||||||
functools.partial(self.on_mute_changed, tab))
|
functools.partial(self.on_audio_changed, tab))
|
||||||
|
tab.recently_audible_changed.connect(
|
||||||
|
functools.partial(self.on_audio_changed, tab))
|
||||||
tab.new_tab_requested.connect(self.tabopen)
|
tab.new_tab_requested.connect(self.tabopen)
|
||||||
if not self.private:
|
if not self.private:
|
||||||
web_history = objreg.get('web-history')
|
web_history = objreg.get('web-history')
|
||||||
@ -736,16 +738,16 @@ class TabbedBrowser(QWidget):
|
|||||||
self.widget.update_tab_title(idx, 'scroll_pos')
|
self.widget.update_tab_title(idx, 'scroll_pos')
|
||||||
|
|
||||||
@pyqtSlot()
|
@pyqtSlot()
|
||||||
def on_mute_changed(self, tab, muted):
|
def on_audio_changed(self, tab, muted):
|
||||||
"""Update tab and window title when scroll position changed."""
|
"""Update audio cookie in tab when mute or recentlyAudible changed."""
|
||||||
try:
|
try:
|
||||||
idx = self._tab_index(tab)
|
idx = self._tab_index(tab)
|
||||||
except TabDeletedError:
|
except TabDeletedError:
|
||||||
# We can get signals for tabs we already deleted...
|
# We can get signals for tabs we already deleted...
|
||||||
return
|
return
|
||||||
self.widget.update_tab_title(idx, 'muted')
|
self.widget.update_tab_title(idx, 'audio')
|
||||||
if idx == self.widget.currentIndex():
|
if idx == self.widget.currentIndex():
|
||||||
self._update_window_title('muted')
|
self._update_window_title('audio')
|
||||||
|
|
||||||
def _on_renderer_process_terminated(self, tab, status, code):
|
def _on_renderer_process_terminated(self, tab, status, code):
|
||||||
"""Show an error when a renderer process terminated."""
|
"""Show an error when a renderer process terminated."""
|
||||||
|
@ -172,7 +172,8 @@ class TabWidget(QTabWidget):
|
|||||||
fields['perc_raw'] = tab.progress()
|
fields['perc_raw'] = tab.progress()
|
||||||
fields['backend'] = objects.backend.name
|
fields['backend'] = objects.backend.name
|
||||||
fields['private'] = ' [Private Mode] ' if tab.private else ''
|
fields['private'] = ' [Private Mode] ' if tab.private else ''
|
||||||
fields['muted'] = '[M] ' if tab.is_muted() else ''
|
fields['audio'] = '[M] ' if tab.is_muted() else (
|
||||||
|
'[A] ' if tab.is_recently_audible() else '')
|
||||||
|
|
||||||
if tab.load_status() == usertypes.LoadStatus.loading:
|
if tab.load_status() == usertypes.LoadStatus.loading:
|
||||||
fields['perc'] = '[{}%] '.format(tab.progress())
|
fields['perc'] = '[{}%] '.format(tab.progress())
|
||||||
|
Loading…
Reference in New Issue
Block a user