Open a new window when activating Zed from the dock w/ no windows open
This commit is contained in:
parent
7601e7902a
commit
b5f762ab25
5 changed files with 49 additions and 17 deletions
|
@ -254,6 +254,19 @@ impl App {
|
|||
self
|
||||
}
|
||||
|
||||
/// Handle the application being re-activated when no windows are open.
|
||||
pub fn on_reopen<F>(&mut self, mut callback: F) -> &mut Self
|
||||
where
|
||||
F: 'static + FnMut(&mut MutableAppContext),
|
||||
{
|
||||
let cx = self.0.clone();
|
||||
self.0
|
||||
.borrow_mut()
|
||||
.foreground_platform
|
||||
.on_reopen(Box::new(move || callback(&mut *cx.borrow_mut())));
|
||||
self
|
||||
}
|
||||
|
||||
pub fn on_event<F>(&mut self, mut callback: F) -> &mut Self
|
||||
where
|
||||
F: 'static + FnMut(Event, &mut MutableAppContext) -> bool,
|
||||
|
@ -276,9 +289,7 @@ impl App {
|
|||
self.0
|
||||
.borrow_mut()
|
||||
.foreground_platform
|
||||
.on_open_urls(Box::new(move |paths| {
|
||||
callback(paths, &mut *cx.borrow_mut())
|
||||
}));
|
||||
.on_open_urls(Box::new(move |urls| callback(urls, &mut *cx.borrow_mut())));
|
||||
self
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue