collab_ui.rs

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