新增托盘图标颜色 跟随系统亮暗模式 设置,可以在 设置-其他 启用 (#2016)

This commit is contained in:
lyswhut
2024-08-30 20:21:18 +08:00
parent af8d9dff2d
commit 061cc16c27
7 changed files with 18 additions and 26 deletions
+2
View File
@@ -80,3 +80,5 @@ export const DOWNLOAD_STATUS = {
} as const
export const QUALITYS = ['flac24bit', 'flac', 'wav', 'ape', '320k', '192k', '128k'] as const
export const TRAY_AUTO_ID = -1
+1
View File
@@ -500,6 +500,7 @@
"setting__other_resource_cache_tip": "Picture, audio, and other caches. After cleaning, resources such as pictures will need to be downloaded again. It is not recommended to clean up. The software will dynamically manage the cache size according to the disk space.",
"setting__other_resource_cache_tip_confirm": "Involving the cache of pictures, audios, etc., the pictures and other resources will need to be downloaded again after cleaning. It is not recommended to clean up. The software will dynamically manage the cache size according to the disk space. Do you still need to clean up?",
"setting__other_tray_theme": "Tray Icon Style",
"setting__other_tray_theme_auto": "Follow the system light and dark themes",
"setting__other_tray_theme_black": "Black Color",
"setting__other_tray_theme_native": "White",
"setting__other_tray_theme_origin": "Primary Color",
+1
View File
@@ -500,6 +500,7 @@
"setting__other_resource_cache_tip": "图片、音频等缓存,清理后图片等资源将需要重新下载,不建议清理,软件会根据磁盘空间动态管理缓存大小",
"setting__other_resource_cache_tip_confirm": "涉及图片、音频等缓存,清理后图片等资源将需要重新下载,不建议清理,软件会根据磁盘空间动态管理缓存大小,是否仍要清理?",
"setting__other_tray_theme": "托盘图标样式",
"setting__other_tray_theme_auto": "跟随系统亮暗主题",
"setting__other_tray_theme_black": "黑色",
"setting__other_tray_theme_native": "白色",
"setting__other_tray_theme_origin": "原色",
+1
View File
@@ -500,6 +500,7 @@
"setting__other_resource_cache_tip": "圖片、音訊等緩存,清理後圖片等資源將需要重新下載,不建議清理,軟體會根據磁碟空間動態管理快取大小",
"setting__other_resource_cache_tip_confirm": "涉及圖片、音訊等緩存,清理後圖片等資源將需要重新下載,不建議清理,軟體會根據磁碟空間動態管理快取大小,是否仍要清理?",
"setting__other_tray_theme": "托盤圖示樣式",
"setting__other_tray_theme_auto": "跟隨系統亮暗主題",
"setting__other_tray_theme_black": "黑色",
"setting__other_tray_theme_native": "白色",
"setting__other_tray_theme_origin": "原色",
+10 -1
View File
@@ -9,6 +9,7 @@ import {
showWindow as showMainWindow,
} from './winMain'
import { quitApp } from '@main/app'
import { TRAY_AUTO_ID } from '@common/constants'
let tray: Electron.Tray | null
let isEnableTray: boolean = false
@@ -132,7 +133,10 @@ const i18n = {
}
const getIconPath = (id: number) => {
let theme = themeList.find(item => item.id === id) ?? themeList[0]
let theme = id == TRAY_AUTO_ID
? global.lx.theme.shouldUseDarkColors
? themeList[0] : themeList[2]
: themeList.find(item => item.id === id) ?? themeList[0]
return path.join(global.staticPath, 'images/tray', theme.fileName + (isWin ? '.ico' : '.png'))
}
@@ -372,6 +376,11 @@ export default () => {
init()
})
global.lx.event_app.on('system_theme_change', () => {
if (global.lx.appSetting['tray.themeId'] != TRAY_AUTO_ID) return
setTrayImage(global.lx.appSetting['tray.themeId'])
})
global.lx.event_app.on('player_status', (status) => {
let updated = false
if (status.status) {
@@ -77,6 +77,7 @@ import { appSetting, updateSetting } from '@renderer/store/setting'
import { overwriteListFull } from '@renderer/store/list/listManage'
import { dislikeRuleCount } from '@renderer/store/dislikeList'
import DislikeListModal from './DislikeListModal.vue'
import { TRAY_AUTO_ID } from '@common/constants'
export default {
name: 'SettingOther',
@@ -91,6 +92,7 @@ export default {
{ id: 0, name: 'native', label: t('setting__other_tray_theme_native') },
{ id: 2, name: 'black', label: t('setting__other_tray_theme_black') },
{ id: 1, name: 'origin', label: t('setting__other_tray_theme_origin') },
{ id: TRAY_AUTO_ID, name: 'auto', label: t('setting__other_tray_theme_auto') },
]
})