1use gpui::{App, Global, Window};
7
8pub type LinkHandler = fn(url: &str, &mut Window, &mut App);
10
11struct Installed(LinkHandler);
12
13impl Global for Installed {}
14
15pub fn set_link_handler(cx: &mut App, handler: LinkHandler) {
17 cx.set_global(Installed(handler));
18}
19
20pub(crate) fn open(url: &str, window: &mut Window, cx: &mut App) {
21 match cx.try_global::<Installed>().map(|installed| installed.0) {
22 Some(handler) => handler(url, window, cx),
23 None => cx.open_url(url),
24 }
25}