diff --git a/src-tauri/src/wallpaper.rs b/src-tauri/src/wallpaper.rs index c2066e3..204c6bd 100644 --- a/src-tauri/src/wallpaper.rs +++ b/src-tauri/src/wallpaper.rs @@ -11,11 +11,13 @@ enum ImageType { /// function to interface with the tauri api on the javascript side #[tauri::command] pub fn process_wallpaper_image(file_path_string: String) -> Result { + println!("{file_path_string}"); + // convert the string to a path let file_path = std::path::Path::new(&file_path_string); // determine the image type and get the file extension - let file_extension = match determine_image_type(file_path) { + match determine_image_type(file_path) { Ok(image_type) => match image_type { ImageType::Jpeg => "jpeg".to_string(), ImageType::Png => "png".to_string(), @@ -33,7 +35,7 @@ pub fn process_wallpaper_image(file_path_string: String) -> Result { const [imageUrl, setImageUrl] = useState(null); - const setBackground = async () => { - const assetUrl = convertFileSrc("/home/vomitblood/.local/share/stort/wallpaper.jpeg"); + const setBackground = async (filePath: string) => { + const assetUrl = convertFileSrc(filePath); setImageUrl(assetUrl); }; - // useEffect(() => { - // if (settings.background.background_image_path) { - // setBackground(settings.background.background_image_path); - // } - // }, [settings.background.background_image_path]); + useEffect(() => { + setBackground(settings.background.background_image_path); + }, [settings.background.background_image_path]); return ( { ); }; diff --git a/src/components/HeaderBar/Settings/SettingsTabs/SettingsTabStyle.tsx b/src/components/HeaderBar/Settings/SettingsTabs/SettingsTabStyle.tsx index 913cbdf..460acce 100644 --- a/src/components/HeaderBar/Settings/SettingsTabs/SettingsTabStyle.tsx +++ b/src/components/HeaderBar/Settings/SettingsTabs/SettingsTabStyle.tsx @@ -24,6 +24,8 @@ export const SettingsTabStyle: FC = ({ sx }) => { }, }; setStagedSettings(newSettings); + + return newSettings; }; return ( diff --git a/src/components/HeaderBar/Settings/SettingsTabs/SettingsTabWindow.tsx b/src/components/HeaderBar/Settings/SettingsTabs/SettingsTabWindow.tsx index 41b5dfe..71e8ce9 100644 --- a/src/components/HeaderBar/Settings/SettingsTabs/SettingsTabWindow.tsx +++ b/src/components/HeaderBar/Settings/SettingsTabs/SettingsTabWindow.tsx @@ -22,6 +22,8 @@ export const SettingsTabWindow: FC = ({ sx }) => { }, }; setStagedSettings(newSettings); + + return newSettings; }; return ( diff --git a/src/lib/settings.ts b/src/lib/settings.ts index b0f25ce..1467244 100644 --- a/src/lib/settings.ts +++ b/src/lib/settings.ts @@ -30,7 +30,7 @@ export const readConfigFile = async (): Promise => { try { const { appConfigDir } = await import("@tauri-apps/api/path"); - const data = await readTomlFile(appConfigDir() + "/config.toml"); + const data = await readTomlFile((await appConfigDir()) + "/config.toml"); if (data) { existingData = data; console.log("existing data"); @@ -51,6 +51,6 @@ export const readConfigFile = async (): Promise => { export const writeConfigFile = async (settingsValues: SettingsType): Promise => { const { appConfigDir } = await import("@tauri-apps/api/path"); - await writeTomlFile(appConfigDir() + "/config.toml", settingsValues); + await writeTomlFile((await appConfigDir()) + "/config.toml", settingsValues); console.debug("Settings file written successfully."); }; diff --git a/src/pages/testing.tsx b/src/pages/testing.tsx index a461984..a855d56 100644 --- a/src/pages/testing.tsx +++ b/src/pages/testing.tsx @@ -1,12 +1,9 @@ import { BugReport } from "@mui/icons-material"; import { Box, IconButton, TextField, Typography } from "@mui/material"; -import { appDataDir } from "@tauri-apps/api/path"; -import { invoke } from "@tauri-apps/api/tauri"; import { useRouter } from "next/router"; import { useState } from "react"; import { SettingsItem } from "../components/HeaderBar/Settings/SettingsItem"; import { useSettings } from "../contexts/SettingsContext"; -import { testing } from "../lib/testing"; export default function Testing() { // contexts @@ -43,34 +40,12 @@ export default function Testing() { - - {text}