Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
ollama
Commits
bc54daf2
Commit
bc54daf2
authored
Jul 07, 2023
by
Eva Ho
Browse files
add app to open at login by default
parent
8b57e715
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
1 deletion
+15
-1
app/src/index.ts
app/src/index.ts
+15
-1
No files found.
app/src/index.ts
View file @
bc54daf2
import
{
spawn
,
exec
}
from
'
child_process
'
import
{
spawn
,
exec
}
from
'
child_process
'
import
{
app
,
autoUpdater
,
dialog
,
Tray
,
Menu
}
from
'
electron
'
import
{
app
,
autoUpdater
,
dialog
,
Tray
,
Menu
}
from
'
electron
'
import
Store
from
'
electron-store
'
import
*
as
path
from
'
path
'
import
*
as
path
from
'
path
'
import
*
as
fs
from
'
fs
'
import
*
as
fs
from
'
fs
'
...
@@ -7,6 +8,8 @@ import { analytics, id } from './telemetry'
...
@@ -7,6 +8,8 @@ import { analytics, id } from './telemetry'
require
(
'
@electron/remote/main
'
).
initialize
()
require
(
'
@electron/remote/main
'
).
initialize
()
const
store
=
new
Store
();
let
tray
:
Tray
|
null
=
null
let
tray
:
Tray
|
null
=
null
const
SingleInstanceLock
=
app
.
requestSingleInstanceLock
()
const
SingleInstanceLock
=
app
.
requestSingleInstanceLock
()
...
@@ -23,7 +26,9 @@ const createSystemtray = () => {
...
@@ -23,7 +26,9 @@ const createSystemtray = () => {
tray
=
new
Tray
(
iconPath
)
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
.
setContextMenu
(
contextMenu
)
tray
.
setToolTip
(
'
Ollama
'
)
tray
.
setToolTip
(
'
Ollama
'
)
...
@@ -107,6 +112,15 @@ app.on('ready', () => {
...
@@ -107,6 +112,15 @@ app.on('ready', () => {
if
(
process
.
platform
===
'
darwin
'
)
{
if
(
process
.
platform
===
'
darwin
'
)
{
app
.
dock
.
hide
()
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
())
{
if
(
!
app
.
isInApplicationsFolder
())
{
const
chosen
=
dialog
.
showMessageBoxSync
({
const
chosen
=
dialog
.
showMessageBoxSync
({
type
:
'
question
'
,
type
:
'
question
'
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment