mirror of
https://github.com/RGBCube/serenity
synced 2025-07-19 07:27:34 +00:00
Browser: Hide tab bar if there's only one tab
This commit is contained in:
parent
f4a941a5d7
commit
e5ea243842
2 changed files with 3 additions and 1 deletions
|
@ -239,7 +239,7 @@ Tab::Tab()
|
||||||
|
|
||||||
auto is_fullscreen = window()->is_fullscreen();
|
auto is_fullscreen = window()->is_fullscreen();
|
||||||
auto* tab_widget = static_cast<GUI::TabWidget*>(parent_widget());
|
auto* tab_widget = static_cast<GUI::TabWidget*>(parent_widget());
|
||||||
tab_widget->set_bar_visible(!is_fullscreen);
|
tab_widget->set_bar_visible(!is_fullscreen && tab_widget->children().size() > 1);
|
||||||
m_toolbar_container->set_visible(!is_fullscreen);
|
m_toolbar_container->set_visible(!is_fullscreen);
|
||||||
m_statusbar->set_visible(!is_fullscreen);
|
m_statusbar->set_visible(!is_fullscreen);
|
||||||
},
|
},
|
||||||
|
|
|
@ -127,6 +127,7 @@ int main(int argc, char** argv)
|
||||||
create_new_tab = [&](auto url, auto activate) {
|
create_new_tab = [&](auto url, auto activate) {
|
||||||
auto& new_tab = tab_widget.add_tab<Browser::Tab>("New tab");
|
auto& new_tab = tab_widget.add_tab<Browser::Tab>("New tab");
|
||||||
|
|
||||||
|
tab_widget.set_bar_visible(!window->is_fullscreen() && tab_widget.children().size() > 1);
|
||||||
tab_widget.set_tab_icon(new_tab, default_favicon);
|
tab_widget.set_tab_icon(new_tab, default_favicon);
|
||||||
|
|
||||||
new_tab.on_title_change = [&](auto title) {
|
new_tab.on_title_change = [&](auto title) {
|
||||||
|
@ -146,6 +147,7 @@ int main(int argc, char** argv)
|
||||||
new_tab.on_tab_close_request = [&](auto& tab) {
|
new_tab.on_tab_close_request = [&](auto& tab) {
|
||||||
tab_widget.deferred_invoke([&](auto&) {
|
tab_widget.deferred_invoke([&](auto&) {
|
||||||
tab_widget.remove_tab(tab);
|
tab_widget.remove_tab(tab);
|
||||||
|
tab_widget.set_bar_visible(!window->is_fullscreen() && tab_widget.children().size() > 1);
|
||||||
if (tab_widget.children().is_empty())
|
if (tab_widget.children().is_empty())
|
||||||
app.quit();
|
app.quit();
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue