Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
netdisc
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
rocosen
netdisc
Commits
2e484c3b
Commit
2e484c3b
authored
Dec 02, 2022
by
rocosen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:适配win
parent
7d408f0b
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
4 deletions
+36
-4
iconwinTemplate.png
assets/img/iconwinTemplate.png
+0
-0
iconwinTemplate@2x.png
assets/img/iconwinTemplate@2x.png
+0
-0
main.ts
src/main/main.ts
+36
-4
No files found.
assets/img/iconwinTemplate.png
0 → 100644
View file @
2e484c3b
This diff was suppressed by a .gitattributes entry.
assets/img/iconwinTemplate@2x.png
0 → 100644
View file @
2e484c3b
This diff was suppressed by a .gitattributes entry.
src/main/main.ts
View file @
2e484c3b
...
...
@@ -16,7 +16,6 @@ import MenuBuilder from './menu';
import
{
resolveHtmlPath
}
from
'./util'
;
const
nativeImage
=
require
(
'electron'
).
nativeImage
;
const
positioner
=
require
(
'electron-traywindow-positioner'
);
class
AppUpdater
{
constructor
()
{
log
.
transports
.
file
.
level
=
'info'
;
...
...
@@ -40,10 +39,20 @@ const getAssetPath = (...paths: string[]): string => {
return
path
.
join
(
RESOURCES_PATH
,
...
paths
);
};
let
image
=
nativeImage
.
createFromPath
(
getAssetPath
(
'/img/iconTemplate.png'
));
let
image
:
any
if
(
process
.
platform
===
'darwin'
)
{
image
=
nativeImage
.
createFromPath
(
getAssetPath
(
'/img/iconTemplate.png'
));
}
else
{
image
=
nativeImage
.
createFromPath
(
getAssetPath
(
'/img/iconwinTemplate.png'
));
}
Menu
.
setApplicationMenu
(
null
);
const
gotTheLock
=
app
.
requestSingleInstanceLock
()
if
(
!
gotTheLock
)
{
app
.
quit
()
}
ipcMain
.
on
(
'createNewWindow-site'
,
(
event
,
arg
)
=>
{
if
(
siteWindown
)
{
siteWindown
.
focus
();
...
...
@@ -156,8 +165,11 @@ const createWindow = async () => {
frame
:
true
,
resizable
:
false
,
titleBarStyle
:
'hidden'
,
titleBarOverlay
:
true
,
// autoHideMenuBar: true,
maximizable
:
false
,
titleBarOverlay
:
{
color
:
'#ffffff'
,
height
:
30
},
webPreferences
:
{
sandbox
:
false
,
nodeIntegration
:
true
,
...
...
@@ -167,7 +179,21 @@ const createWindow = async () => {
});
tray
=
new
Tray
(
await
image
);
const
contextMenu
=
Menu
.
buildFromTemplate
([
{
label
:
'退出'
,
click
:
async
()
=>
{
app
.
quit
();
}
},
// { label: 'Item2', type: 'radio' },
// { label: 'Item3', type: 'radio', checked: true },
// { label: 'Item4', type: 'radio' }
])
tray
.
setContextMenu
(
contextMenu
)
// tray.setTitle('test');
tray
.
setToolTip
(
'北鲲云'
)
mainWindow
.
loadURL
(
resolveHtmlPath
(
'index.html'
));
// mainWindow.webContents.openDevTools();
...
...
@@ -209,6 +235,12 @@ const createWindow = async () => {
homeWindown
.
show
();
positioner
.
position
(
homeWindown
,
tray
.
getBounds
(),
alignment
);
});
tray
.
on
(
'right-click'
,
function
(){
if
(
!
tray
)
return
;
tray
.
popUpContextMenu
();
});
};
/**
...
...
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