Skip to content

Commit

Permalink
Add quick nav logic
Browse files Browse the repository at this point in the history
  • Loading branch information
arhh committed Dec 21, 2024
1 parent ef9d7ed commit f975dc0
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
8 changes: 7 additions & 1 deletion config.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,11 @@
"windowWidth": 1200,
"windowHeight": 768,
"title": "G Apps Navigator",
"titleCamelCase": "GAppsNavigator"
"titleCamelCase": "GAppsNavigator",
"navigation": {
"drive": "https://drive.google.com",
"photos": "https://photos.google.com",
"calendar": "https://calendar.google.com",
"keep": "https://keep.google.com"
}
}
16 changes: 12 additions & 4 deletions main.cjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
const { app, BrowserWindow, Menu, MenuItem } = require('electron')
const config = require("./config.json");

const handleQuickNavigationClick = async (menuItem, focusedWindow, _) => {
await focusedWindow.loadURL(config.navigation[menuItem.id]);
};

const createWindow = () => {
const win = new BrowserWindow({
width: config.windowWidth,
Expand All @@ -23,19 +27,23 @@ const createWindow = () => {
submenu: [
{
id: 'drive',
label: 'Drive'
label: 'Drive',
click: handleQuickNavigationClick,
},
{
id: 'photos',
label: 'Photos'
label: 'Photos',
click: handleQuickNavigationClick,
},
{
id: 'keep',
label: 'Keep'
label: 'Keep',
click: handleQuickNavigationClick,
},
{
id: 'calendar',
label: 'Calendar and Tasks'
label: 'Calendar and Tasks',
click: handleQuickNavigationClick,
}
]
});
Expand Down

0 comments on commit f975dc0

Please sign in to comment.