collab_ui.rs

 1pub mod channel_view;
 2pub mod collab_panel;
 3pub mod notification_panel;
 4pub mod notifications;
 5mod panel_settings;
 6
 7use std::{rc::Rc, sync::Arc};
 8
 9pub use collab_panel::CollabPanel;
10use gpui::{
11    App, Pixels, PlatformDisplay, Size, WindowBackgroundAppearance, WindowBounds,
12    WindowDecorations, WindowKind, WindowOptions, point,
13};
14pub use panel_settings::{CollaborationPanelSettings, NotificationPanelSettings};
15use release_channel::ReleaseChannel;
16use ui::px;
17use workspace::AppState;
18
19pub fn init(app_state: &Arc<AppState>, cx: &mut App) {
20    channel_view::init(cx);
21    collab_panel::init(cx);
22    notification_panel::init(cx);
23    notifications::init(app_state, cx);
24    title_bar::init(cx);
25}
26
27fn notification_window_options(
28    screen: Rc<dyn PlatformDisplay>,
29    size: Size<Pixels>,
30    cx: &App,
31) -> WindowOptions {
32    let notification_margin_width = px(16.);
33    let notification_margin_height = px(-48.);
34
35    let bounds = gpui::Bounds::<Pixels> {
36        origin: screen.bounds().top_right()
37            - point(
38                size.width + notification_margin_width,
39                notification_margin_height,
40            ),
41        size,
42    };
43
44    let app_id = ReleaseChannel::global(cx).app_id();
45
46    WindowOptions {
47        window_bounds: Some(WindowBounds::Windowed(bounds)),
48        titlebar: None,
49        focus: false,
50        show: true,
51        kind: WindowKind::PopUp,
52        is_movable: false,
53        display_id: Some(screen.id()),
54        window_background: WindowBackgroundAppearance::Transparent,
55        app_id: Some(app_id.to_owned()),
56        window_min_size: None,
57        window_decorations: Some(WindowDecorations::Client),
58        tabbing_identifier: None,
59        ..Default::default()
60    }
61}