Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
mycard
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
syntax_j
mycard
Commits
6dacbd23
Commit
6dacbd23
authored
Dec 06, 2016
by
神楽坂玲奈
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tray
parent
0759508b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
10 deletions
+19
-10
index.js
index.js
+19
-10
No files found.
index.js
View file @
6dacbd23
...
@@ -154,6 +154,23 @@ function createWindow() {
...
@@ -154,6 +154,23 @@ function createWindow() {
})
})
}
}
function
createTray
()
{
let
tray
=
new
Tray
(
path
.
join
(
process
.
env
[
'
NODE_ENV
'
]
==
'
production
'
?
process
.
resourcesPath
:
app
.
getAppPath
(),
'
images
'
,
'
icon.png
'
));
tray
.
on
(
'
click
'
,
(
event
)
=>
{
mainWindow
.
isVisible
()
?
mainWindow
.
hide
()
:
mainWindow
.
show
();
});
const
contextMenu
=
Menu
.
buildFromTemplate
([
// {label: '游戏', type: 'normal', click: (menuItem, browserWindow, event)=>{}},
// {label: '社区', type: 'normal', click: (menuItem, browserWindow, event)=>{}},
// {label: '切换账号', type: 'normal', click: (menuItem, browserWindow, event)=>{}},
{
label
:
'
退出
'
,
type
:
'
normal
'
,
click
:
app
.
quit
}
]);
tray
.
setToolTip
(
'
MyCard
'
);
tray
.
setContextMenu
(
contextMenu
)
}
// This method will be called when Electron has finished
// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
// initialization and is ready to create browser windows.
// Some APIs can only be used after this event occurs.
// Some APIs can only be used after this event occurs.
...
@@ -162,16 +179,8 @@ app.on('ready', () => {
...
@@ -162,16 +179,8 @@ app.on('ready', () => {
if
(
process
.
env
[
'
NODE_ENV
'
]
==
'
production
'
)
{
if
(
process
.
env
[
'
NODE_ENV
'
]
==
'
production
'
)
{
setTimeout
(
autoUpdater
.
checkForUpdates
,
2000
);
setTimeout
(
autoUpdater
.
checkForUpdates
,
2000
);
}
}
if
(
process
.
platform
==
'
win32
'
){
if
(
process
.
platform
==
'
win32
'
)
{
let
tray
=
new
Tray
(
path
.
join
(
process
.
env
[
'
NODE_ENV
'
]
==
'
production
'
?
process
.
resourcesPath
:
app
.
getAppPath
(),
'
images
'
,
'
icon.ico
'
));
createTray
()
const
contextMenu
=
Menu
.
buildFromTemplate
([
{
label
:
'
Item1
'
,
type
:
'
radio
'
},
{
label
:
'
Item2
'
,
type
:
'
radio
'
},
{
label
:
'
Item3
'
,
type
:
'
radio
'
,
checked
:
true
},
{
label
:
'
Item4
'
,
type
:
'
radio
'
}
]);
tray
.
setToolTip
(
'
MyCard
'
);
tray
.
setContextMenu
(
contextMenu
)
}
}
});
});
...
...
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