diff --git a/apps/onelauncher/desktop/src/api/commands.rs b/apps/onelauncher/desktop/src/api/commands.rs index 7735c9af..58d7ddb5 100644 --- a/apps/onelauncher/desktop/src/api/commands.rs +++ b/apps/onelauncher/desktop/src/api/commands.rs @@ -6,6 +6,8 @@ pub trait OneLauncherApi { async fn return_error() -> LauncherResult<()>; async fn open_dev_tools(webview_window: tauri::WebviewWindow); + + async fn set_window_style(webview_window: tauri::WebviewWindow, decorations: bool); } #[taurpc::ipc_type] @@ -24,4 +26,7 @@ impl OneLauncherApi for OneLauncherApiImpl { webview_window.open_devtools(); } + async fn set_window_style(self, webview_window: tauri::WebviewWindow, decorations: bool) { + webview_window.set_decorations(decorations).ok(); + } } diff --git a/apps/onelauncher/desktop/src/lib.rs b/apps/onelauncher/desktop/src/lib.rs index 1f025afd..33b86772 100644 --- a/apps/onelauncher/desktop/src/lib.rs +++ b/apps/onelauncher/desktop/src/lib.rs @@ -116,11 +116,16 @@ fn setup_window(handle: &tauri::AppHandle) -> Result<(), Box history.back(); const minimize = () => Window.getCurrent().minimize(); @@ -27,17 +29,19 @@ function WindowFrame() { }, []); return ( -
-
- -
+ +
+
+ +
-
- - - +
+ + + +
-
+
); } diff --git a/apps/onelauncher/frontend/src/routes/app/index.tsx b/apps/onelauncher/frontend/src/routes/app/index.tsx index 2f65935d..2a8b54d7 100644 --- a/apps/onelauncher/frontend/src/routes/app/index.tsx +++ b/apps/onelauncher/frontend/src/routes/app/index.tsx @@ -11,6 +11,7 @@ import { createFileRoute, Link } from '@tanstack/react-router'; import { convertFileSrc } from '@tauri-apps/api/core'; import { PlayIcon } from '@untitled-theme/icons-react'; import { OverlayScrollbarsComponent } from 'overlayscrollbars-react'; +import { useEffect } from 'react'; export const Route = createFileRoute('/app/')({ component: RouteComponent, @@ -27,12 +28,19 @@ hey future sassan here i guess the issue is solved idk function RouteComponent() { const result = useCommand('getClusters', bindings.core.getClusters); - bindings.events.ingress.on((e) => { - if (typeof e.ingress_type === 'object') - if ('PrepareCluster' in e.ingress_type) - // eslint-disable-next-line no-console -- ok - console.log(`Preparing cluster: ${e.ingress_type.PrepareCluster.cluster_name} %${e.percent}`); - }); + useEffect(() => { + let unlisten: (() => void) | undefined; + (async () => { + unlisten = await bindings.events.ingress.on((e) => { + if (typeof e.ingress_type === 'object') + if ('PrepareCluster' in e.ingress_type) + // eslint-disable-next-line no-console -- ok + console.log(`Preparing cluster: ${e.ingress_type.PrepareCluster.cluster_name} %${e.percent}`); + }); + })(); + + return () => unlisten?.(); + }, []); return (
diff --git a/apps/onelauncher/frontend/src/routes/app/settings/appearance.tsx b/apps/onelauncher/frontend/src/routes/app/settings/appearance.tsx index 784ee6f1..c02df999 100644 --- a/apps/onelauncher/frontend/src/routes/app/settings/appearance.tsx +++ b/apps/onelauncher/frontend/src/routes/app/settings/appearance.tsx @@ -1,5 +1,7 @@ import ScrollableContainer from '@/components/ScrollableContainer'; import SettingsRow from '@/components/SettingsRow'; +import useSettings from '@/hooks/useSettings'; +import { bindings } from '@/main'; import { THEMES } from '@/utils/theming'; import { Switch } from '@onelauncher/common/components'; import { createFileRoute } from '@tanstack/react-router'; @@ -11,6 +13,15 @@ export const Route = createFileRoute('/app/settings/appearance')({ }); function RouteComponent() { + const { settings, createSetting } = useSettings(); + + const [windowFrame, setFrameStyle] = createSetting('native_window_frame', settings?.native_window_frame); + + const handleWindowFrameChange = async (value: boolean) => { + await bindings.onelauncher.set_window_style(value); + setFrameStyle(value); + }; + return ( @@ -56,7 +67,7 @@ function RouteComponent() { icon={} title="Custom Window Frame" > - +