Close context menus on middle click to open in new tab

This commit is contained in:
Jason Rodney Hansen 2026-02-17 17:44:44 -07:00
parent 1dc14b6d39
commit 9def981016

View file

@ -4300,6 +4300,7 @@ impl Application for App {
} }
tab::Command::OpenFile(paths) => commands.push(self.open_file(&paths)), tab::Command::OpenFile(paths) => commands.push(self.open_file(&paths)),
tab::Command::OpenInNewTab(path) => { tab::Command::OpenInNewTab(path) => {
commands.push(self.close_context_menus());
commands.push(self.open_tab(Location::Path(path), false, None)); commands.push(self.open_tab(Location::Path(path), false, None));
} }
tab::Command::OpenInNewWindow(path) => match env::current_exe() { tab::Command::OpenInNewWindow(path) => match env::current_exe() {
@ -4746,25 +4747,21 @@ impl Application for App {
} }
} }
NavMenuAction::OpenInNewTab(entity) => { NavMenuAction::OpenInNewTab(entity) => {
match self.nav_model.data::<Location>(entity) { let open_task = match self.nav_model.data::<Location>(entity) {
Some(Location::Network(uri, display_name, path)) => { Some(Location::Network(uri, display_name, path)) => self.open_tab(
return self.open_tab( Location::Network(uri.clone(), display_name.clone(), path.clone()),
Location::Network(uri.clone(), display_name.clone(), path.clone()), false,
false, None,
None, ),
);
}
Some(Location::Path(path)) => { Some(Location::Path(path)) => {
return self.open_tab(Location::Path(path.clone()), false, None); self.open_tab(Location::Path(path.clone()), false, None)
} }
Some(Location::Recents) => { Some(Location::Recents) => self.open_tab(Location::Recents, false, None),
return self.open_tab(Location::Recents, false, None); Some(Location::Trash) => self.open_tab(Location::Trash, false, None),
} _ => Task::none(),
Some(Location::Trash) => { };
return self.open_tab(Location::Trash, false, None);
} return Task::batch([self.close_context_menus(), open_task]);
_ => {}
}
} }
// Open the selected path in a new cosmic-files window. // Open the selected path in a new cosmic-files window.