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
4b0bf09a
Commit
4b0bf09a
authored
Dec 06, 2016
by
神楽坂玲奈
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tray
parent
a6591636
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
5 deletions
+21
-5
images/icon.ico
images/icon.ico
+0
-0
index.js
index.js
+19
-4
package.json
package.json
+2
-1
No files found.
images/icon.ico
0 → 100644
View file @
4b0bf09a
361 KB
index.js
View file @
4b0bf09a
...
...
@@ -27,7 +27,7 @@ if (handleElevate()) {
return
;
}
const
{
ipcMain
,
app
,
shell
,
BrowserWindow
}
=
require
(
'
electron
'
);
const
{
ipcMain
,
app
,
shell
,
BrowserWindow
,
Menu
,
Tray
}
=
require
(
'
electron
'
);
const
{
autoUpdater
}
=
require
(
"
electron-auto-updater
"
);
const
isDev
=
require
(
'
electron-is-dev
'
);
const
child_process
=
require
(
'
child_process
'
);
...
...
@@ -135,7 +135,7 @@ function createWindow() {
// and load the index.html of the app.
mainWindow
.
loadURL
(
`file://
${
__dirname
}
/index.html`
);
mainWindow
.
webContents
.
on
(
'
new-window
'
,
function
(
e
,
url
)
{
mainWindow
.
webContents
.
on
(
'
new-window
'
,
function
(
e
,
url
)
{
e
.
preventDefault
();
shell
.
openExternal
(
url
);
});
...
...
@@ -162,11 +162,26 @@ app.on('ready', () => {
if
(
process
.
env
[
'
NODE_ENV
'
]
==
'
production
'
)
{
setTimeout
(
autoUpdater
.
checkForUpdates
,
2000
);
}
if
(
process
.
platform
==
'
win32
'
){
let
tray
=
new
Tray
(
path
.
join
(
process
.
env
[
'
NODE_ENV
'
]
==
'
production
'
?
process
.
resourcesPath
:
app
.
getAppPath
(),
'
images
'
,
'
icon.ico
'
));
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
)
}
});
// Quit when all windows are closed.
app
.
on
(
'
window-all-closed
'
,
function
()
{
app
.
quit
()
// On OS X it is common for applications and their menu bar
// to stay active until the user quits explicitly with Cmd + Q
if
(
process
.
platform
!==
'
darwin
'
)
{
app
.
quit
()
}
});
app
.
on
(
'
activate
'
,
function
()
{
...
...
@@ -185,4 +200,4 @@ app.on('quit', () => {
if
(
process
.
platform
!=
'
win32
'
)
{
aria2c
.
kill
()
}
});
\ No newline at end of file
});
package.json
View file @
4b0bf09a
...
...
@@ -69,7 +69,8 @@
}
],
"extraResources"
:
[
"bin"
"bin"
,
"images"
],
"win"
:
{
"target"
:
[
...
...
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