app: fix #218 and keep dock open on install
This commit is contained in:
parent
31673d26d0
commit
dbb3174cbc
3 changed files with 12 additions and 6 deletions
|
@ -2,7 +2,7 @@ import { useState } from 'react'
|
||||||
import copy from 'copy-to-clipboard'
|
import copy from 'copy-to-clipboard'
|
||||||
import { CheckIcon, DocumentDuplicateIcon } from '@heroicons/react/24/outline'
|
import { CheckIcon, DocumentDuplicateIcon } from '@heroicons/react/24/outline'
|
||||||
import Store from 'electron-store'
|
import Store from 'electron-store'
|
||||||
import { getCurrentWindow } from '@electron/remote'
|
import { getCurrentWindow, app } from '@electron/remote'
|
||||||
|
|
||||||
import { install } from './install'
|
import { install } from './install'
|
||||||
import OllamaIcon from './ollama.svg'
|
import OllamaIcon from './ollama.svg'
|
||||||
|
@ -107,6 +107,11 @@ export default function () {
|
||||||
<button
|
<button
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
store.set('first-time-run', true)
|
store.set('first-time-run', true)
|
||||||
|
|
||||||
|
if (process.platform === 'darwin') {
|
||||||
|
app.dock.hide()
|
||||||
|
}
|
||||||
|
|
||||||
window.close()
|
window.close()
|
||||||
}}
|
}}
|
||||||
className='no-drag rounded-dm mx-auto w-[60%] rounded-md bg-black px-4 py-2 text-sm text-white hover:brightness-110'
|
className='no-drag rounded-dm mx-auto w-[60%] rounded-md bg-black px-4 py-2 text-sm text-white hover:brightness-110'
|
||||||
|
|
|
@ -36,6 +36,7 @@ app.on('ready', () => {
|
||||||
const gotTheLock = app.requestSingleInstanceLock()
|
const gotTheLock = app.requestSingleInstanceLock()
|
||||||
if (!gotTheLock) {
|
if (!gotTheLock) {
|
||||||
app.exit(0)
|
app.exit(0)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
app.on('second-instance', () => {
|
app.on('second-instance', () => {
|
||||||
|
@ -56,10 +57,6 @@ app.on('ready', () => {
|
||||||
init()
|
init()
|
||||||
})
|
})
|
||||||
|
|
||||||
if (process.platform === 'darwin') {
|
|
||||||
app.dock.hide()
|
|
||||||
}
|
|
||||||
|
|
||||||
function firstRunWindow() {
|
function firstRunWindow() {
|
||||||
// Create the browser window.
|
// Create the browser window.
|
||||||
welcomeWindow = new BrowserWindow({
|
welcomeWindow = new BrowserWindow({
|
||||||
|
@ -198,6 +195,10 @@ function init() {
|
||||||
server()
|
server()
|
||||||
|
|
||||||
if (store.get('first-time-run') && installed()) {
|
if (store.get('first-time-run') && installed()) {
|
||||||
|
if (process.platform === 'darwin') {
|
||||||
|
app.dock.hide()
|
||||||
|
}
|
||||||
|
|
||||||
app.setLoginItemSettings({ openAtLogin: app.getLoginItemSettings().openAtLogin })
|
app.setLoginItemSettings({ openAtLogin: app.getLoginItemSettings().openAtLogin })
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@ export function installed() {
|
||||||
export async function install() {
|
export async function install() {
|
||||||
const command = `do shell script "mkdir -p ${path.dirname(
|
const command = `do shell script "mkdir -p ${path.dirname(
|
||||||
symlinkPath
|
symlinkPath
|
||||||
)} && ln -F -s ${ollama} ${symlinkPath}" with administrator privileges`
|
)} && ln -F -s \\"${ollama}\\" \\"${symlinkPath}\\"" with administrator privileges`
|
||||||
|
|
||||||
await exec(`osascript -e '${command}'`)
|
await exec(`osascript -e '${command}'`)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue