Add tabs page
This commit is contained in:
parent
f5edd4941e
commit
dea0aa9f7c
@ -201,6 +201,31 @@ def qute_bookmarks(_url):
|
||||
return 'text/html', html
|
||||
|
||||
|
||||
def _tab_fields_to_tabs_page_info(fields):
|
||||
return (fields['title'], fields['current_url'])
|
||||
|
||||
|
||||
@add_handler('tabs')
|
||||
def qute_tabs(_url):
|
||||
"""Handler for qute://tabs. Display information about all open tabs."""
|
||||
tabs = {}
|
||||
for win_id in objreg.window_registry:
|
||||
win_id_str = str(win_id)
|
||||
tabs[win_id_str] = []
|
||||
tabbed_browser = objreg.get('tabbed-browser',
|
||||
scope='window',
|
||||
window=win_id)
|
||||
for tab_idx in range(tabbed_browser.count()):
|
||||
tabs[win_id_str].append(
|
||||
_tab_fields_to_tabs_page_info(
|
||||
tabbed_browser.get_tab_fields(tab_idx)))
|
||||
|
||||
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.
|
||||
|
||||
|
56
qutebrowser/html/tabs.html
Normal file
56
qutebrowser/html/tabs.html
Normal file
@ -0,0 +1,56 @@
|
||||
{% 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%;
|
||||
}
|
||||
{% 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 %}
|
||||
|
||||
<h2>Raw list</h2>
|
||||
<code>
|
||||
{% for win_id, tabs in tab_list_by_window.items() %}
|
||||
{% for name, url in tabs %}
|
||||
{{url}}</br>
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
</code>
|
||||
|
||||
{% endblock %}
|
Loading…
Reference in New Issue
Block a user