Skip to content

Commit

Permalink
ctrl-arrow keybind remove + macos tray fix
Browse files Browse the repository at this point in the history
  • Loading branch information
jackschedel committed Jan 14, 2024
1 parent 7618060 commit e5c2128
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 23 deletions.
28 changes: 17 additions & 11 deletions electron/index.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,16 @@ contextMenu({
function handleSetCloseToTray(event, setting) {
closeToTray = setting;

if (closeToTray && trayExists) {
winTray.destroy();
trayExists = false;
}
if (process.platform !== 'darwin') {
if (closeToTray && trayExists) {
winTray.destroy();
trayExists = false;
}

if (closeToTray && !trayExists) {
createTray(win);
trayExists = true;
if (closeToTray && !trayExists) {
createTray(win);
trayExists = true;
}
}
}

Expand Down Expand Up @@ -126,10 +128,8 @@ const createTray = (window) => {

winTray.on('click', () => {
if (win) {
if (!win.isVisible()) win.show();

if (win.isMinimized()) win.restore();

if (!win.isVisible()) win.show();
win.focus();
}
});
Expand All @@ -139,8 +139,14 @@ const createTray = (window) => {
return winTray;
};

app.on('activate', () => {
if (win) {
win.show();
}
});

app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
if (!(process.platform === 'darwin' && closeToTray)) {
app.quit();
}
});
Expand Down
12 changes: 0 additions & 12 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -120,18 +120,6 @@ function App() {
addChat();
pasteSubmit();
}

// ctrl+left - Previous chat
if (e.ctrlKey && e.key === 'ArrowLeft') {
e.preventDefault();
goBack();
}

// ctrl+right - Next chat
if (e.ctrlKey && e.key === 'ArrowRight') {
e.preventDefault();
goForward();
}
};

const handleMouseUp = (e: React.MouseEvent<HTMLDivElement>) => {
Expand Down

0 comments on commit e5c2128

Please sign in to comment.