mirror of
https://github.com/wez/wezterm.git
synced 2024-12-24 22:01:47 +03:00
macos: spawn new window when clicking on dock icon
If there are no windows, clicking on the dock icon will spawn a new window. Requires that `quit_when_all_windows_are_closed=false` refs: https://github.com/wez/wezterm/issues/3057
This commit is contained in:
parent
6968ad5c3c
commit
2271c3ae59
@ -68,6 +68,14 @@ extern "C" fn application_will_finish_launching(
|
||||
log::debug!("application_will_finish_launching");
|
||||
}
|
||||
|
||||
extern "C" fn application_open_untitled_file(_self: &mut Object, _sel: Sel, _app: *mut Object) {
|
||||
if let Some(conn) = Connection::get() {
|
||||
conn.dispatch_app_event(ApplicationEvent::PerformKeyAssignment(
|
||||
KeyAssignment::SpawnWindow,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
extern "C" fn wezterm_perform_key_assignment(
|
||||
_self: &mut Object,
|
||||
_sel: Sel,
|
||||
@ -167,6 +175,10 @@ fn get_class() -> &'static Class {
|
||||
sel!(weztermShowAbout:),
|
||||
wezterm_show_about as extern "C" fn(&mut Object, Sel, *mut Object),
|
||||
);
|
||||
cls.add_method(
|
||||
sel!(applicationOpenUntitledFile:),
|
||||
application_open_untitled_file as extern "C" fn(&mut Object, Sel, *mut Object),
|
||||
);
|
||||
}
|
||||
|
||||
cls.register()
|
||||
|
Loading…
Reference in New Issue
Block a user