Skip to repository content

tenant.openagents/omega

No repository description is available.

OpenAgents Git authority 2026-07-28T05:35:57.638Z Public web read
NIP-34 coordinate30617:7649603503856e5148d571eac2766b288a8ff1e9e35d380337a1d2b0015b4f92:omega
MaintainersHidden in public view
References2 branches · 1 tag
Read-only clonegit clone https://openagents.com/git/tenant.openagents/omega.git
Browse files

git_panel_settings.rs

90 lines · 3.4 KB · rust
1use editor::{EditorSettings, ui_scrollbar_settings_from_raw};
2use gpui::Pixels;
3use schemars::JsonSchema;
4use serde::{Deserialize, Serialize};
5use settings::{
6    GitPanelClickBehavior, GitPanelGroupBy, GitPanelSortBy, RegisterSetting, Settings, StatusStyle,
7};
8use ui::{
9    px,
10    scrollbars::{ScrollbarVisibility, ShowScrollbar},
11};
12use workspace::dock::DockPosition;
13
14#[derive(Copy, Clone, Debug, Serialize, Deserialize, JsonSchema, PartialEq, Eq)]
15pub struct ScrollbarSettings {
16    pub show: Option<ShowScrollbar>,
17}
18
19#[derive(Debug, Clone, PartialEq, RegisterSetting)]
20pub struct GitPanelSettings {
21    pub button: bool,
22    pub dock: DockPosition,
23    pub default_width: Pixels,
24    pub status_style: StatusStyle,
25    pub file_icons: bool,
26    pub folder_icons: bool,
27    pub scrollbar: ScrollbarSettings,
28    pub fallback_branch_name: String,
29    pub sort_by: GitPanelSortBy,
30    pub group_by: GitPanelGroupBy,
31    pub collapse_untracked_diff: bool,
32    pub tree_view: bool,
33    pub diff_stats: bool,
34    pub show_count_badge: bool,
35    pub starts_open: bool,
36    pub commit_title_max_length: usize,
37    pub entry_primary_click_action: GitPanelClickBehavior,
38}
39
40#[derive(Default)]
41pub(crate) struct GitPanelScrollbarAccessor;
42
43impl ScrollbarVisibility for GitPanelScrollbarAccessor {
44    fn visibility(&self, cx: &ui::App) -> ShowScrollbar {
45        // TODO: This PR should have defined Editor's `scrollbar.axis`
46        // as an Option<ScrollbarAxis>, not a ScrollbarAxes as it would allow you to
47        // `.unwrap_or(EditorSettings::get_global(cx).scrollbar.show)`.
48        //
49        // Once this is fixed we can extend the GitPanelSettings with a `scrollbar.axis`
50        // so we can show each axis based on the settings.
51        //
52        // We should fix this. PR: https://github.com/zed-industries/zed/pull/19495
53        GitPanelSettings::get_global(cx)
54            .scrollbar
55            .show
56            .unwrap_or_else(|| EditorSettings::get_global(cx).scrollbar.show)
57    }
58}
59
60impl Settings for GitPanelSettings {
61    fn from_settings(content: &settings::SettingsContent) -> Self {
62        let git_panel = content.git_panel.clone().unwrap();
63        Self {
64            button: git_panel.button.unwrap(),
65            dock: git_panel.dock.unwrap().into(),
66            default_width: px(git_panel.default_width.unwrap()),
67            status_style: git_panel.status_style.unwrap(),
68            file_icons: git_panel.file_icons.unwrap(),
69            folder_icons: git_panel.folder_icons.unwrap(),
70            scrollbar: ScrollbarSettings {
71                show: git_panel
72                    .scrollbar
73                    .unwrap()
74                    .show
75                    .map(ui_scrollbar_settings_from_raw),
76            },
77            fallback_branch_name: git_panel.fallback_branch_name.unwrap(),
78            sort_by: git_panel.sort_by.unwrap(),
79            group_by: git_panel.group_by.unwrap(),
80            collapse_untracked_diff: git_panel.collapse_untracked_diff.unwrap(),
81            tree_view: git_panel.tree_view.unwrap(),
82            diff_stats: git_panel.diff_stats.unwrap(),
83            show_count_badge: git_panel.show_count_badge.unwrap(),
84            starts_open: git_panel.starts_open.unwrap(),
85            commit_title_max_length: git_panel.commit_title_max_length.unwrap(),
86            entry_primary_click_action: git_panel.entry_primary_click_action.unwrap(),
87        }
88    }
89}
90
Served at tenant.openagents/omega Member data and write actions are omitted.