Close current browser tab

This commit is contained in:
2026-05-07 18:58:49 -04:00
parent e9ef92c41b
commit 510af7a9b2
3 changed files with 124 additions and 19 deletions
+20 -10
View File
@@ -6,21 +6,31 @@ use gpui::{
};
use shell::ElyShell;
actions!(ely_app, [Quit]);
actions!(ely_app, [CloseCurrentTab, Quit]);
fn main() {
Application::new().run(|cx: &mut App| {
gpui_component::init(cx);
cx.on_action(quit);
cx.bind_keys([KeyBinding::new("cmd-q", Quit, None)]);
cx.set_menus(vec![Menu {
name: "ELY Browser".into(),
items: vec![
MenuItem::os_submenu("Services", SystemMenuType::Services),
MenuItem::separator(),
MenuItem::action("Quit ELY Browser", Quit),
],
}]);
cx.bind_keys([
KeyBinding::new("cmd-w", CloseCurrentTab, None),
KeyBinding::new("ctrl-w", CloseCurrentTab, None),
KeyBinding::new("cmd-q", Quit, None),
]);
cx.set_menus(vec![
Menu {
name: "ELY Browser".into(),
items: vec![
MenuItem::os_submenu("Services", SystemMenuType::Services),
MenuItem::separator(),
MenuItem::action("Quit ELY Browser", Quit),
],
},
Menu {
name: "File".into(),
items: vec![MenuItem::action("Close Tab", CloseCurrentTab)],
},
]);
let bounds = Bounds::centered(None, size(px(1240.0), px(780.0)), cx);
let opened = cx.open_window(