mirror of
https://gh.catmak.name/https://github.com/mihomo-party-org/mihomo-party
synced 2025-12-27 13:10:30 +08:00
adjust style
This commit is contained in:
parent
9b081a5adb
commit
c2bd36ff7a
@ -1,6 +1,6 @@
|
|||||||
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.png?asset'
|
import templateIcon 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'
|
||||||
@ -189,21 +189,23 @@ const mihomoTraffic = async (): Promise<void> => {
|
|||||||
mihomoTrafficWs.onmessage = (e): void => {
|
mihomoTrafficWs.onmessage = (e): void => {
|
||||||
const data = e.data as string
|
const data = e.data as string
|
||||||
const json = JSON.parse(data) as IMihomoTrafficInfo
|
const json = JSON.parse(data) as IMihomoTrafficInfo
|
||||||
if (showTraffic) {
|
if (process.platform === 'darwin') {
|
||||||
const svgContent = `
|
if (showTraffic) {
|
||||||
|
const svgContent = `
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 125 36">
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 125 36">
|
||||||
<image height='36' width='36' href='data:image/png;base64,${base64}'/>
|
<image height='36' width='36' href='data:image/png;base64,${base64}'/>
|
||||||
<text x='40' y='15' font-size='15' font-family='system-ui'>↑ ${calcTraffic(json.up)}/s</text>
|
<text x='40' y='15' font-size='15' font-family='system-ui'>↑ ${calcTraffic(json.up)}/s</text>
|
||||||
<text x='40' y='32' font-size='15' font-family='system-ui'>↓ ${calcTraffic(json.down)}/s</text>
|
<text x='40' y='32' font-size='15' font-family='system-ui'>↓ ${calcTraffic(json.down)}/s</text>
|
||||||
</svg>`
|
</svg>`
|
||||||
svg2img(svgContent, {}, (error, buffer) => {
|
svg2img(svgContent, {}, (error, buffer) => {
|
||||||
if (error) return
|
if (error) return
|
||||||
const image = nativeImage.createFromBuffer(buffer).resize({ height: 16 })
|
const image = nativeImage.createFromBuffer(buffer).resize({ height: 16 })
|
||||||
image.setTemplateImage(true)
|
image.setTemplateImage(true)
|
||||||
tray?.setImage(image)
|
tray?.setImage(image)
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
tray?.setImage(icon)
|
tray?.setImage(icon)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (process.platform !== 'linux') {
|
if (process.platform !== 'linux') {
|
||||||
tray?.setToolTip(
|
tray?.setToolTip(
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user