first pass of merging in warp (doesn't build)
This commit is contained in:
@@ -1,39 +1,69 @@
|
||||
use std::borrow::Cow;
|
||||
use std::cell::RefCell;
|
||||
use std::collections::HashMap;
|
||||
use std::path::PathBuf;
|
||||
use std::rc::Rc;
|
||||
|
||||
use ::settings::{Setting, SettingSection, ToggleableSetting};
|
||||
use enum_iterator::all;
|
||||
use galaxy_core::ui::theme::color::internal_colors;
|
||||
use warp_util::path::user_friendly_path;
|
||||
use warpui::elements::{
|
||||
Align, Border, ChildView, Clipped, ConstrainedBox, Container, CornerRadius, CrossAxisAlignment,
|
||||
Dismiss, Element, Empty, Fill, Flex, FormattedTextElement, Hoverable, MainAxisAlignment,
|
||||
MainAxisSize, MouseStateHandle, ParentElement, Radius, Shrinkable, Text, Wrap,
|
||||
DEFAULT_UI_LINE_HEIGHT_RATIO,
|
||||
};
|
||||
use warpui::fonts::{FamilyId, FontInfo, Weight};
|
||||
use warpui::keymap::{ContextPredicate, FixedBinding};
|
||||
use warpui::platform::{Cursor, FilePickerConfiguration, GraphicsBackend, SystemTheme};
|
||||
use warpui::rendering::ThinStrokes;
|
||||
use warpui::ui_components::button::ButtonVariant;
|
||||
use warpui::ui_components::components::{Coords, UiComponent, UiComponentStyles};
|
||||
use warpui::ui_components::radio_buttons::{
|
||||
RadioButtonItem, RadioButtonLayout, RadioButtonStateHandle,
|
||||
};
|
||||
use warpui::ui_components::slider::SliderStateHandle;
|
||||
use warpui::ui_components::switch::SwitchStateHandle;
|
||||
use warpui::units::IntoPixels;
|
||||
use warpui::{
|
||||
id, Action, AppContext, Entity, ModelHandle, SingletonEntity, TypedActionView, UpdateModel,
|
||||
View, ViewContext, ViewHandle, WindowId,
|
||||
};
|
||||
|
||||
use super::directory_color_add_picker::{DirectoryColorAddPicker, DirectoryColorAddPickerEvent};
|
||||
use super::settings_page::{
|
||||
AdditionalInfo, Category, LocalOnlyIconState, MatchData, PageType, SettingsWidget,
|
||||
CONTENT_FONT_SIZE,
|
||||
build_reset_button, render_body_item, render_body_item_label, render_dropdown_item,
|
||||
AdditionalInfo, Category, LocalOnlyIconState, MatchData, PageType, SettingsPageEvent,
|
||||
SettingsPageMeta, SettingsPageViewHandle, SettingsWidget, ToggleState, CONTENT_FONT_SIZE,
|
||||
HEADER_PADDING,
|
||||
};
|
||||
use super::{flags, SettingsSection};
|
||||
use super::{
|
||||
settings_page::{
|
||||
build_reset_button, render_body_item, render_body_item_label, render_dropdown_item,
|
||||
SettingsPageEvent, SettingsPageMeta, SettingsPageViewHandle, ToggleState, HEADER_PADDING,
|
||||
},
|
||||
SettingsAction,
|
||||
flags, SettingActionPairContexts, SettingActionPairDescriptions, SettingsAction,
|
||||
SettingsSection, ToggleSettingActionPair,
|
||||
};
|
||||
use super::{SettingActionPairContexts, SettingActionPairDescriptions, ToggleSettingActionPair};
|
||||
use crate::appearance::{Appearance, AppearanceEvent};
|
||||
use crate::channel::{Channel, ChannelState};
|
||||
use crate::context_chips::prompt::PromptEvent;
|
||||
use crate::context_chips::renderer::ChipDragState;
|
||||
use crate::context_chips::{
|
||||
prompt::Prompt, renderer::Renderer as ContextChipRenderer, ChipAvailability,
|
||||
};
|
||||
use crate::context_chips::prompt::{Prompt, PromptEvent};
|
||||
use crate::context_chips::renderer::{ChipDragState, Renderer as ContextChipRenderer};
|
||||
use crate::context_chips::ChipAvailability;
|
||||
use crate::editor::{
|
||||
EditOrigin, Event as EditorEvent, InteractionState, SingleLineEditorOptions, TextOptions,
|
||||
EditOrigin, EditorView, Event as EditorEvent, InteractionState, SingleLineEditorOptions,
|
||||
TextOptions,
|
||||
};
|
||||
use crate::features::FeatureFlag;
|
||||
use crate::gpu_state::{GPUState, GPUStateEvent};
|
||||
use crate::prompt::editor_modal::OpenSource as PromptEditorOpenSource;
|
||||
use crate::server::telemetry::InputUXChangeOrigin;
|
||||
use crate::server::telemetry::{InputUXChangeOrigin, TelemetryEvent};
|
||||
use crate::settings::app_icon::{AppIcon, AppIconSettings, ShowDockIconState};
|
||||
use crate::settings::{
|
||||
active_theme_kind,
|
||||
app_icon::{AppIcon, AppIconSettings},
|
||||
respect_system_theme, AIFontName, AppEditorSettings, CursorBlink, CursorBlinkEnabled,
|
||||
EnforceMinimumContrast, FocusPaneOnHover, FontSettings, FontSettingsChangedEvent, InputBoxType,
|
||||
InputModeSettings, InputModeState, MonospaceFontName, PaneSettings, ShouldDimInactivePanes,
|
||||
ThemeSettings, UIFontName, UseSystemTheme, DEFAULT_MONOSPACE_FONT_NAME, DEFAULT_UI_FONT_NAME,
|
||||
active_theme_kind, respect_system_theme, AIFontName, AppEditorSettings, CursorBlink,
|
||||
CursorBlinkEnabled, CursorDisplayType, EnforceMinimumContrast, FocusPaneOnHover, FontSettings,
|
||||
FontSettingsChangedEvent, GPUSettings, InputBoxType, InputModeSettings, InputModeState,
|
||||
InputSettings, InputSettingsChangedEvent, MonospaceFontName, PaneSettings,
|
||||
ShouldDimInactivePanes, ThemeSettings, UseSystemTheme, UseThinStrokes,
|
||||
DEFAULT_MONOSPACE_FONT_NAME,
|
||||
};
|
||||
use crate::settings::{CursorDisplayType, GPUSettings, InputSettings, InputSettingsChangedEvent};
|
||||
use crate::terminal::block_list_viewport::InputMode;
|
||||
use crate::terminal::blockgrid_element::BlockGridElement;
|
||||
use crate::terminal::ligature_settings::{LigatureRenderingEnabled, LigatureSettings};
|
||||
@@ -43,75 +73,31 @@ use crate::terminal::session_settings::SessionSettings;
|
||||
use crate::terminal::settings::{
|
||||
AltScreenPadding, AltScreenPaddingMode, Spacing, SpacingMode, TerminalSettings,
|
||||
};
|
||||
use crate::terminal::{BlockListSettings, ShowBlockDividers};
|
||||
use crate::terminal::{ShowJumpToBottomOfBlockButton, SizeInfo};
|
||||
use crate::themes::theme::{
|
||||
self, GalaxyTheme, RespectSystemTheme, SelectedSystemThemes, ThemeKind,
|
||||
use crate::terminal::{
|
||||
BlockListSettings, ShowBlockDividers, ShowJumpToBottomOfBlockButton, SizeInfo,
|
||||
};
|
||||
use crate::user_config::GalaxyConfig;
|
||||
use crate::themes::theme::{self, RespectSystemTheme, SelectedSystemThemes, ThemeKind, WarpTheme};
|
||||
use crate::themes::theme_chooser::ThemeChooserMode;
|
||||
use crate::ui_components::color_dot::{render_color_dot, TAB_COLOR_OPTIONS};
|
||||
use crate::ui_components::icons::Icon;
|
||||
use crate::user_config::WarpConfig;
|
||||
use crate::util::bindings;
|
||||
use crate::view_components::action_button::{ActionButton, ButtonSize, NakedTheme};
|
||||
use crate::view_components::{Dropdown, DropdownItem, FilterableDropdown};
|
||||
use crate::window_settings::{
|
||||
BackgroundBlurRadius, BackgroundBlurTexture, BackgroundOpacity, LeftPanelVisibilityAcrossTabs,
|
||||
OpenWindowsAtCustomSize, WindowSettings, WindowSettingsChangedEvent, ZoomLevel,
|
||||
};
|
||||
use crate::workspace::header_toolbar_editor::HeaderToolbarInlineEditor;
|
||||
use crate::workspace::tab_settings::{
|
||||
DirectoryTabColor, PreserveActiveTabColor, ShowCodeReviewButton, ShowIndicatorsButton,
|
||||
TabCloseButtonPosition, TabSettings, TabSettingsChangedEvent,
|
||||
UseLatestUserPromptAsConversationTitleInTabNames, UseVerticalTabs,
|
||||
canonical_directory_key, DirectoryTabColor, HideTitleBarSearchBarInVerticalTabs,
|
||||
PreserveActiveTabColor, ShowCodeReviewButton, ShowIndicatorsButton,
|
||||
ShowVerticalTabPanelInRestoredWindows, TabCloseButtonPosition, TabSettings,
|
||||
TabSettingsChangedEvent, UseLatestUserPromptAsConversationTitleInTabNames, UseVerticalTabs,
|
||||
WorkspaceDecorationVisibility,
|
||||
};
|
||||
use crate::workspace::WorkspaceAction;
|
||||
use crate::{editor::EditorView, themes::theme_chooser::ThemeChooserMode};
|
||||
use crate::{
|
||||
features::FeatureFlag,
|
||||
view_components::{Dropdown, DropdownItem, FilterableDropdown},
|
||||
};
|
||||
use crate::{report_error, report_if_error, themes};
|
||||
use crate::{send_telemetry_from_ctx, server::telemetry::TelemetryEvent};
|
||||
use ::settings::{Setting, SettingSection, ToggleableSetting};
|
||||
use enum_iterator::all;
|
||||
use galaxy_core::ui::theme::color::internal_colors;
|
||||
use galaxy_util::path::user_friendly_path;
|
||||
use galaxyui::elements::{
|
||||
Clipped, Empty, FormattedTextElement, MainAxisAlignment, MainAxisSize, Text, Wrap,
|
||||
};
|
||||
use galaxyui::fonts::{FamilyId, FontInfo, Weight};
|
||||
use galaxyui::keymap::{ContextPredicate, FixedBinding};
|
||||
use galaxyui::platform::{Cursor, FilePickerConfiguration, GraphicsBackend};
|
||||
use galaxyui::ui_components::button::ButtonVariant;
|
||||
use galaxyui::ui_components::components::{Coords, UiComponent, UiComponentStyles};
|
||||
use galaxyui::ui_components::radio_buttons::{
|
||||
RadioButtonItem, RadioButtonLayout, RadioButtonStateHandle,
|
||||
};
|
||||
use galaxyui::ui_components::slider::SliderStateHandle;
|
||||
use galaxyui::ui_components::switch::SwitchStateHandle;
|
||||
use galaxyui::units::IntoPixels;
|
||||
use std::borrow::Cow;
|
||||
use std::cell::RefCell;
|
||||
use std::collections::HashMap;
|
||||
use std::path::PathBuf;
|
||||
use std::rc::Rc;
|
||||
|
||||
use galaxyui::id;
|
||||
use galaxyui::{
|
||||
elements::{
|
||||
Align, Border, ChildView, ConstrainedBox, Container, CornerRadius, CrossAxisAlignment,
|
||||
Dismiss, Element, Fill, Flex, Hoverable, MouseStateHandle, ParentElement, Radius,
|
||||
Shrinkable, DEFAULT_UI_LINE_HEIGHT_RATIO,
|
||||
},
|
||||
rendering::ThinStrokes,
|
||||
};
|
||||
use galaxyui::{platform::SystemTheme, Action};
|
||||
use galaxyui::{
|
||||
AppContext, Entity, ModelHandle, SingletonEntity, TypedActionView, UpdateModel, View,
|
||||
ViewContext, ViewHandle, WindowId,
|
||||
};
|
||||
|
||||
use crate::settings::UseThinStrokes;
|
||||
use crate::ui_components::color_dot::{render_color_dot, TAB_COLOR_OPTIONS};
|
||||
use crate::ui_components::icons::Icon;
|
||||
use crate::view_components::action_button::{ActionButton, ButtonSize, NakedTheme};
|
||||
use crate::{report_error, report_if_error, send_telemetry_from_ctx, themes};
|
||||
|
||||
const FONT_SIZE_INPUT_BOX_WIDTH: f32 = 80.;
|
||||
const NOTEBOOK_FONT_SIZE_INPUT_BOX_WIDTH: f32 = 50.;
|
||||
@@ -270,6 +256,50 @@ pub fn init_actions_from_parent_view<T: Action + Clone>(
|
||||
context.to_owned(),
|
||||
)
|
||||
.with_group(bindings::BindingGroup::Settings.as_str())]);
|
||||
toggle_binding_pairs.push(ToggleSettingActionPair::new(
|
||||
"open new windows with custom size",
|
||||
builder(SettingsAction::AppearancePageToggle(
|
||||
AppearancePageAction::ToggleOpenWindowsAtCustomSize,
|
||||
)),
|
||||
context,
|
||||
flags::OPEN_WINDOWS_AT_CUSTOM_SIZE_FLAG,
|
||||
));
|
||||
|
||||
toggle_binding_pairs.push(ToggleSettingActionPair::new(
|
||||
"window blur acrylic texture",
|
||||
builder(SettingsAction::AppearancePageToggle(
|
||||
AppearancePageAction::ToggleBlurTexture,
|
||||
)),
|
||||
context,
|
||||
flags::WINDOW_BLUR_TEXTURE_FLAG,
|
||||
));
|
||||
|
||||
toggle_binding_pairs.push(ToggleSettingActionPair::new(
|
||||
"tools panel visibility across tabs",
|
||||
builder(SettingsAction::AppearancePageToggle(
|
||||
AppearancePageAction::ToggleLeftPanelVisibility,
|
||||
)),
|
||||
context,
|
||||
flags::LEFT_PANEL_VISIBILITY_ACROSS_TABS_FLAG,
|
||||
));
|
||||
|
||||
toggle_binding_pairs.push(ToggleSettingActionPair::new(
|
||||
"agent font matching terminal font",
|
||||
builder(SettingsAction::AppearancePageToggle(
|
||||
AppearancePageAction::ToggleMatchAIToTerminalFontFamily,
|
||||
)),
|
||||
context,
|
||||
flags::MATCH_AI_FONT_TO_TERMINAL_FONT_FLAG,
|
||||
));
|
||||
|
||||
toggle_binding_pairs.push(ToggleSettingActionPair::new(
|
||||
"notebook font size matching terminal font size",
|
||||
builder(SettingsAction::AppearancePageToggle(
|
||||
AppearancePageAction::ToggleMatchNotebookToMonospaceFontSize,
|
||||
)),
|
||||
context,
|
||||
flags::MATCH_NOTEBOOK_FONT_SIZE_TO_TERMINAL_FONT_SIZE_FLAG,
|
||||
));
|
||||
|
||||
toggle_binding_pairs.push(
|
||||
ToggleSettingActionPair::new(
|
||||
@@ -389,6 +419,22 @@ pub fn init_actions_from_parent_view<T: Action + Clone>(
|
||||
context,
|
||||
flags::USE_VERTICAL_TABS_FLAG,
|
||||
));
|
||||
toggle_binding_pairs.push(ToggleSettingActionPair::new(
|
||||
"show vertical tabs panel in restored windows",
|
||||
builder(SettingsAction::AppearancePageToggle(
|
||||
AppearancePageAction::ToggleShowVerticalTabPanelInRestoredWindows,
|
||||
)),
|
||||
context,
|
||||
flags::SHOW_VERTICAL_TAB_PANEL_IN_RESTORED_WINDOWS_FLAG,
|
||||
));
|
||||
toggle_binding_pairs.push(ToggleSettingActionPair::new(
|
||||
"latest user prompt as conversation title in tab names",
|
||||
builder(SettingsAction::AppearancePageToggle(
|
||||
AppearancePageAction::ToggleUseLatestUserPromptAsConversationTitleInTabNames,
|
||||
)),
|
||||
context,
|
||||
flags::USE_LATEST_USER_PROMPT_AS_CONVERSATION_TITLE_IN_TAB_NAMES_FLAG,
|
||||
));
|
||||
}
|
||||
|
||||
if FeatureFlag::Ligatures.is_enabled() {
|
||||
@@ -402,6 +448,24 @@ pub fn init_actions_from_parent_view<T: Action + Clone>(
|
||||
));
|
||||
}
|
||||
|
||||
toggle_binding_pairs.push(ToggleSettingActionPair::new(
|
||||
"preserve active tab color for new tabs",
|
||||
builder(SettingsAction::AppearancePageToggle(
|
||||
AppearancePageAction::TogglePreserveActiveTabColor,
|
||||
)),
|
||||
context,
|
||||
flags::PRESERVE_ACTIVE_TAB_COLOR_FLAG,
|
||||
));
|
||||
|
||||
toggle_binding_pairs.push(ToggleSettingActionPair::new(
|
||||
"custom padding in alt-screen",
|
||||
builder(SettingsAction::AppearancePageToggle(
|
||||
AppearancePageAction::ToggleAltScreenPadding,
|
||||
)),
|
||||
context,
|
||||
flags::ALT_SCREEN_PADDING_FLAG,
|
||||
));
|
||||
|
||||
ToggleSettingActionPair::add_toggle_setting_action_pairs_as_bindings(toggle_binding_pairs, app);
|
||||
}
|
||||
|
||||
@@ -445,6 +509,7 @@ pub enum AppearancePageAction {
|
||||
},
|
||||
SetInputType(InputBoxType),
|
||||
SetAppIcon(AppIcon),
|
||||
ToggleShowDockIcon,
|
||||
SetCursorType(CursorDisplayType),
|
||||
SetWorkspaceDecorationVisibility(WorkspaceDecorationVisibility),
|
||||
ToggleWorkspaceDecorationVisibility,
|
||||
@@ -462,6 +527,8 @@ pub enum AppearancePageAction {
|
||||
ToggleShowCodeReviewButton,
|
||||
TogglePreserveActiveTabColor,
|
||||
ToggleVerticalTabs,
|
||||
ToggleShowVerticalTabPanelInRestoredWindows,
|
||||
ToggleHideTitleBarSearchBarInVerticalTabs,
|
||||
ToggleUseLatestUserPromptAsConversationTitleInTabNames,
|
||||
ToggleLigatureRendering,
|
||||
ToggleBlurTexture,
|
||||
@@ -470,6 +537,7 @@ pub enum AppearancePageAction {
|
||||
OpenUrl(String),
|
||||
ToggleFocusPaneOnHover,
|
||||
ToggleInputMode,
|
||||
ToggleAltScreenPadding,
|
||||
UpdateAltScreenPaddingMode(AltScreenPaddingMode),
|
||||
SetTabCloseButtonPosition(TabCloseButtonPosition),
|
||||
SetZoomLevel(u16),
|
||||
@@ -592,6 +660,7 @@ impl TypedActionView for AppearanceSettingsPageView {
|
||||
} => self.set_input_mode(*new_mode, *from_binding, ctx),
|
||||
SetInputType(input_type) => self.set_input_type(*input_type, ctx),
|
||||
SetAppIcon(new_icon) => self.set_app_icon(*new_icon, ctx),
|
||||
ToggleShowDockIcon => self.toggle_show_dock_icon(ctx),
|
||||
SetCursorType(cursor_display_type) => self.set_cursor_type(*cursor_display_type, ctx),
|
||||
OpacitySliderDragged(val) => self.set_opacity(*val, false, ctx),
|
||||
BlurSliderDragged(val) => self.set_blur(*val, false, ctx),
|
||||
@@ -602,6 +671,12 @@ impl TypedActionView for AppearanceSettingsPageView {
|
||||
ToggleShowCodeReviewButton => self.toggle_show_code_review_button(ctx),
|
||||
TogglePreserveActiveTabColor => self.toggle_preserve_active_tab_color(ctx),
|
||||
ToggleVerticalTabs => self.toggle_vertical_tabs(ctx),
|
||||
ToggleShowVerticalTabPanelInRestoredWindows => {
|
||||
self.toggle_show_vertical_tab_panel_in_restored_windows(ctx)
|
||||
}
|
||||
ToggleHideTitleBarSearchBarInVerticalTabs => {
|
||||
self.toggle_hide_title_bar_search_bar_in_vertical_tabs(ctx)
|
||||
}
|
||||
ToggleUseLatestUserPromptAsConversationTitleInTabNames => {
|
||||
self.toggle_use_latest_user_prompt_as_conversation_title_in_tab_names(ctx)
|
||||
}
|
||||
@@ -628,6 +703,19 @@ impl TypedActionView for AppearanceSettingsPageView {
|
||||
ToggleInputMode => {
|
||||
self.toggle_input_mode(ctx);
|
||||
}
|
||||
ToggleAltScreenPadding => {
|
||||
let new_mode = TerminalSettings::as_ref(ctx).alt_screen_padding.toggled();
|
||||
TerminalSettings::handle(ctx).update(ctx, |terminal_settings, ctx| {
|
||||
report_if_error!(terminal_settings
|
||||
.alt_screen_padding
|
||||
.set_value(new_mode, ctx));
|
||||
});
|
||||
self.set_alt_screen_padding_editor_text(ctx);
|
||||
send_telemetry_from_ctx!(
|
||||
TelemetryEvent::UpdateAltScreenPaddingMode { new_mode },
|
||||
ctx
|
||||
);
|
||||
}
|
||||
UpdateAltScreenPaddingMode(new_mode) => {
|
||||
TerminalSettings::handle(ctx).update(ctx, |terminal_settings, ctx| {
|
||||
report_if_error!(terminal_settings
|
||||
@@ -1402,6 +1490,12 @@ impl AppearanceSettingsPageView {
|
||||
|
||||
if FeatureFlag::VerticalTabs.is_enabled() {
|
||||
tab_settings_widgets.push(Box::new(VerticalTabsWidget::default()));
|
||||
tab_settings_widgets.push(Box::new(
|
||||
ShowVerticalTabPanelInRestoredWindowsWidget::default(),
|
||||
));
|
||||
tab_settings_widgets.push(Box::new(
|
||||
HideTitleBarSearchBarInVerticalTabsWidget::default(),
|
||||
));
|
||||
tab_settings_widgets.push(Box::new(
|
||||
UseLatestUserPromptAsConversationTitleInTabNamesWidget::default(),
|
||||
));
|
||||
@@ -1468,6 +1562,11 @@ impl AppearanceSettingsPageView {
|
||||
editor.set_buffer_text(&format!("{line_height_ratio}"), ctx);
|
||||
});
|
||||
}
|
||||
AppearanceEvent::ThemeChanged => {
|
||||
// Context-chip colors are theme-derived, so rebuild the Input
|
||||
// preview chips when the theme changes to keep them in sync.
|
||||
self.context_chips = Self::get_context_chip_renderers(ctx);
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
|
||||
@@ -1519,7 +1618,7 @@ impl AppearanceSettingsPageView {
|
||||
// If we're on a non-Linux platform, render the dropdown item in the
|
||||
// actual font. We currently don't do this on Linux because
|
||||
// pre-loading all of the fonts is too expensive.
|
||||
if cfg!(not(target_os = "linux")) {
|
||||
if cfg!(not(any(target_os = "linux", target_os = "freebsd"))) {
|
||||
if let Some(family_id) = ctx.font_cache().family_id_for_name(&font_name) {
|
||||
initial_dropdown_item = initial_dropdown_item.with_font_override(family_id);
|
||||
}
|
||||
@@ -1926,7 +2025,7 @@ impl AppearanceSettingsPageView {
|
||||
// If we're on a non-Linux platform, render the dropdown item in the
|
||||
// actual font. We currently don't do this on Linux because
|
||||
// pre-loading all of the fonts is too expensive.
|
||||
if cfg!(not(target_os = "linux")) {
|
||||
if cfg!(not(any(target_os = "linux", target_os = "freebsd"))) {
|
||||
if let Some(family_id) = family {
|
||||
dropdown = dropdown.with_font_override(*family_id)
|
||||
}
|
||||
@@ -1987,7 +2086,7 @@ impl AppearanceSettingsPageView {
|
||||
// If we're on a non-Linux platform, render the dropdown item in the
|
||||
// actual font. We currently don't do this on Linux because
|
||||
// pre-loading all of the fonts is too expensive.
|
||||
if cfg!(not(target_os = "linux")) {
|
||||
if cfg!(not(any(target_os = "linux", target_os = "freebsd"))) {
|
||||
if let Some(family_id) = family {
|
||||
dropdown = dropdown.with_font_override(*family_id)
|
||||
}
|
||||
@@ -2359,6 +2458,12 @@ impl AppearanceSettingsPageView {
|
||||
});
|
||||
}
|
||||
|
||||
fn toggle_show_dock_icon(&mut self, ctx: &mut ViewContext<Self>) {
|
||||
AppIconSettings::handle(ctx).update(ctx, |app_icon_settings, ctx| {
|
||||
report_if_error!(app_icon_settings.show_dock_icon.toggle_and_save_value(ctx));
|
||||
});
|
||||
}
|
||||
|
||||
fn set_cursor_type(&mut self, new_cursor_type: CursorDisplayType, ctx: &mut ViewContext<Self>) {
|
||||
AppEditorSettings::handle(ctx).update(ctx, |app_editor_settings, ctx| {
|
||||
report_if_error!(app_editor_settings
|
||||
@@ -2428,6 +2533,22 @@ impl AppearanceSettingsPageView {
|
||||
});
|
||||
}
|
||||
|
||||
fn toggle_show_vertical_tab_panel_in_restored_windows(&mut self, ctx: &mut ViewContext<Self>) {
|
||||
TabSettings::handle(ctx).update(ctx, |settings, ctx| {
|
||||
report_if_error!(settings
|
||||
.show_vertical_tab_panel_in_restored_windows
|
||||
.toggle_and_save_value(ctx));
|
||||
});
|
||||
}
|
||||
|
||||
fn toggle_hide_title_bar_search_bar_in_vertical_tabs(&mut self, ctx: &mut ViewContext<Self>) {
|
||||
TabSettings::handle(ctx).update(ctx, |settings, ctx| {
|
||||
report_if_error!(settings
|
||||
.hide_title_bar_search_bar_in_vertical_tabs
|
||||
.toggle_and_save_value(ctx));
|
||||
});
|
||||
}
|
||||
|
||||
fn toggle_use_latest_user_prompt_as_conversation_title_in_tab_names(
|
||||
&mut self,
|
||||
ctx: &mut ViewContext<Self>,
|
||||
@@ -2906,34 +3027,31 @@ impl SettingsWidget for ThemeSelectWidget {
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
struct CustomAppIconWidget {}
|
||||
struct CustomAppIconWidget {
|
||||
show_dock_icon_switch_state: SwitchStateHandle,
|
||||
}
|
||||
|
||||
impl SettingsWidget for CustomAppIconWidget {
|
||||
type View = AppearanceSettingsPageView;
|
||||
|
||||
fn search_terms(&self) -> &str {
|
||||
"customize custom app icon icons"
|
||||
"customize custom app icon icons dock cmd tab app switcher"
|
||||
}
|
||||
|
||||
fn render(
|
||||
&self,
|
||||
view: &Self::View,
|
||||
appearance: &Appearance,
|
||||
_app: &AppContext,
|
||||
app: &AppContext,
|
||||
) -> Box<dyn Element> {
|
||||
#[allow(unused_mut)]
|
||||
let show_bundle_warning = {
|
||||
#[cfg(target_os = "macos")]
|
||||
#[allow(deprecated)]
|
||||
{
|
||||
use cocoa::base::id;
|
||||
use objc::{class, msg_send, sel, sel_impl};
|
||||
unsafe {
|
||||
let running_app: id =
|
||||
msg_send![class!(NSRunningApplication), currentApplication];
|
||||
let bundle_id: id = msg_send![running_app, bundleIdentifier];
|
||||
bundle_id.is_null()
|
||||
}
|
||||
use objc2_app_kit::NSRunningApplication;
|
||||
NSRunningApplication::currentApplication()
|
||||
.bundleIdentifier()
|
||||
.is_none()
|
||||
}
|
||||
#[cfg(not(target_os = "macos"))]
|
||||
{
|
||||
@@ -2951,41 +3069,76 @@ impl SettingsWidget for CustomAppIconWidget {
|
||||
&view.app_icon_dropdown,
|
||||
);
|
||||
|
||||
let show_dock_icon_toggle = render_body_item::<AppearancePageAction>(
|
||||
"Show Warp in Dock".into(),
|
||||
None,
|
||||
LocalOnlyIconState::for_setting(
|
||||
ShowDockIconState::storage_key(),
|
||||
ShowDockIconState::sync_to_cloud(),
|
||||
&mut view.local_only_icon_tooltip_states.borrow_mut(),
|
||||
app,
|
||||
),
|
||||
ToggleState::Enabled,
|
||||
appearance,
|
||||
appearance
|
||||
.ui_builder()
|
||||
.switch(self.show_dock_icon_switch_state.clone())
|
||||
.check(*AppIconSettings::as_ref(app).show_dock_icon)
|
||||
.build()
|
||||
.on_click(move |ctx, _, _| {
|
||||
ctx.dispatch_typed_action(AppearancePageAction::ToggleShowDockIcon);
|
||||
})
|
||||
.finish(),
|
||||
None,
|
||||
);
|
||||
let show_dock_icon_is_supported = AppIconSettings::as_ref(app)
|
||||
.show_dock_icon
|
||||
.is_supported_on_current_platform();
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
{
|
||||
use crate::appearance::AppearanceManager;
|
||||
|
||||
let app_icon_at_startup = AppearanceManager::as_ref(_app).app_icon_at_startup();
|
||||
let current_icon = *AppIconSettings::as_ref(_app).app_icon;
|
||||
if current_icon == AppIcon::Galaxy
|
||||
let app_icon_at_startup = AppearanceManager::as_ref(app).app_icon_at_startup();
|
||||
let current_icon = *AppIconSettings::as_ref(app).app_icon;
|
||||
if current_icon == AppIcon::Default
|
||||
&& ChannelState::channel() != Channel::Local
|
||||
&& app_icon_at_startup != AppIcon::Galaxy
|
||||
{
|
||||
let theme = appearance.theme();
|
||||
return Flex::column()
|
||||
.with_child(dropdown)
|
||||
.with_child(
|
||||
appearance
|
||||
.ui_builder()
|
||||
.wrappable_text(
|
||||
"You may need to restart Galaxy for MacOS to apply the preferred icon style.",
|
||||
true,
|
||||
)
|
||||
.with_style(UiComponentStyles {
|
||||
font_color: Some(
|
||||
theme.sub_text_color(theme.background()).into_solid(),
|
||||
),
|
||||
margin: Some(Coords::default().bottom(8.)),
|
||||
..Default::default()
|
||||
})
|
||||
.build()
|
||||
.finish(),
|
||||
)
|
||||
.finish();
|
||||
let column = Flex::column().with_child(dropdown).with_child(
|
||||
appearance
|
||||
.ui_builder()
|
||||
.wrappable_text(
|
||||
"You may need to restart Warp for MacOS to apply the preferred icon style.",
|
||||
true,
|
||||
)
|
||||
.with_style(UiComponentStyles {
|
||||
font_color: Some(
|
||||
theme.sub_text_color(theme.background()).into_solid(),
|
||||
),
|
||||
margin: Some(Coords::default().bottom(8.)),
|
||||
..Default::default()
|
||||
})
|
||||
.build()
|
||||
.finish(),
|
||||
);
|
||||
let column = if show_dock_icon_is_supported {
|
||||
column.with_child(show_dock_icon_toggle)
|
||||
} else {
|
||||
column
|
||||
};
|
||||
return column.finish();
|
||||
}
|
||||
}
|
||||
|
||||
dropdown
|
||||
let column = Flex::column().with_child(dropdown);
|
||||
let column = if show_dock_icon_is_supported {
|
||||
column.with_child(show_dock_icon_toggle)
|
||||
} else {
|
||||
column
|
||||
};
|
||||
column.finish()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4803,6 +4956,106 @@ impl SettingsWidget for VerticalTabsWidget {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
struct ShowVerticalTabPanelInRestoredWindowsWidget {
|
||||
switch_state: SwitchStateHandle,
|
||||
}
|
||||
|
||||
impl SettingsWidget for ShowVerticalTabPanelInRestoredWindowsWidget {
|
||||
type View = AppearanceSettingsPageView;
|
||||
|
||||
fn search_terms(&self) -> &str {
|
||||
"vertical tabs panel restore window session snapshot"
|
||||
}
|
||||
|
||||
fn render(
|
||||
&self,
|
||||
view: &Self::View,
|
||||
appearance: &Appearance,
|
||||
app: &AppContext,
|
||||
) -> Box<dyn Element> {
|
||||
let tab_settings = TabSettings::as_ref(app);
|
||||
|
||||
render_body_item::<AppearancePageAction>(
|
||||
"Show vertical tabs panel in restored windows".into(),
|
||||
None,
|
||||
LocalOnlyIconState::for_setting(
|
||||
ShowVerticalTabPanelInRestoredWindows::storage_key(),
|
||||
ShowVerticalTabPanelInRestoredWindows::sync_to_cloud(),
|
||||
&mut view.local_only_icon_tooltip_states.borrow_mut(),
|
||||
app,
|
||||
),
|
||||
ToggleState::Enabled,
|
||||
appearance,
|
||||
appearance
|
||||
.ui_builder()
|
||||
.switch(self.switch_state.clone())
|
||||
.check(*tab_settings.show_vertical_tab_panel_in_restored_windows)
|
||||
.build()
|
||||
.on_click(move |ctx, _, _| {
|
||||
ctx.dispatch_typed_action(
|
||||
AppearancePageAction::ToggleShowVerticalTabPanelInRestoredWindows,
|
||||
);
|
||||
})
|
||||
.finish(),
|
||||
Some(
|
||||
"When enabled, reopening or restoring a window opens the vertical tabs panel even if it was closed when the window was last saved."
|
||||
.to_string(),
|
||||
),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
struct HideTitleBarSearchBarInVerticalTabsWidget {
|
||||
switch_state: SwitchStateHandle,
|
||||
}
|
||||
|
||||
impl SettingsWidget for HideTitleBarSearchBarInVerticalTabsWidget {
|
||||
type View = AppearanceSettingsPageView;
|
||||
|
||||
fn search_terms(&self) -> &str {
|
||||
"hide title bar search bar vertical tabs chrome minimal"
|
||||
}
|
||||
|
||||
fn render(
|
||||
&self,
|
||||
view: &Self::View,
|
||||
appearance: &Appearance,
|
||||
app: &AppContext,
|
||||
) -> Box<dyn Element> {
|
||||
let tab_settings = TabSettings::as_ref(app);
|
||||
|
||||
render_body_item::<AppearancePageAction>(
|
||||
"Hide search bar in vertical tab layout".into(),
|
||||
None,
|
||||
LocalOnlyIconState::for_setting(
|
||||
HideTitleBarSearchBarInVerticalTabs::storage_key(),
|
||||
HideTitleBarSearchBarInVerticalTabs::sync_to_cloud(),
|
||||
&mut view.local_only_icon_tooltip_states.borrow_mut(),
|
||||
app,
|
||||
),
|
||||
ToggleState::Enabled,
|
||||
appearance,
|
||||
appearance
|
||||
.ui_builder()
|
||||
.switch(self.switch_state.clone())
|
||||
.check(*tab_settings.hide_title_bar_search_bar_in_vertical_tabs)
|
||||
.build()
|
||||
.on_click(move |ctx, _, _| {
|
||||
ctx.dispatch_typed_action(
|
||||
AppearancePageAction::ToggleHideTitleBarSearchBarInVerticalTabs,
|
||||
);
|
||||
})
|
||||
.finish(),
|
||||
Some(
|
||||
"When using the vertical tab layout, hide the search bar in the title bar. Search stays available via the command palette and keyboard shortcuts."
|
||||
.to_string(),
|
||||
),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
struct UseLatestUserPromptAsConversationTitleInTabNamesWidget {
|
||||
switch_state: SwitchStateHandle,
|
||||
@@ -4918,8 +5171,7 @@ fn build_directory_delete_buttons(
|
||||
fn add_directory_tab_color_path(path: PathBuf, ctx: &mut ViewContext<AppearanceSettingsPageView>) {
|
||||
TabSettings::handle(ctx).update(ctx, |settings, ctx| {
|
||||
let current = settings.directory_tab_colors.value();
|
||||
let canonical = path.canonicalize().unwrap_or_else(|_| path.clone());
|
||||
let key = canonical.to_string_lossy().to_string();
|
||||
let key = canonical_directory_key(&path);
|
||||
let dominated_by_existing = current
|
||||
.0
|
||||
.get(&key)
|
||||
|
||||
Reference in New Issue
Block a user