mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 23:38:12 +00:00
Browser: Add "Close tab" action (Ctrl+W) :^)
Note that this is a little bit unreliable with the keyboard shortcut since LibGUI can get confused about which Action it's supposed to use as each Browser::Tab has its own "close tab" action. This will need to be fixed in LibGUI.
This commit is contained in:
parent
476a4475e5
commit
312501f309
3 changed files with 12 additions and 0 deletions
|
@ -100,6 +100,14 @@ int main(int argc, char** argv)
|
|||
window->set_title(String::format("%s - Browser", title.characters()));
|
||||
};
|
||||
|
||||
new_tab.on_tab_close_request = [&](auto& tab) {
|
||||
tab_widget.deferred_invoke([&](auto&) {
|
||||
tab_widget.remove_tab(tab);
|
||||
if (tab_widget.children().is_empty())
|
||||
app.quit();
|
||||
});
|
||||
};
|
||||
|
||||
window->set_icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/filetype-html.png"));
|
||||
|
||||
window->set_title("Browser");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue