fn load_from_file() -> Result<Config> {
    tracing::debug!("Loading config file");

    let path = BaseDirectories::with_prefix("leftwm")?;

    // the checks and fallback for `toml` can be removed when toml gets eventually deprecated
    let config_file_ron = path.place_config_file("config.ron")?;
    let config_file_toml = path.place_config_file("config.toml")?;

    if Path::new(&config_file_ron).exists() {
        tracing::debug!("Config file '{}' found.", config_file_ron.to_string_lossy());
        let ron = Options::default()
            .with_default_extension(Extensions::IMPLICIT_SOME | Extensions::UNWRAP_NEWTYPES);
        let contents = fs::read_to_string(config_file_ron)?;
        let config: Config = ron.from_str(&contents)?;
        Ok(config)
    } else if Path::new(&config_file_toml).exists() {
        tracing::debug!(
            "Config file '{}' found.",
            config_file_toml.to_string_lossy()
        );
        let contents = fs::read_to_string(config_file_toml)?;
        let config = toml::from_str(&contents)?;
        tracing::info!("You are using TOML as config language which will be deprecated in the future.\nPlease consider migrating you config to RON. For further info visit the leftwm wiki.");
        Ok(config)
    } else {
        tracing::debug!("Config file not found. Using default config file.");

        let config = Config::default();
        let ron_pretty_conf = PrettyConfig::new()
            .depth_limit(2)
            .extensions(Extensions::IMPLICIT_SOME | Extensions::UNWRAP_NEWTYPES);
        let ron = to_string_pretty(&config, ron_pretty_conf).unwrap();
        let comment_header = String::from(
            r"//  _        ___                                      ___ _
// | |      / __)_                                   / __|_)
// | | ____| |__| |_ _ _ _ ____      ____ ___  ____ | |__ _  ____    ____ ___  ____
// | |/ _  )  __)  _) | | |    \    / ___) _ \|  _ \|  __) |/ _  |  / ___) _ \|  _ \
// | ( (/ /| |  | |_| | | | | | |  ( (__| |_| | | | | |  | ( ( | |_| |  | |_| | | | |
// |_|\____)_|   \___)____|_|_|_|   \____)___/|_| |_|_|  |_|\_|| (_)_|   \___/|_| |_|
// A WindowManager for Adventurers                         (____/
// For info about configuration please visit https://github.com/leftwm/leftwm/wiki

",
        );
        let ron_with_header = comment_header + &ron;

        let mut file = File::create(&config_file_ron)?;
        file.write_all(ron_with_header.as_bytes())?;

        Ok(config)
    }
}
# Panics

Function can only panic if config.ron file cannot be serialized. This should not occur as it is defined
globally.

# Errors

Function will throw an error if `BaseDirectories` doesn't exist, if user doesn't have
permissions to place config.ron, if config.ron cannot be read (access writes, malformed file,
etc.).
Function can also error from inability to save config.ron (if it is the first time running
`LeftWM`).
leftwm/src/config.rs