GODT-1475: Change systray icons

This commit is contained in:
Jakub
2022-06-03 15:09:59 +02:00
parent 4edf2eb92c
commit 69d1789a03
13 changed files with 598 additions and 19 deletions

View File

@ -155,9 +155,9 @@ QtObject {
property SystemTrayIcon _trayIcon: SystemTrayIcon {
id: trayIcon
visible: true
icon.source: "./icons/systray-mono.png"
icon.source: getTrayIconPath()
icon.mask: true // make sure that systems like macOS will use proper color
tooltip: `Proton Mail Bridge v${backend.version}`
tooltip: `${root.title} v${backend.version}`
onActivated: {
function calcStatusWindowPosition() {
// On some platforms (X11 / Plasma) Qt does not provide icon position and geometry info.
@ -223,6 +223,31 @@ QtObject {
break;
}
}
property NotificationFilter _systrayfilter: NotificationFilter {
source: root._notifications ? root._notifications.all : undefined
}
function getTrayIconPath() {
var color = backend.goos == "darwin" ? "mono" : "color"
var level = "norm"
if (_systrayfilter.topmost) {
switch (_systrayfilter.topmost.type) {
case Notification.NotificationType.Danger:
level = "error"
break;
case Notification.NotificationType.Warning:
level = "warn"
break;
case Notification.NotificationType.Info:
level = "update"
break;
}
}
return `./icons/systray-${color}-${level}.png`
}
}
Component.onCompleted: {