securityos/components/system/Window/useNextFocusable.ts

16 lines
434 B
TypeScript
Raw Normal View History

2024-09-06 15:32:35 +00:00
import { useProcesses } from "contexts/process";
import { useSession } from "contexts/session";
const useNextFocusable = (id: string): string => {
const { stackOrder = [] } = useSession();
const { processes } = useProcesses();
const nextFocusableId = stackOrder.find(
(stackId) => stackId !== id && !processes?.[stackId]?.minimized
);
return nextFocusableId || "";
};
export default useNextFocusable;