增加“关闭时最小化到托盘”的设置 (#166)

添加托盘设置,调整主进程代码架构
pull/225/head
Lasy 2020-04-03 20:00:43 +08:00 committed by GitHub
parent 15a76486ef
commit 1e481edc67
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
36 changed files with 340 additions and 202 deletions

View File

@ -9,6 +9,8 @@ module.exports = {
}, },
resolve: { resolve: {
alias: { alias: {
'@': path.join(__dirname, '../../src/main'),
events: path.join(__dirname, '../../src/main/events'),
common: path.join(__dirname, '../../src/common'), common: path.join(__dirname, '../../src/common'),
}, },
extensions: ['*', '.js', '.json', '.node'], extensions: ['*', '.js', '.json', '.node'],

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{ {
"name": "lx-music-desktop", "name": "lx-music-desktop",
"version": "0.16.0", "version": "0.17.0",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {

5
src/main/events/_name.js Normal file
View File

@ -0,0 +1,5 @@
exports.tray = {
create: 'create',
destroy: 'destroy',
}

View File

@ -1,13 +1,5 @@
global.lx_event = {}
require('./request') const Tray = require('./tray')
// require('./appName')
require('./progressBar') if (!global.lx_event.setting) global.lx_event.tray = new Tray()
require('./trafficLight')
require('./musicMeta')
require('./selectDir')
require('./setWindowSize')
require('./showSaveDialog')
require('./clearCache')
require('./getCacheSize')
require('./setIgnoreMouseEvent')
require('./getEnvParams')

14
src/main/events/tray.js Normal file
View File

@ -0,0 +1,14 @@
const { EventEmitter } = require('events')
const { tray: TRAY_EVENT_NAME } = require('./_name')
class Tray extends EventEmitter {
create() {
this.emit(TRAY_EVENT_NAME.create)
}
destroy() {
this.emit(TRAY_EVENT_NAME.destroy)
}
}
module.exports = Tray

View File

@ -1,4 +1,4 @@
const { app, BrowserWindow, Menu } = require('electron') const { app, BrowserWindow } = require('electron')
const path = require('path') const path = require('path')
// 单例应用程序 // 单例应用程序
@ -15,28 +15,28 @@ app.on('second-instance', (event, argv, cwd) => {
} }
}) })
const isDev = process.env.NODE_ENV !== 'production' const isDev = global.isDev = process.env.NODE_ENV !== 'production'
// https://github.com/electron/electron/issues/18397 // https://github.com/electron/electron/issues/18397
app.allowRendererProcessReuse = !isDev app.allowRendererProcessReuse = !isDev
const { getWindowSizeInfo, parseEnv } = require('./utils') const { getAppSetting, parseEnv, getWindowSizeInfo } = require('./utils')
global.envParams = parseEnv() global.envParams = parseEnv()
require('../common/error') require('../common/error')
require('./events') require('./events')
const winEvent = require('./events/winEvent') require('./rendererEvents')
const winEvent = require('./rendererEvents/winEvent')
const autoUpdate = require('./utils/autoUpdate') const autoUpdate = require('./utils/autoUpdate')
const { isLinux, isMac } = require('../common/utils') const { isMac, isLinux } = require('../common/utils')
let mainWindow let mainWindow
let winURL let winURL
let isFirstCheckedUpdate = true
if (isDev) { if (isDev) {
global.__static = path.join(__dirname, '../static') // eslint-disable-next-line no-undef
global.__static = __static
winURL = 'http://localhost:9080' winURL = 'http://localhost:9080'
} else { } else {
global.__static = path.join(__dirname, '/static') global.__static = path.join(__dirname, '/static')
@ -44,7 +44,7 @@ if (isDev) {
} }
function createWindow() { function createWindow() {
let windowSizeInfo = getWindowSizeInfo() const windowSizeInfo = getWindowSizeInfo(global.appSetting)
/** /**
* Initial window options * Initial window options
*/ */
@ -71,61 +71,27 @@ function createWindow() {
winEvent(mainWindow) winEvent(mainWindow)
// mainWindow.webContents.openDevTools() // mainWindow.webContents.openDevTools()
if (!isDev) { if (!isDev) autoUpdate()
autoUpdate(isFirstCheckedUpdate)
isFirstCheckedUpdate = false
}
} }
if (isMac) { function init() {
const template = [ global.appSetting = getAppSetting()
{ createWindow()
label: app.getName(), global.lx_event.tray.create()
submenu: [
{ label: '关于洛雪音乐', role: 'about' },
{ type: 'separator' },
{ label: '隐藏', role: 'hide' },
{ label: '显示其他', role: 'hideothers' },
{ label: '显示全部', role: 'unhide' },
{ type: 'separator' },
{ label: '退出', accelerator: 'Command+Q', click: () => app.quit() },
],
},
{
label: '窗口',
role: 'window',
submenu: [
{ label: '最小化', role: 'minimize' },
{ label: '关闭', role: 'close' },
],
},
{
label: '编辑',
submenu: [
{ label: '撤销', accelerator: 'CmdOrCtrl+Z', role: 'undo' },
{ label: '恢复', accelerator: 'Shift+CmdOrCtrl+Z', role: 'redo' },
{ type: 'separator' },
{ label: '剪切', accelerator: 'CmdOrCtrl+X', role: 'cut' },
{ label: '复制', accelerator: 'CmdOrCtrl+C', role: 'copy' },
{ label: '粘贴', accelerator: 'CmdOrCtrl+V', role: 'paste' },
{ label: '选择全部', accelerator: 'CmdOrCtrl+A', role: 'selectAll' },
],
},
]
Menu.setApplicationMenu(Menu.buildFromTemplate(template))
} else {
Menu.setApplicationMenu(null)
} }
app.on('ready', createWindow) app.on('ready', init)
app.on('window-all-closed', () => {
if (!isMac) app.quit()
})
app.on('activate', () => { app.on('activate', () => {
if (mainWindow === null) { if (mainWindow === null) return init()
createWindow() })
app.on('window-all-closed', () => {
if (isMac) {
global.lx_event.tray.destroy()
} else {
app.quit()
} }
}) })
require('./modules')

View File

@ -0,0 +1,43 @@
const { app, Menu } = require('electron')
const { isMac } = require('../../common/utils')
if (isMac) {
const template = [
{
label: app.getName(),
submenu: [
{ label: '关于洛雪音乐', role: 'about' },
{ type: 'separator' },
{ label: '隐藏', role: 'hide' },
{ label: '显示其他', role: 'hideothers' },
{ label: '显示全部', role: 'unhide' },
{ type: 'separator' },
{ label: '退出', accelerator: 'Command+Q', click: () => app.quit() },
],
},
{
label: '窗口',
role: 'window',
submenu: [
{ label: '最小化', role: 'minimize' },
{ label: '关闭', role: 'close' },
],
},
{
label: '编辑',
submenu: [
{ label: '撤销', accelerator: 'CmdOrCtrl+Z', role: 'undo' },
{ label: '恢复', accelerator: 'Shift+CmdOrCtrl+Z', role: 'redo' },
{ type: 'separator' },
{ label: '剪切', accelerator: 'CmdOrCtrl+X', role: 'cut' },
{ label: '复制', accelerator: 'CmdOrCtrl+C', role: 'copy' },
{ label: '粘贴', accelerator: 'CmdOrCtrl+V', role: 'paste' },
{ label: '选择全部', accelerator: 'CmdOrCtrl+A', role: 'selectAll' },
],
},
]
Menu.setApplicationMenu(Menu.buildFromTemplate(template))
} else {
Menu.setApplicationMenu(null)
}

View File

@ -0,0 +1,2 @@
require('./appMenu')
require('./tray')

42
src/main/modules/tray.js Normal file
View File

@ -0,0 +1,42 @@
const { Tray, Menu } = require('electron')
const { isMac, isWin } = require('../../common/utils')
const { tray: TRAY_EVENT_NAME } = require('../events/_name')
const path = require('path')
global.lx_event.tray.on(TRAY_EVENT_NAME.create, () => {
createTray()
})
global.lx_event.tray.on(TRAY_EVENT_NAME.destroy, () => {
destroyTray()
})
let tray
function createTray() {
if (tray && !tray.isDestroyed() && global.appSetting.tray && global.appSetting.tray.isShow) return
const iconPath = path.join(global.__static, 'images/tray', isWin ? '256x256.ico' : isMac ? '512x512.icns' : '512x512.png')
// 托盘
tray = new Tray(iconPath)
const contextMenu = Menu.buildFromTemplate([
{
label: '退出',
role: 'quit',
},
])
tray.setToolTip('洛雪音乐助手')
tray.setContextMenu(contextMenu)
tray.on('click', () => {
const mainWindow = global.mainWindow
if (!mainWindow) return
mainWindow.isVisible()
? mainWindow.focus()
: mainWindow.show()
})
}
function destroyTray() {
if (!tray) return
tray.destroy()
tray = null
}

View File

@ -0,0 +1,14 @@
require('./request')
// require('./appName')
require('./progressBar')
require('./trafficLight')
require('./musicMeta')
require('./selectDir')
require('./setWindowSize')
require('./showSaveDialog')
require('./clearCache')
require('./getCacheSize')
require('./setIgnoreMouseEvent')
require('./getEnvParams')
require('./tray')

View File

@ -1,7 +1,6 @@
// const { app } = require('electron') // const { app } = require('electron')
const { mainOn } = require('../../common/ipc') const { mainOn } = require('../../common/ipc')
mainOn('min', event => { mainOn('min', event => {
if (global.mainWindow) { if (global.mainWindow) {
global.mainWindow.minimize() global.mainWindow.minimize()
@ -12,10 +11,11 @@ mainOn('max', event => {
global.mainWindow.maximize() global.mainWindow.maximize()
} }
}) })
mainOn('close', event => { mainOn('close', (event, params) => {
if (global.mainWindow) { if (global.mainWindow) {
// console.log('close', params)
if (params && params.isToTray) return global.mainWindow.hide()
// global.mainWindowdow.destroy() // global.mainWindowdow.destroy()
// console.log('close')
// app.quit() // app.quit()
global.mainWindow.close() global.mainWindow.close()
} }

View File

@ -0,0 +1,17 @@
// const { app } = require('electron')
const { mainOn } = require('../../common/ipc')
mainOn('changeTray', (event, params) => {
switch (params.action) {
case 'create':
global.lx_event.tray.create()
break
case 'destroy':
global.lx_event.tray.destroy()
break
default:
break
}
})

View File

@ -5,6 +5,9 @@ const { mainOn } = require('../../common/ipc')
autoUpdater.logger = log autoUpdater.logger = log
// autoUpdater.autoDownload = false // autoUpdater.autoDownload = false
autoUpdater.logger.transports.file.level = 'info' autoUpdater.logger.transports.file.level = 'info'
let isFirstCheckedUpdate = true
log.info('App starting...') log.info('App starting...')
@ -67,7 +70,7 @@ const handleSendEvent = action => {
} }
} }
module.exports = isFirstCheckedUpdate => { module.exports = () => {
if (!isFirstCheckedUpdate) { if (!isFirstCheckedUpdate) {
if (waitEvent.length) { if (waitEvent.length) {
waitEvent.forEach((event, index) => { waitEvent.forEach((event, index) => {
@ -79,6 +82,8 @@ module.exports = isFirstCheckedUpdate => {
} }
return return
} }
isFirstCheckedUpdate = false
autoUpdater.on('checking-for-update', () => { autoUpdater.on('checking-for-update', () => {
sendStatusToWindow('Checking for update...') sendStatusToWindow('Checking for update...')
}) })

View File

@ -1,12 +1,22 @@
const Store = require('electron-store') const Store = require('electron-store')
const { windowSizeList } = require('../../common/config') const { windowSizeList } = require('../../common/config')
exports.getWindowSizeInfo = () => { exports.getWindowSizeInfo = ({ windowSizeId = 1 } = {}) => {
let electronStore = new Store()
const { windowSizeId = 1 } = electronStore.get('setting') || {}
return windowSizeList.find(i => i.id === windowSizeId) || windowSizeList[0] return windowSizeList.find(i => i.id === windowSizeId) || windowSizeList[0]
} }
exports.getAppSetting = () => {
let electronStore = new Store()
const defaultSetting = {
windowSizeId: 1,
tray: {
isShow: false,
isToTray: false,
},
}
return Object.assign(defaultSetting, electronStore.get('setting') || {})
}
exports.parseEnv = () => { exports.parseEnv = () => {
const params = {} const params = {}
const rx = /^-\w+/ const rx = /^-\w+/

View File

@ -119,7 +119,9 @@ export default {
rendererSend('max') rendererSend('max')
}, },
close() { close() {
rendererSend('close') rendererSend('close', {
isToTray: this.setting.tray.isToTray,
})
}, },
}, },
} }

View File

@ -18,6 +18,8 @@
"basic_window_size_medium": "中", "basic_window_size_medium": "中",
"basic_window_size_big": "大", "basic_window_size_big": "大",
"basic_window_size_larger": "较大", "basic_window_size_larger": "较大",
"basic_to_tray_title": "关闭时不退出软件将其最小化到系统托盘",
"basic_to_tray": "关闭时最小化到系统托盘",
"basic_lang_title": "软件显示的语言", "basic_lang_title": "软件显示的语言",
"basic_lang": "语言", "basic_lang": "语言",

View File

@ -18,6 +18,8 @@
"basic_window_size_medium": "中", "basic_window_size_medium": "中",
"basic_window_size_big": "大", "basic_window_size_big": "大",
"basic_window_size_larger": "較大", "basic_window_size_larger": "較大",
"basic_to_tray_title": "關閉時不退出軟件將其最小化到系統托盤",
"basic_to_tray": "關閉時最小化到系統托盤",
"basic_lang_title": "軟件顯示的語言", "basic_lang_title": "軟件顯示的語言",
"basic_lang": "語言", "basic_lang": "語言",
"play": "播放設置", "play": "播放設置",

View File

@ -1,120 +1,122 @@
{ {
"basic": "General", "basic": "General",
"basic_theme": "Theme", "basic_theme": "Theme",
"basic_animation_title": "Animation effect of the pop-up layer", "basic_animation_title": "Animation effect of the pop-up layer",
"basic_animation": "Random pop-up animation", "basic_animation": "Random pop-up animation",
"basic_source_title": "Choose a music source", "basic_source_title": "Choose a music source",
"basic_source_test": "Test API (Available for most software features)", "basic_source_test": "Test API (Available for most software features)",
"basic_source_temp": "Temporary API (some features not available; workaround if Test API unavailable)", "basic_source_temp": "Temporary API (some features not available; workaround if Test API unavailable)",
"basic_source": "Music source", "basic_source": "Music source",
"basic_sourcename_title": "Select the name of music source", "basic_sourcename_title": "Select the name of music source",
"basic_sourcename_real": "Original", "basic_sourcename_real": "Original",
"basic_sourcename_alias": "Aliases", "basic_sourcename_alias": "Aliases",
"basic_sourcename": "Source name", "basic_sourcename": "Source name",
"basic_window_size_title": "Set the window size", "basic_window_size_title": "Set the window size",
"basic_window_size": "Window size", "basic_window_size": "Window size",
"basic_window_size_smaller": "Smaller", "basic_window_size_smaller": "Smaller",
"basic_window_size_small": "Small", "basic_window_size_small": "Small",
"basic_window_size_medium": "Medium", "basic_window_size_medium": "Medium",
"basic_window_size_big": "Large", "basic_window_size_big": "Large",
"basic_window_size_larger": "Larger", "basic_window_size_larger": "Larger",
"basic_lang_title": "The language displayed in the software", "basic_to_tray_title": "Minimize it to the system tray without closing the software when closing",
"basic_lang": "Language", "basic_to_tray": "Minimize to system tray when closing",
"basic_lang_title": "The language displayed in the software",
"play": "Play", "basic_lang": "Language",
"play_toggle_title": "If none selected, it stopped when the music playing is done.",
"play_toggle": "Playback mode", "play": "Play",
"play_toggle_list_loop": "Playlist repeat", "play_toggle_title": "If none selected, it stopped when the music playing is done.",
"play_toggle_random": "Playlist shuffle", "play_toggle": "Playback mode",
"play_toggle_list": "Play in order", "play_toggle_list_loop": "Playlist repeat",
"play_toggle_single_loop": "Single repeat", "play_toggle_random": "Playlist shuffle",
"play_quality_title": "The 320k quality is preferred for playing", "play_toggle_list": "Play in order",
"play_quality": "Prefer High Quality 320k", "play_toggle_single_loop": "Single repeat",
"play_task_bar_title": "Show playing progress on the taskbar", "play_quality_title": "The 320k quality is preferred for playing",
"play_task_bar": "Taskbar play progress bar", "play_quality": "Prefer High Quality 320k",
"play_mediaDevice_title": "Select a media device for audio output", "play_task_bar_title": "Show playing progress on the taskbar",
"play_mediaDevice": "Audio output", "play_task_bar": "Taskbar play progress bar",
"play_mediaDevice_refresh_btn_title": "Refresh audio device list", "play_mediaDevice_title": "Select a media device for audio output",
"play_mediaDevice_refresh_btn": "Refresh", "play_mediaDevice": "Audio output",
"play_mediaDevice_refresh_btn_title": "Refresh audio device list",
"search": "Search", "play_mediaDevice_refresh_btn": "Refresh",
"search_hot_title": "Select whether to show popular searches",
"search_hot": "Top Searches", "search": "Search",
"search_history_title": "Select whether to show search history", "search_hot_title": "Select whether to show popular searches",
"search_history": "Search history", "search_hot": "Top Searches",
"search_history_title": "Select whether to show search history",
"list": "List", "search_history": "Search history",
"list_source_title": "Select whether to show music source",
"list_source": "Select whether to show music source (for Your Library only)", "list": "List",
"list_scroll_title": "Select whether to remember the playlist scrollbar position", "list_source_title": "Select whether to show music source",
"list_scroll": "Remember playlist scrolling position (for Your library only)", "list_source": "Select whether to show music source (for Your Library only)",
"list_scroll_title": "Select whether to remember the playlist scrollbar position",
"download": "Download", "list_scroll": "Remember playlist scrolling position (for Your library only)",
"download_path_title": "Define the path to downloading",
"download_path": "Download path", "download": "Download",
"download_path_label": "Current:", "download_path_title": "Define the path to downloading",
"download_path_open_label": "Click to open this path", "download_path": "Download path",
"download_path_change_btn": "Change", "download_path_label": "Current:",
"download_name_title": "Select the music naming method for downloading", "download_path_open_label": "Click to open this path",
"download_name": "Music file naming", "download_path_change_btn": "Change",
"download_embed_pic_title": "Select whether to embed the cover into the music file", "download_name_title": "Select the music naming method for downloading",
"download_embed_pic": "Embedding cover (supports MP3 format only)", "download_name": "Music file naming",
"download_lyric_title": "Select whether to download the lyrics file", "download_embed_pic_title": "Select whether to embed the cover into the music file",
"download_lyric": "Lyrics download", "download_embed_pic": "Embedding cover (supports MP3 format only)",
"download_name1": "Title - Artist", "download_lyric_title": "Select whether to download the lyrics file",
"download_name2": "Artist - Title", "download_lyric": "Lyrics download",
"download_name3": "Title only", "download_name1": "Title - Artist",
"download_select_save_path": "Select the save path", "download_name2": "Artist - Title",
"download_name3": "Title only",
"network": "Network", "download_select_save_path": "Select the save path",
"network_proxy_title": "Proxy (False setting would block Internet connections)",
"network_proxy_host": "Host", "network": "Network",
"network_proxy_port": "Port", "network_proxy_title": "Proxy (False setting would block Internet connections)",
"network_proxy_username": "Username", "network_proxy_host": "Host",
"network_proxy_password": "Password", "network_proxy_port": "Port",
"network_proxy_username": "Username",
"odc": "Auto clear", "network_proxy_password": "Password",
"odc_clear_search_input": "Clear the search box when you are not searching",
"odc_clear_search_list": "Clear the search list when you are not searching", "odc": "Auto clear",
"odc_clear_search_input": "Clear the search box when you are not searching",
"backup": "Backup and restore", "odc_clear_search_list": "Clear the search list when you are not searching",
"backup_part": "Partially",
"backup_part_import_list": "Import lists", "backup": "Backup and restore",
"backup_part_export_list": "Export lists", "backup_part": "Partially",
"backup_part_import_setting": "Import settings", "backup_part_import_list": "Import lists",
"backup_part_export_setting": "Export settings", "backup_part_export_list": "Export lists",
"backup_all": "All (Settings and Recently Played)", "backup_part_import_setting": "Import settings",
"backup_all_import": "Import", "backup_part_export_setting": "Export settings",
"backup_all_export": "Export", "backup_all": "All (Settings and Recently Played)",
"backup_all_import_desc": "Select a backup file", "backup_all_import": "Import",
"backup_all_export_desc": "Select the backup to...", "backup_all_export": "Export",
"backup_part_import_setting_desc": "Select the Settings file", "backup_all_import_desc": "Select a backup file",
"backup_part_export_setting_desc": "Save the list to...", "backup_all_export_desc": "Select the backup to...",
"backup_part_import_list_desc": "Select a list backup", "backup_part_import_setting_desc": "Select the Settings file",
"backup_part_export_list_desc": "Save the list to...", "backup_part_export_setting_desc": "Save the list to...",
"backup_part_import_list_desc": "Select a list backup",
"other": "Extras", "backup_part_export_list_desc": "Save the list to...",
"other_cache": "Cache size (Not recommended since resources such as pictures after the cache is cleaned need re-downloading. The software will dynamically manage the cache size based on disk space)",
"other_cache_label": "Cache size used:", "other": "Extras",
"other_cache_label_title": "Currently used cache size", "other_cache": "Cache size (Not recommended since resources such as pictures after the cache is cleaned need re-downloading. The software will dynamically manage the cache size based on disk space)",
"other_cache_clear_btn": "Clear cache", "other_cache_label": "Cache size used:",
"other_cache_label_title": "Currently used cache size",
"update": "Update", "other_cache_clear_btn": "Clear cache",
"update_latest_label": "Latest version: ",
"update_unknown": "Unknown", "update": "Update",
"update_current_label": "Current version: ", "update_latest_label": "Latest version: ",
"update_downloading": "Update is found and being downloaded...⏳", "update_unknown": "Unknown",
"update_progress": "Download progress: ", "update_current_label": "Current version: ",
"update_latest": "The software is up-to-date, enjoy yourself!🥂", "update_downloading": "Update is found and being downloaded...⏳",
"update_open_version_modal_btn": "Open the update window🚀", "update_progress": "Download progress: ",
"update_checking": "Checking for updates...", "update_latest": "The software is up-to-date, enjoy yourself!🥂",
"update_init": "Initializing update...", "update_open_version_modal_btn": "Open the update window🚀",
"update_checking": "Checking for updates...",
"about": "About lx-music-desktop", "update_init": "Initializing update...",
"about": "About lx-music-desktop",
"is_enable": "Enabled",
"is_show": "Showed",
"click_open": "Click to open", "is_enable": "Enabled",
"click_copy": "Click to copy" "is_show": "Showed",
} "click_open": "Click to open",
"click_copy": "Click to copy"
}

View File

@ -177,7 +177,7 @@ export const isChildren = (parent, children) => {
* @param {*} setting * @param {*} setting
*/ */
export const updateSetting = (setting, version) => { export const updateSetting = (setting, version) => {
const defaultVersion = '1.0.19' const defaultVersion = '1.0.22'
if (!version) { if (!version) {
if (setting) { if (setting) {
version = setting.version version = setting.version
@ -238,6 +238,10 @@ export const updateSetting = (setting, version) => {
password: '', password: '',
}, },
}, },
tray: {
isShow: false,
isToTray: false,
},
windowSizeId: 2, windowSizeId: 2,
themeId: 0, themeId: 0,
langId: 'cns', langId: 'cns',
@ -264,6 +268,7 @@ export const updateSetting = (setting, version) => {
setting = defaultSetting setting = defaultSetting
} }
if (setting.apiSource != 'temp') setting.apiSource = 'test' // 强制设置回 test 接口源 if (setting.apiSource != 'temp') setting.apiSource = 'test' // 强制设置回 test 接口源
return { setting, version: defaultVersion } return { setting, version: defaultVersion }
} }

View File

@ -28,6 +28,11 @@ div.scroll(:class="$style.setting")
material-checkbox(v-for="(item, index) in windowSizeList" :id="`setting_window_size_${item.id}`" name="setting_window_size" @change="handleWindowSizeChange" :class="$style.gapLeft" material-checkbox(v-for="(item, index) in windowSizeList" :id="`setting_window_size_${item.id}`" name="setting_window_size" @change="handleWindowSizeChange" :class="$style.gapLeft"
need v-model="current_setting.windowSizeId" :value="item.id" :label="$t('view.setting.basic_window_size_' + item.name)" :key="item.id") need v-model="current_setting.windowSizeId" :value="item.id" :label="$t('view.setting.basic_window_size_' + item.name)" :key="item.id")
dd(:title="$t('view.setting.basic_to_tray_title')")
h3 {{$t('view.setting.basic_to_tray')}}
div
material-checkbox(id="setting_to_tray" v-model="current_setting.tray.isToTray" @change="handleToTrayChange" :label="$t('view.setting.is_enable')")
dd(:title="$t('view.setting.basic_lang_title')") dd(:title="$t('view.setting.basic_lang_title')")
h3 {{$t('view.setting.basic_lang')}} h3 {{$t('view.setting.basic_lang')}}
div div
@ -361,7 +366,11 @@ export default {
themeId: 0, themeId: 0,
sourceId: 0, sourceId: 0,
randomAnimate: true, randomAnimate: true,
apiSource: 'messoer', tray: {
isShow: false,
isToTray: false,
},
apiSource: 'temp',
}, },
languageList, languageList,
cacheSize: '0 B', cacheSize: '0 B',
@ -612,6 +621,10 @@ export default {
handleMediaDeviceChange(audioDevice) { handleMediaDeviceChange(audioDevice) {
this.setMediaDeviceId(audioDevice.deviceId) this.setMediaDeviceId(audioDevice.deviceId)
}, },
handleToTrayChange(isToTray) {
this.current_setting.tray.isShow = isToTray
rendererSend('changeTray', { action: isToTray ? 'create' : 'destroy' })
},
}, },
} }
</script> </script>

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB