🐛 Fix: isDarkMode() error when dragging file to tray icon

ISSUES CLOSED: #1107
This commit is contained in:
PiEgg
2023-04-12 19:02:53 +08:00
parent f75514d05d
commit b7d2edbe23
+5 -4
View File
@@ -5,8 +5,8 @@ import {
Tray,
dialog,
clipboard,
systemPreferences,
Notification
Notification,
nativeTheme
} from 'electron'
import uploader from 'apis/app/uploader'
import db, { GalleryDB } from '~/main/apis/core/datastore'
@@ -205,7 +205,7 @@ export function createTray () {
})
tray.on('drag-enter', () => {
if (systemPreferences.isDarkMode()) {
if (nativeTheme.shouldUseDarkColors) {
tray!.setImage(`${__static}/upload-dark.png`)
} else {
tray!.setImage(`${__static}/upload.png`)
@@ -213,7 +213,8 @@ export function createTray () {
})
tray.on('drag-end', () => {
tray!.setImage(`${__static}/menubar.png`)
const menubarPic = getTrayIcon()
tray!.setImage(menubarPic)
})
// drop-files only be supported in macOS