mirror of
https://gitlab.com/ArkHost/HelixNotes.git
synced 2026-11-21 19:04:56 +01:00
Add desktop toolbar customization and fix pane toggle icons
This commit is contained in:
1 parent
4157beddf7
commit
806c63aa65
10 files changed
+1415
-542
No files matched your search
@@ -540,6 +540,24 @@ pub fn set_scroll_to_change_font_size(
|
||||
.map_err(|e| e.to_string())
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub fn set_toolbar_layout(
|
||||
app: AppHandle,
|
||||
state: State<'_, AppState>,
|
||||
layout: Option<ToolbarLayout>,
|
||||
) -> Result<(), String> {
|
||||
let mut config = state.config.lock().map_err(|e| e.to_string())?;
|
||||
let previous = std::mem::replace(&mut config.toolbar_layout, layout);
|
||||
if let Err(error) = save_app_config(&config) {
|
||||
config.toolbar_layout = previous;
|
||||
return Err(error);
|
||||
}
|
||||
|
||||
use tauri::Emitter;
|
||||
app.emit("toolbar-layout-changed", &config.toolbar_layout)
|
||||
.map_err(|error| error.to_string())
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub fn set_font_family(state: State<'_, AppState>, family: String) -> Result<(), String> {
|
||||
let mut config = state.config.lock().map_err(|e| e.to_string())?;
|
||||
|
||||
@@ -173,6 +173,7 @@ pub fn run() {
|
||||
commands::import_custom_themes,
|
||||
commands::set_font_size,
|
||||
commands::set_scroll_to_change_font_size,
|
||||
commands::set_toolbar_layout,
|
||||
commands::set_font_family,
|
||||
commands::set_line_height,
|
||||
commands::set_ui_scale,
|
||||
|
||||
@@ -138,6 +138,12 @@ pub enum StartupView {
|
||||
All,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct ToolbarLayout {
|
||||
pub main: Vec<String>,
|
||||
pub more: Vec<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct AppConfig {
|
||||
pub vaults: Vec<VaultConfig>,
|
||||
@@ -158,6 +164,8 @@ pub struct AppConfig {
|
||||
#[serde(default = "default_true")]
|
||||
pub scroll_to_change_font_size: bool,
|
||||
#[serde(default)]
|
||||
pub toolbar_layout: Option<ToolbarLayout>,
|
||||
#[serde(default)]
|
||||
pub font_family: Option<String>,
|
||||
#[serde(default)]
|
||||
pub line_height: Option<f64>,
|
||||
@@ -330,6 +338,7 @@ impl Default for AppConfig {
|
||||
accent_color: None,
|
||||
font_size: None,
|
||||
scroll_to_change_font_size: true,
|
||||
toolbar_layout: None,
|
||||
font_family: None,
|
||||
line_height: None,
|
||||
ui_scale: None,
|
||||
|
||||
Reference in new issue
Block a user