Add pane resizing
This commit is contained in:
@@ -72,6 +72,14 @@ pub fn get_last_project() -> Result<Option<String>, String> {
|
||||
.map(|p| p.to_string_lossy().into_owned()))
|
||||
}
|
||||
|
||||
/// Return the user's layout configuration from the global config.
|
||||
#[tauri::command]
|
||||
pub fn get_layout_config() -> Result<crate::config::LayoutConfig, String> {
|
||||
GlobalConfig::load()
|
||||
.map(|c| c.layout)
|
||||
.map_err(|e| e.to_string())
|
||||
}
|
||||
|
||||
/// Return the user's keybinding overrides from the global config.
|
||||
///
|
||||
/// Map keys are action names in snake_case (e.g. `"tab_next"`); values are
|
||||
|
||||
@@ -53,12 +53,24 @@ pub struct AppearanceOverride {
|
||||
pub font_size: Option<u32>,
|
||||
}
|
||||
|
||||
/// Pane layout proportions (fractions of the window width, 0..1).
|
||||
/// Pane layout proportions and constraints.
|
||||
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
|
||||
#[serde(default)]
|
||||
pub struct LayoutConfig {
|
||||
/// Initial fraction of the window width for the left pane (0..1).
|
||||
pub left_pane_fraction: f32,
|
||||
/// Initial fraction of the window width for the right pane (0..1).
|
||||
pub right_pane_fraction: f32,
|
||||
/// Minimum width of the left pane in pixels.
|
||||
pub left_pane_min: i32,
|
||||
/// Maximum width of the left pane in pixels.
|
||||
pub left_pane_max: i32,
|
||||
/// Minimum width of the right pane in pixels.
|
||||
pub right_pane_min: i32,
|
||||
/// Maximum width of the right pane in pixels.
|
||||
pub right_pane_max: i32,
|
||||
/// Minimum width of the center pane in pixels.
|
||||
pub center_pane_min: i32,
|
||||
}
|
||||
|
||||
impl Default for LayoutConfig {
|
||||
@@ -66,6 +78,11 @@ impl Default for LayoutConfig {
|
||||
Self {
|
||||
left_pane_fraction: 0.20,
|
||||
right_pane_fraction: 0.35,
|
||||
left_pane_min: 120,
|
||||
left_pane_max: 600,
|
||||
right_pane_min: 150,
|
||||
right_pane_max: 600,
|
||||
center_pane_min: 200,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ pub fn run() {
|
||||
commands::config::get_theme,
|
||||
commands::config::set_theme,
|
||||
commands::config::get_keybindings,
|
||||
commands::config::get_layout_config,
|
||||
commands::config::get_last_project,
|
||||
// repository
|
||||
commands::repository::create_repository,
|
||||
|
||||
Reference in New Issue
Block a user