update start up

This commit is contained in:
nkhangg 2025-06-03 21:58:23 +07:00
parent 933bed2c81
commit 6f9442a02e
5 changed files with 28 additions and 15 deletions

View File

@ -16,8 +16,8 @@ asarUnpack:
- resources/**
win:
target: portable
executableName: New-item,
target: nsis
executableName: New-item
publisherName: apactech
portable:

9
package-lock.json generated
View File

@ -20,7 +20,8 @@
"axios": "^1.9.0",
"electron-updater": "^6.3.9",
"moment": "^2.30.1",
"pusher-js": "^8.4.0"
"pusher-js": "^8.4.0",
"windows-shortcuts": "^0.1.6"
},
"devDependencies": {
"@electron-toolkit/eslint-config-prettier": "^3.0.0",
@ -10979,6 +10980,12 @@
"string-width": "^1.0.2 || 2 || 3 || 4"
}
},
"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",

View File

@ -1,6 +1,6 @@
{
"name": "new-item-app",
"version": "1.0.3",
"version": "1.0.5",
"description": "new item application is active",
"main": "./out/main/index.js",
"author": "apactech.io",
@ -32,7 +32,8 @@
"axios": "^1.9.0",
"electron-updater": "^6.3.9",
"moment": "^2.30.1",
"pusher-js": "^8.4.0"
"pusher-js": "^8.4.0",
"windows-shortcuts": "^0.1.6"
},
"devDependencies": {
"@electron-toolkit/eslint-config-prettier": "^3.0.0",

View File

@ -5,6 +5,7 @@ import { app, BrowserWindow, globalShortcut, ipcMain, Menu, screen, shell, Tray
import fs from 'fs'
import path, { join } from 'path'
import icon from '../../resources/icon.png?asset'
import ws from 'windows-shortcuts'
let mainWindow: null | BrowserWindow = null
let isQuiting = false
@ -111,18 +112,22 @@ function createTray() {
// initialization and is ready to create browser windows.
// Some APIs can only be used after this event occurs.
app.whenReady().then(() => {
const startupFlagFile = path.join(app.getPath('userData'), 'startup-set.flag')
// const startupFlagFile = path.join(app.getPath('userData'), 'startup-set.flag')
const startupFolder = path.join(
app.getPath('appData'),
'Microsoft\\Windows\\Start Menu\\Programs\\Startup'
)
const shortcutPath = path.join(startupFolder, 'New Item.lnk')
if (!fs.existsSync(startupFlagFile)) {
app.setLoginItemSettings({
openAtLogin: true,
path: process.execPath,
args: []
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
})
fs.writeFileSync(startupFlagFile, 'ok')
}
// Set app user model id for windows
electronApp.setAppUserModelId('com.electron')

View File

@ -20,7 +20,7 @@ const CardItem: React.FC<CardItemProps> = ({ item, hotItem }) => {
justifyContent: 'center'
}}
>
{true ? (
{hotItem ? (
<Box
style={{
position: 'absolute',