mirror of
https://github.com/pompurin404/mihomo-party.git
synced 2024-11-16 19:56:10 +08:00
fix macos icon
This commit is contained in:
parent
112f456de0
commit
4104b15a64
|
@ -1,6 +1,7 @@
|
||||||
import axios, { AxiosInstance } from 'axios'
|
import axios, { AxiosInstance } from 'axios'
|
||||||
import { getAppConfig, getControledMihomoConfig } from '../config'
|
import { getAppConfig, getControledMihomoConfig } from '../config'
|
||||||
import templateIcon from '../../../resources/iconTemplate@2x.png?asset'
|
import templateIcon from '../../../resources/iconTemplate.png?asset'
|
||||||
|
import svgIcon from '../../../resources/iconTemplate@2x.png?asset'
|
||||||
import { mainWindow } from '..'
|
import { mainWindow } from '..'
|
||||||
import WebSocket from 'ws'
|
import WebSocket from 'ws'
|
||||||
import { tray } from '../resolve/tray'
|
import { tray } from '../resolve/tray'
|
||||||
|
@ -9,7 +10,7 @@ import { getRuntimeConfig } from './factory'
|
||||||
import { nativeImage } from 'electron'
|
import { nativeImage } from 'electron'
|
||||||
import parseSvg from '../utils/parseSvg'
|
import parseSvg from '../utils/parseSvg'
|
||||||
|
|
||||||
const icon = nativeImage.createFromPath(templateIcon)
|
const icon = nativeImage.createFromPath(svgIcon)
|
||||||
icon.setTemplateImage(true)
|
icon.setTemplateImage(true)
|
||||||
const base64 = icon.toPNG().toString('base64')
|
const base64 = icon.toPNG().toString('base64')
|
||||||
let hasShowTraffic = false
|
let hasShowTraffic = false
|
||||||
|
@ -211,9 +212,10 @@ const mihomoTraffic = async (): Promise<void> => {
|
||||||
hasShowTraffic = true
|
hasShowTraffic = true
|
||||||
} else {
|
} else {
|
||||||
if (hasShowTraffic) {
|
if (hasShowTraffic) {
|
||||||
hasShowTraffic = false
|
const icon = nativeImage.createFromPath(templateIcon)
|
||||||
icon.resize({ height: 16 })
|
icon.setTemplateImage(true)
|
||||||
tray?.setImage(icon)
|
tray?.setImage(icon)
|
||||||
|
hasShowTraffic = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user