use par_term_config::{Config, Profile, ProfileId};
pub type ShaderDetectModifiedFn = fn() -> Result<Vec<String>, String>;
mod traits;
pub use traits::*;
pub mod arrangements;
pub use arrangements::{
ArrangementId, ArrangementManager, MonitorInfo, TabSnapshot, WindowArrangement, WindowSnapshot,
};
pub mod shell_detection;
pub mod profile_modal_ui;
pub use profile_modal_ui::{ProfileModalAction, ProfileModalUI};
pub mod nerd_font;
pub mod actions_tab;
pub mod advanced_tab;
pub mod ai_inspector_tab;
pub mod appearance_tab;
pub mod automation_tab;
pub mod effects_tab;
pub mod input_tab;
pub mod integrations_tab;
pub mod notifications_tab;
pub mod prettifier_tab;
pub mod profiles_tab;
pub mod quick_settings;
pub mod scripts_tab;
pub mod search_keywords;
pub mod section;
pub mod sidebar;
pub mod snippets_tab;
pub mod ssh_tab;
pub mod status_bar_tab;
pub mod terminal_tab;
pub mod window_tab;
mod arrangements_tab;
mod badge_tab;
mod progress_bar_tab;
pub mod background_tab;
mod cursor_shader_editor;
mod shader_dialogs;
mod shader_editor;
mod shader_utils;
mod settings_ui;
pub use settings_ui::SettingsUI;
pub use sidebar::SettingsTab;
pub use par_term_config::{
self as config, BackgroundImageMode as BgMode, CursorShaderMetadataCache as CursorShaderCache,
ProfileManager, ProfileSource, ShaderMetadataCache as ShaderCache, Theme, VsyncMode,
};
#[derive(Debug, Clone)]
pub struct ShaderEditorResult {
pub source: String,
}
#[derive(Debug, Clone)]
pub struct CursorShaderEditorResult {
pub source: String,
}
#[derive(Debug, Clone)]
pub enum SettingsWindowAction {
None,
Close,
ApplyConfig(Config),
SaveConfig(Config),
ApplyShader(ShaderEditorResult),
ApplyCursorShader(CursorShaderEditorResult),
TestNotification,
SaveProfiles(Vec<Profile>),
OpenProfile(ProfileId),
StartCoprocess(usize),
StopCoprocess(usize),
StartScript(usize),
StopScript(usize),
OpenLogFile,
SaveArrangement(String),
RestoreArrangement(ArrangementId),
DeleteArrangement(ArrangementId),
RenameArrangement(ArrangementId, String),
MoveArrangementUp(ArrangementId),
MoveArrangementDown(ArrangementId),
ReplaceArrangement(ArrangementId),
ForceUpdateCheck,
InstallUpdate(String),
IdentifyPanes,
InstallShellIntegration,
UninstallShellIntegration,
}
#[derive(Debug, Clone)]
pub struct ArrangementInfo {
pub id: ArrangementId,
pub name: String,
pub window_count: usize,
}
#[derive(Debug, Clone)]
pub struct ShaderInstallResult {
pub installed: usize,
pub skipped: usize,
pub removed: usize,
}
#[derive(Debug, Clone)]
pub struct ShaderUninstallResult {
pub removed: usize,
pub kept: usize,
pub needs_confirmation: bool,
}
#[derive(Debug, Clone)]
pub struct ShellIntegrationInstallResult {
pub shell: String,
pub script_path: String,
pub rc_file: String,
pub needs_restart: bool,
}
#[derive(Debug, Clone)]
pub struct ShellIntegrationUninstallResult {
pub cleaned: bool,
pub needs_manual: bool,
pub scripts_removed: usize,
}
#[derive(Debug, Clone)]
pub struct UpdateResult {
pub old_version: String,
pub new_version: String,
pub install_path: String,
pub needs_restart: bool,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum InstallationType {
Homebrew,
CargoInstall,
MacOSBundle,
StandaloneBinary,
}
#[derive(Debug, Clone)]
pub enum UpdateCheckResult {
UpToDate,
UpdateAvailable(UpdateCheckInfo),
Disabled,
Skipped,
Error(String),
}
#[derive(Debug, Clone)]
pub struct UpdateCheckInfo {
pub version: String,
pub release_notes: Option<String>,
pub release_url: String,
pub published_at: Option<String>,
}
pub fn format_timestamp(timestamp: &str) -> String {
match chrono::DateTime::parse_from_rfc3339(timestamp) {
Ok(dt) => dt.format("%Y-%m-%d %H:%M").to_string(),
Err(_) => timestamp.to_string(),
}
}
pub fn log_path() -> std::path::PathBuf {
#[cfg(unix)]
{
std::path::PathBuf::from("/tmp/par_term_debug.log")
}
#[cfg(windows)]
{
std::env::temp_dir().join("par_term_debug.log")
}
}
pub fn http_agent() -> ureq::Agent {
ureq::Agent::new_with_defaults()
}