feat: windows缩略图工具栏 (#1551)

* 从 v1 引入图标

* feat: windows缩略图工具栏

* 更新windows任务栏控制图标

图标基于microsoft fluent icon修改
移除like和unlike

* update

* 启动时显示taskbar buttons
This commit is contained in:
memorydream 2022-04-29 21:16:46 +08:00 committed by GitHub
parent d3e44541fb
commit 07d7564b1e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
20 changed files with 122 additions and 12 deletions

View file

@ -14,6 +14,7 @@ import log from './log'
import { initIpcMain } from './ipcMain'
import { createTray, YPMTray } from './tray'
import { IpcChannels } from '@/shared/IpcChannels'
import { createTaskbar, Thumbar } from './windowsTaskbar'
const isWindows = process.platform === 'win32'
const isMac = process.platform === 'darwin'
@ -32,6 +33,7 @@ interface TypedElectronStore {
class Main {
win: BrowserWindow | null = null
tray: YPMTray | null = null
thumbar: Thumbar | null = null
store = new Store<TypedElectronStore>({
defaults: {
window: {
@ -62,7 +64,8 @@ class Main {
this.handleAppEvents()
this.handleWindowEvents()
this.createTray()
initIpcMain(this.win, this.tray)
this.createThumbar()
initIpcMain(this.win, this.tray, this.thumbar)
this.initDevTools()
})
}
@ -93,6 +96,10 @@ class Main {
}
}
createThumbar() {
if (isWindows) this.thumbar = createTaskbar(this.win!)
}
createWindow() {
const options: BrowserWindowConstructorOptions = {
title: 'YesPlayMusic',
@ -150,7 +157,7 @@ class Main {
handleAppEvents() {
app.on('window-all-closed', () => {
this.win = null
if (process.platform !== 'darwin') app.quit()
if (!isMac) app.quit()
})
app.on('second-instance', () => {