Skip to content

Commit

Permalink
added ctrl-e keybind to toggle side menu #22
Browse files Browse the repository at this point in the history
  • Loading branch information
jackschedel committed Jul 30, 2023
1 parent b48a6e1 commit e7c2b3f
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,16 @@ function App() {
const setTheme = useStore((state) => state.setTheme);
const setApiKey = useStore((state) => state.setApiKey);
const setCurrentChatIndex = useStore((state) => state.setCurrentChatIndex);
const setHideSideMenu = useStore((state) => state.setHideSideMenu);
const hideSideMenu = useStore((state) => state.hideSideMenu);

const handleKeyDown = (e: React.KeyboardEvent<HTMLDivElement>) => {
// put any general app-wide keybinds here
if (e.ctrlKey && e.key === "e") {
e.preventDefault();
setHideSideMenu(!hideSideMenu);
}
};

if (isElectron()) {
window.electronAPI.setCloseToTray(useStore((state) => state.closeToTray));
Expand Down Expand Up @@ -80,7 +90,11 @@ function App() {
}, []);

return (
<div className="overflow-hidden w-full h-full relative">
<div
tabIndex={0}
className="overflow-hidden w-full h-full relative"
onKeyDown={handleKeyDown}
>
<Menu />
<Chat />
<ApiPopup />
Expand Down

0 comments on commit e7c2b3f

Please sign in to comment.