"vscode:/vscode.git/clone" did not exist on "2ab937a07d6a3d2486edef945ec8a2de16439e95"
Commit bc54daf2 authored by Eva Ho's avatar Eva Ho
Browse files

add app to open at login by default

parent 8b57e715
import { spawn, exec } from 'child_process'
import { app, autoUpdater, dialog, Tray, Menu } from 'electron'
import Store from 'electron-store'
import * as path from 'path'
import * as fs from 'fs'
......@@ -7,6 +8,8 @@ import { analytics, id } from './telemetry'
require('@electron/remote/main').initialize()
const store = new Store();
let tray: Tray | null = null
const SingleInstanceLock = app.requestSingleInstanceLock()
......@@ -23,7 +26,9 @@ const createSystemtray = () => {
tray = new Tray(iconPath)
const contextMenu = Menu.buildFromTemplate([{ role: 'quit', label: 'Quit Ollama', accelerator: 'Command+Q' }])
const contextMenu = Menu.buildFromTemplate([
{ role: 'quit', label: 'Quit Ollama', accelerator: 'Command+Q' }
])
tray.setContextMenu(contextMenu)
tray.setToolTip('Ollama')
......@@ -107,6 +112,15 @@ app.on('ready', () => {
if (process.platform === 'darwin') {
app.dock.hide()
if (!store.has('first-time-run')) {
// This is the first run
app.setLoginItemSettings({ openAtLogin: true })
store.set('first-time-run', false);
} else {
// The app has been run before
app.setLoginItemSettings({ openAtLogin: app.getLoginItemSettings().openAtLogin })
}
if (!app.isInApplicationsFolder()) {
const chosen = dialog.showMessageBoxSync({
type: 'question',
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment