Merge remote-tracking branch 'origin/pr/3450'
This commit is contained in:
commit
9f163d90e1
@ -30,8 +30,10 @@ import time
|
||||
import textwrap
|
||||
import mimetypes
|
||||
import urllib
|
||||
import collections
|
||||
|
||||
import pkg_resources
|
||||
import sip
|
||||
from PyQt5.QtCore import QUrlQuery, QUrl
|
||||
|
||||
import qutebrowser
|
||||
@ -201,6 +203,27 @@ def qute_bookmarks(_url):
|
||||
return 'text/html', html
|
||||
|
||||
|
||||
@add_handler('tabs')
|
||||
def qute_tabs(_url):
|
||||
"""Handler for qute://tabs. Display information about all open tabs."""
|
||||
tabs = collections.defaultdict(list)
|
||||
for win_id, window in objreg.window_registry.items():
|
||||
if sip.isdeleted(window):
|
||||
continue
|
||||
tabbed_browser = objreg.get('tabbed-browser',
|
||||
scope='window',
|
||||
window=win_id)
|
||||
for tab in tabbed_browser.widgets():
|
||||
if tab.url() not in [QUrl("qute://tabs/"), QUrl("qute://tabs")]:
|
||||
urlstr = tab.url().toDisplayString()
|
||||
tabs[str(win_id)].append((tab.title(), urlstr))
|
||||
|
||||
html = jinja.render('tabs.html',
|
||||
title='Tabs',
|
||||
tab_list_by_window=tabs)
|
||||
return 'text/html', html
|
||||
|
||||
|
||||
def history_data(start_time, offset=None):
|
||||
"""Return history data.
|
||||
|
||||
|
58
qutebrowser/html/tabs.html
Normal file
58
qutebrowser/html/tabs.html
Normal file
@ -0,0 +1,58 @@
|
||||
{% extends "styled.html" %}
|
||||
|
||||
{% block style %}
|
||||
{{super()}}
|
||||
h1 {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.url a {
|
||||
color: #444;
|
||||
}
|
||||
|
||||
th {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.qmarks .name {
|
||||
padding-left: 5px;
|
||||
}
|
||||
|
||||
.empty-msg {
|
||||
background-color: #f8f8f8;
|
||||
color: #444;
|
||||
display: inline-block;
|
||||
text-align: center;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
details {
|
||||
margin-top: 20px;
|
||||
}
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
<h1>Tab list</h1>
|
||||
{% for win_id, tabs in tab_list_by_window.items() %}
|
||||
<h2>Window {{ win_id }}</h2>
|
||||
<table class="tabs_win{{win_id}}">
|
||||
<tbody>
|
||||
{% for name, url in tabs %}
|
||||
<tr>
|
||||
<td class="name"><a href="{{url}}">{{name}}</a></td>
|
||||
<td class="url"><a href="{{url}}">{{url}}</a></td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% endfor %}
|
||||
<details>
|
||||
<summary>Raw list</summary>
|
||||
<code>
|
||||
{% for win_id, tabs in tab_list_by_window.items() %}{% for name, url in tabs %}
|
||||
{{url}}</br>{% endfor %}
|
||||
{% endfor %}
|
||||
</code>
|
||||
</details>
|
||||
{% endblock %}
|
Loading…
Reference in New Issue
Block a user