Open downloads from command bar

This commit is contained in:
2026-05-07 20:54:57 -04:00
parent 3ba9db7819
commit 9c5f93bcb8
6 changed files with 64 additions and 5 deletions
+21 -1
View File
@@ -6,7 +6,7 @@ use gpui::{App, AppContext, Context, Entity, FocusHandle, Focusable, Subscriptio
use gpui_component::input::{InputEvent, InputState, SelectAll};
use crate::{
CloseCurrentTab, FocusAddressBar, OpenNewTab, RestoreClosedTab, SelectNextTab,
CloseCurrentTab, FocusAddressBar, OpenDownloads, OpenNewTab, RestoreClosedTab, SelectNextTab,
SelectPreviousTab, ToggleFavoriteTab, TogglePinnedTab,
};
@@ -90,6 +90,17 @@ impl ElyShell {
}
}
fn open_downloads(&mut self, window: &mut Window, cx: &mut Context<Self>) {
if let ShellState::Ready(core) = &mut self.state
&& let Ok(url) = UrlText::parse("ely://downloads")
{
core.open_tab(url);
self.sync_address_input(window, cx);
self.focus_address_bar(window, cx);
cx.notify();
}
}
fn focus_address_bar(&mut self, window: &mut Window, cx: &mut Context<Self>) {
self.command_input.update(cx, |input, cx| {
input.focus(window, cx);
@@ -203,6 +214,15 @@ impl ElyShell {
self.open_new_tab(window, cx);
}
fn on_open_downloads(
&mut self,
_: &OpenDownloads,
window: &mut Window,
cx: &mut Context<Self>,
) {
self.open_downloads(window, cx);
}
fn on_restore_closed_tab(
&mut self,
_: &RestoreClosedTab,