Skip to content

Commit

Permalink
update electron version (#40)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidsmorais authored Jun 21, 2022
1 parent a659a54 commit 4fb6c5e
Show file tree
Hide file tree
Showing 14 changed files with 3,327 additions and 2,176 deletions.
42 changes: 20 additions & 22 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const fs = require("fs");
const { is, readSheet } = require("./src/util");
const file = require("./src/file");
const menu = require("./src/menu");
const settings = require("./src/settings");
const { store } = require("./src/settings");
const shortcut = require("./src/keymap");
const time = require("./src/time");
const tray = require("./src/tray");
Expand Down Expand Up @@ -41,9 +41,9 @@ function createMainWindow() {

kuroWindow.loadURL(url.app);

kuroWindow.on("close", e => {
kuroWindow.on("close", error => {
if (!exiting) {
e.preventDefault();
error.preventDefault();

if (is.darwin) {
app.hide();
Expand All @@ -53,20 +53,20 @@ function createMainWindow() {
}
});

kuroWindow.on("page-title-updated", e => {
e.preventDefault();
kuroWindow.on("page-title-updated", error => {
error.preventDefault();
});

kuroWindow.on("unresponsive", log);

kuroWindow.webContents.on("did-navigate-in-page", (_, url) => {
settings.set("lastURL", url);
store.set("lastURL", url);
});

return kuroWindow;
}

app.on("ready", () => {
app.whenReady().then(() => {
Menu.setApplicationMenu(menu);

const lang = app.getLocale();
Expand All @@ -76,23 +76,24 @@ app.on("ready", () => {
});

mainWindow = createMainWindow();

if (settings.get("useGlobalShortcuts")) {
if (store.get("useGlobalShortcuts")) {
shortcut.registerGlobal();
}

if (!settings.get("hideTray")) {
if (!store.get("hideTray")) {
tray.create();
}

const { webContents } = mainWindow;

webContents.on("dom-ready", () => {
const stylesheets = fs.readdirSync(file.style);
stylesheets.forEach(x => webContents.insertCSS(readSheet(x)));
fs.readdir(file.style, (error, files) => {
for (const x of files) {
webContents.insertCSS(readSheet(x));
}
});

if (!shown) {
if (settings.get("launchMinimized")) {
if (store.get("launchMinimized")) {
mainWindow.minimize();
} else {
mainWindow.show();
Expand All @@ -102,18 +103,15 @@ app.on("ready", () => {
}
});

webContents.on("new-window", (e, url) => {
e.preventDefault();
webContents.on("new-window", (error, url) => {
error.preventDefault();
shell.openExternal(url);
});

webContents.on("crashed", log);

if (!settings.get("disableAutoUpdateCheck")) {
setInterval(
() => update.auto(),
time.ms(settings.get("updateCheckPeriod"))
);
if (!store.get("disableAutoUpdateCheck")) {
setInterval(() => update.auto(), time.ms(store.get("updateCheckPeriod")));
}
});

Expand All @@ -124,6 +122,6 @@ app.on("activate", () => mainWindow.show());
app.on("before-quit", () => {
exiting = true;
if (!mainWindow.isFullScreen()) {
settings.set("lastWindowState", mainWindow.getBounds());
store.set("lastWindowState", mainWindow.getBounds());
}
});
19 changes: 15 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,15 @@
"start": "electron ."
},
"dependencies": {
"@electron/remote": "^2.0.8",
"auto-launch": "^5.0.1",
"electron-context-menu": "^0.16.0",
"electron-context-menu": "^3.2.0",
"electron-debug": "^1.4.0",
"electron-dl": "^1.10.0",
"electron-settings": "^3.1.4"
"electron-store": "^8.0.2"
},
"devDependencies": {
"electron": "11.5.0",
"electron": "^19.0.4",
"electron-builder": "20.40.2",
"electron-icon-maker": "^0.0.5",
"stylelint": "^9.9.0",
Expand All @@ -44,8 +45,18 @@
"node"
],
"rules": {
"n/prefer-global/process": 0,
"unicorn/prefer-module": 0,
"unicorn/no-for-loop": 0,
"unicorn/no-array-for-each": 0,
"import/extensions": 0,
"object-curly-spacing": 0,
"quote-props": 0,
"unicorn/prefer-query-selector": 0
"unicorn/prefer-query-selector": 0,
"quotes": [
"error",
"double"
]
},
"space": 2
},
Expand Down
10 changes: 5 additions & 5 deletions src/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
const { ipcRenderer: ipc } = require("electron");
const mode = require("./mode");
const nav = require("./nav");
const settings = require("./settings");
const {store} = require("./settings");
const startup = require("./startup");

ipc.on("search", () => {
Expand All @@ -24,7 +24,7 @@ ipc.on("rename-list", () => {

ipc.on("hide-todo", () => {
nav.click(
'.taskCard-headerActions [aria-labelledby="completed_tasks-label completed_tasks-hint"]'
".taskCard-headerActions [aria-labelledby=\"completed_tasks-label completed_tasks-hint\"]",
);
});

Expand Down Expand Up @@ -92,7 +92,7 @@ ipc.on("sign-out", () => {
});

ipc.on("toggle-sidebar", () => {
settings.set("sideBarHidden", !settings.get("sideBarHidden"));
store.set("sideBarHidden", !store.get("sideBarHidden"));
nav.sideBar();
});

Expand Down Expand Up @@ -124,12 +124,12 @@ ipc.on("zoom-out", () => nav.zoomOut());

ipc.on("zoom-reset", () => nav.zoomReset());

document.addEventListener("keydown", e => nav.jumpToList(e));
document.addEventListener("keydown", list => nav.jumpToList(list));

document.addEventListener("DOMContentLoaded", () => {
nav.zoomRestore();

if (settings.get("autoNightMode")) {
if (store.get("autoNightMode")) {
mode.autoNight();
}

Expand Down
74 changes: 37 additions & 37 deletions src/dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,37 +4,37 @@ const os = require("os");
const { activate } = require("./win");
const { release } = require("./url");
const file = require("./file");
const settings = require("./settings");
const {store: settings} = require("./settings");

class Dialog {
get _keyReferenceInfo() {
return [
`Add due date: Ctrl+Shift+T`,
`Add my day: Ctrl+K`,
`Complete todo: Ctrl+Shift+N`,
`Delete list: Ctrl+Shift+D`,
`Delete todo: Ctrl+D`,
`Global create todo: Ctrl+Alt+C`,
`Global search todo: Ctrl+Alt+F`,
`Global toggle window: Ctrl+Alt+A`,
`Hide todo: Ctrl+Shift+H`,
`Important: Ctrl+I`,
`My day: Ctrl+M`,
`New list: Ctrl+L`,
`New todo: Ctrl+N`,
`Planned: Ctrl+P`,
`Rename list: Ctrl+Y`,
`Rename todo: Ctrl+T`,
`Return: Esc`,
`Set reminder: Ctrl+Shift+E`,
`Settings: Ctrl+,`,
`Sign out: Ctrl+Alt+Q`,
`Tasks: Ctrl+J`,
`Toggle black mode: Ctrl+B`,
`Toggle dark mode: Ctrl+H`,
`Toggle sepia mode: Ctrl+G`,
`Toggle dracula mode: Ctrl+Shift+G`,
`Toggle sidebar: Ctrl+O`
"Add due date: Ctrl+Shift+T",
"Add my day: Ctrl+K",
"Complete todo: Ctrl+Shift+N",
"Delete list: Ctrl+Shift+D",
"Delete todo: Ctrl+D",
"Global create todo: Ctrl+Alt+C",
"Global search todo: Ctrl+Alt+F",
"Global toggle window: Ctrl+Alt+A",
"Hide todo: Ctrl+Shift+H",
"Important: Ctrl+I",
"My day: Ctrl+M",
"New list: Ctrl+L",
"New todo: Ctrl+N",
"Planned: Ctrl+P",
"Rename list: Ctrl+Y",
"Rename todo: Ctrl+T",
"Return: Esc",
"Set reminder: Ctrl+Shift+E",
"Settings: Ctrl+,",
"Sign out: Ctrl+Alt+Q",
"Tasks: Ctrl+J",
"Toggle black mode: Ctrl+B",
"Toggle dark mode: Ctrl+H",
"Toggle sepia mode: Ctrl+G",
"Toggle dracula mode: Ctrl+Shift+G",
"Toggle sidebar: Ctrl+O"
].join("\n");
}

Expand All @@ -45,7 +45,7 @@ class Dialog {
`Chrome: ${process.versions.chrome}`,
`Node: ${process.versions.node}`,
`V8: ${process.versions.v8}`,
`OS: ${os.type()} ${os.arch()} ${os.release()}`
`OS: ${os.type()} ${os.arch()} ${os.release()}`,
].join("\n");
}

Expand All @@ -54,7 +54,7 @@ class Dialog {
buttons: ["Done", "Copy"],
detail: `Created by Greymond.\n\n${this._keyReferenceInfo}`,
message: `Kuro ${app.getVersion()} (${os.arch()})`,
title: "Shortcut Key Reference"
title: "Shortcut Key Reference",
});
}

Expand All @@ -63,7 +63,7 @@ class Dialog {
buttons: ["Done", "Copy"],
detail: `Created by Klaus Sinani.\n\n${this._systemInfo}`,
message: `Kuro ${app.getVersion()} (${os.arch()})`,
title: "About Kuro"
title: "About Kuro",
});
}

Expand All @@ -73,9 +73,9 @@ class Dialog {
{
cancelId: 1,
defaultId: 0,
icon: file.icon
icon: file.icon,
},
options
options,
)
);
}
Expand All @@ -85,7 +85,7 @@ class Dialog {
buttons: ["Exit", "Dismiss"],
detail: "Are you sure you want to exit?",
message: "Exit Kuro",
title: "Kuro - Exit Confirmation"
title: "Kuro - Exit Confirmation",
});
}

Expand All @@ -94,7 +94,7 @@ class Dialog {
buttons: ["Sign Out", "Dismiss"],
detail: "Are you sure you want to sign out?",
message: "Sign out of Kuro",
title: "Kuro - Sign Out Confirmation"
title: "Kuro - Sign Out Confirmation",
});
}

Expand All @@ -103,7 +103,7 @@ class Dialog {
buttons: ["Restart", "Dismiss"],
detail: "Would you like to restart now?",
message: "Restart Kuro to activate your new settings",
title: "Kuro - Restart Required"
title: "Kuro - Restart Required",
});
}

Expand All @@ -112,7 +112,7 @@ class Dialog {
buttons: ["Download", "Dismiss"],
detail: "Click Download to get it now",
message: `Version ${version} is now available`,
title: "Update Kuro"
title: "Update Kuro",
});
}

Expand Down Expand Up @@ -161,7 +161,7 @@ class Dialog {
buttons: ["Done"],
detail: `Kuro is running on the latest ${app.getVersion()} version`,
message: "There are currently no updates available",
title: "Kuro - No Update Available"
title: "Kuro - No Update Available",
});
}

Expand Down
Loading

0 comments on commit 4fb6c5e

Please sign in to comment.