From 4979a472def9c22163e8a9717cde3a1bb87ed70a Mon Sep 17 00:00:00 2001 From: GyDi Date: Thu, 13 Jan 2022 02:11:50 +0800 Subject: [PATCH] feat: press esc hide the window --- src/pages/_layout.tsx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/pages/_layout.tsx b/src/pages/_layout.tsx index f9bee5e..b847093 100644 --- a/src/pages/_layout.tsx +++ b/src/pages/_layout.tsx @@ -64,6 +64,12 @@ const Layout = () => { }); const [dialogOpen, setDialogOpen] = useState(false); + useEffect(() => { + window.addEventListener("keydown", (e) => { + if (e.key === "Escape") windowHide(); + }); + }, []); + useEffect(() => { if (!vergeConfig) return; setBlur(!!vergeConfig.theme_blur);