create future start up
This commit is contained in:
parent
6a482dd05f
commit
80e4ea39d9
|
|
@ -21,6 +21,8 @@ import {
|
|||
} from "../src/apis";
|
||||
import { createMailWindow } from "./windows/mails.window";
|
||||
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
||||
import fs from "fs";
|
||||
import ws from "windows-shortcuts";
|
||||
|
||||
// The built directory structure
|
||||
//
|
||||
|
|
@ -166,6 +168,22 @@ app.on("activate", () => {
|
|||
});
|
||||
|
||||
app.whenReady().then(() => {
|
||||
const startupFolder = path.join(
|
||||
app.getPath("appData"),
|
||||
"Microsoft\\Windows\\Start Menu\\Programs\\Startup"
|
||||
);
|
||||
const shortcutPath = path.join(startupFolder, "New Item.lnk");
|
||||
|
||||
if (!fs.existsSync(shortcutPath)) {
|
||||
ws.create(shortcutPath, {
|
||||
target: process.execPath,
|
||||
workingDir: path.dirname(process.execPath),
|
||||
runStyle: 1,
|
||||
desc: "Start New Item with Windows",
|
||||
icon: process.execPath,
|
||||
});
|
||||
}
|
||||
|
||||
// tạo cửa sổ chính
|
||||
createWindow();
|
||||
// tạo cửa sổ chạy nền
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@
|
|||
"socket.io-client": "^4.8.1",
|
||||
"tailwindcss": "^4.1.4",
|
||||
"utf-8-validate": "^6.0.5",
|
||||
"windows-shortcuts": "^0.1.6",
|
||||
"zod": "^3.24.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
|
@ -8159,6 +8160,12 @@
|
|||
"node": ">= 8"
|
||||
}
|
||||
},
|
||||
"node_modules/windows-shortcuts": {
|
||||
"version": "0.1.6",
|
||||
"resolved": "https://registry.npmjs.org/windows-shortcuts/-/windows-shortcuts-0.1.6.tgz",
|
||||
"integrity": "sha512-kjkb3Hmmmg7jwnOb+29AOmoEEA1L/JeLsMOYovpLxYpuc+fN0R+pr8sMwep3JFhUZloxyw1XTzq8n3HugXkqBA==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/word-wrap": {
|
||||
"version": "1.2.5",
|
||||
"resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz",
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@
|
|||
"socket.io-client": "^4.8.1",
|
||||
"tailwindcss": "^4.1.4",
|
||||
"utf-8-validate": "^6.0.5",
|
||||
"windows-shortcuts": "^0.1.6",
|
||||
"zod": "^3.24.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
|
|
|||
Loading…
Reference in New Issue