Skip to content

Commit

Permalink
🐛 Fix profile's UUID when default configuration is used
Browse files Browse the repository at this point in the history
  • Loading branch information
SquitchYT committed Jun 2, 2023
1 parent 6583deb commit ab63f48
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
12 changes: 8 additions & 4 deletions src-tauri/src/configuration/deserialized.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ use crate::configuration::partial::PartialOption;

use crate::common::utils::parse_theme;



#[derive(Debug, Serialize, Clone)]
#[serde(rename_all = "camelCase")]
pub struct Option {
Expand All @@ -28,18 +30,20 @@ pub struct Option {

impl Default for Option {
fn default() -> Self {
let uuid = uuid::Uuid::new_v4().to_string();

Self {
app_theme: String::default(),
terminal_theme: TerminalTheme::default(),
background: BackgroundType::default(),
custom_titlebar: true, // TODO: Set false on linux
profiles: vec![default_profile()],
profiles: vec![default_profile(uuid.clone())],
terminal: TerminalOption::default(),
close_confirmation: true,
background_transparency: RangedInt::default(),
shortcuts: default_shortcuts(),
macros: Vec::default(),
default_profile: default_profile(),
default_profile: default_profile(uuid),

theme: String::default()
}
Expand Down Expand Up @@ -469,8 +473,8 @@ fn default_to_true() -> bool {
true
}

fn default_profile() -> Profile {
Profile { name: String::from("Default profile"), terminal_options: TerminalOption::default(), theme: TerminalTheme::default(), background_transparency: RangedInt::default(), uuid: uuid::Uuid::new_v4().to_string(), command: String::from("sh -c $SHELL") /* TODO: Set correct for each oses*/ }
fn default_profile(uuid: String) -> Profile {
Profile { name: String::from("Default profile"), terminal_options: TerminalOption::default(), theme: TerminalTheme::default(), background_transparency: RangedInt::default(), uuid, command: String::from("sh -c $SHELL") /* TODO: Set correct for each oses*/ }
}

fn default_shortcuts() -> Vec<Shortcut> {
Expand Down
4 changes: 0 additions & 4 deletions src-tauri/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ use std::sync::{Arc, Mutex};

fn main() {
let start = std::time::Instant::now();

let logger = Arc::from(Logger {});

let config_file = std::fs::read_to_string(format!(
Expand All @@ -22,9 +21,6 @@ fn main() {
));





let option = Arc::from(Mutex::from(if let Ok(config_file) = config_file {
// TODO: Log error
serde_json::from_str(&config_file).unwrap_or_default()
Expand Down

0 comments on commit ab63f48

Please sign in to comment.