Skip to content

Commit

Permalink
feat: add open toggle to tray contextmenu
Browse files Browse the repository at this point in the history
  • Loading branch information
Dwynr committed Nov 20, 2024
1 parent 649b258 commit 2d08ae0
Showing 1 changed file with 20 additions and 9 deletions.
29 changes: 20 additions & 9 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,18 @@ export class FilenDesktop {
this.launcherWindow = null
}

private showOrOpenDriveWindow(): void {
if (BrowserWindow.getAllWindows().length === 0) {
this.createMainWindow().catch(err => {
this.logger.log("error", err)
})

return
}

this.driveWindow?.show()
}

private async createMainWindow(): Promise<void> {
if (this.driveWindow) {
return
Expand Down Expand Up @@ -269,15 +281,7 @@ export class FilenDesktop {
this.tray.setToolTip("Filen")

this.tray.on("click", () => {
if (BrowserWindow.getAllWindows().length === 0) {
this.createMainWindow().catch(err => {
this.logger.log("error", err)
})

return
}

this.driveWindow?.show()
this.showOrOpenDriveWindow()
})

this.tray.setContextMenu(
Expand All @@ -288,6 +292,13 @@ export class FilenDesktop {
icon: getTrayIcon(false),
enabled: false
},
{
label: "Open",
type: "normal",
click: () => {
this.showOrOpenDriveWindow()
}
},
{
label: "Separator",
type: "separator"
Expand Down

0 comments on commit 2d08ae0

Please sign in to comment.