diff --git a/src/components/client-windows.tsx b/src/components/client-windows.tsx
index b51c226..a2d8ad5 100644
--- a/src/components/client-windows.tsx
+++ b/src/components/client-windows.tsx
@@ -8,12 +8,16 @@ import React, { useState, useRef, useEffect, useReducer } from "react";
export const RestoreWindowsButton = ({ onClick, className, ...props}: React.ComponentProps<"button">) => {
const windowManager = useWindowManager();
- const isAnyWindowsClosed = !windowManager.windows.find(w => w.closed == true);
+ const isWindowsDataDirty = !windowManager.windows.find(w =>
+ w.closed == true
+ || w.minimized == true
+ || (w.offset.x != 0 && w.offset.y != 0)
+ )
return (
)
diff --git a/src/hooks/window-manager.tsx b/src/hooks/window-manager.tsx
index c60f549..e2982db 100644
--- a/src/hooks/window-manager.tsx
+++ b/src/hooks/window-manager.tsx
@@ -22,7 +22,7 @@ interface WindowManagerContextType {
close: (name: string) => void;
remove: (name: string) => void;
move: (name: string, offset: { x: number; y: number }) => void;
- openAll: () => void;
+ resetAll: () => void;
}
const WindowManagerContext = createContext(undefined);
@@ -64,15 +64,20 @@ export const WindowManagerProvider: React.FC<{ children: React.ReactNode }> = ({
const remove = (name: string) => setWindows(w => w.filter(win => win.name !== name));
- const openAll = () => setWindows(w =>
- w.map(win => ({ ...win, closed: false }))
+ const resetAll = () => setWindows(w =>
+ w.map(win => ({
+ name: win.name,
+ closed: false,
+ minimized: false,
+ offset: { x: 0, y: 0 }
+ }))
);
return (
{children}