feat: Add monochrome tray icons

This commit is contained in:
Alex Jbanca 2024-05-15 16:55:54 +03:00 committed by Alex Jbanca
parent 03712af3b9
commit 292c74b189
4 changed files with 62 additions and 43 deletions

View File

@ -0,0 +1,46 @@
import Qt.labs.platform 1.1
import utils 1.0
SystemTrayIcon {
id: root
property bool isProduction: true
signal activateApp()
visible: true
icon.source: Qt.platform.os === Constants.windows // TODO: Add status-logo-white with stroke for windows
? Style.png("status-logo%1".arg(root.isProduction ? "" : "-dev-circle"))
: Style.svg("status-logo-white")
icon.mask: Qt.platform.os !== Constants.windows
onMessageClicked: {
if (Qt.platform.os === Constants.windows) {
root.activateApp()
}
}
menu: Menu {
MenuItem {
text: qsTr("Open Status")
onTriggered: {
root.activateApp()
}
}
MenuSeparator {
}
MenuItem {
text: qsTr("Quit")
onTriggered: Qt.quit()
}
}
onActivated: {
if (reason !== SystemTrayIcon.Context) {
root.activateApp()
}
}
}

View File

@ -1,3 +1,4 @@
AppMain 1.0 AppMain.qml AppMain 1.0 AppMain.qml
SplashScreen 1.0 SplashScreen.qml SplashScreen 1.0 SplashScreen.qml
Popups 1.0 Popups.qml Popups 1.0 Popups.qml
StatusTrayIcon 1.0 StatusTrayIcon.qml

View File

@ -0,0 +1,10 @@
<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
<g clip-path="url(#clip0_7558_1933)">
<path fill-rule="evenodd" clip-rule="evenodd" d="M2 16C2 5.5 5.5 2 16 2C26.5 2 30 5.5 30 16C30 26.5 26.5 30 16 30C5.5 30 2 26.5 2 16ZM12.8076 15.2453C13.0356 12.3901 15.0857 9.86618 17.8624 9.70744C19.5673 9.61021 21.2702 10.6513 21.3622 12.3418C21.4368 13.7023 20.5917 14.6951 19.1227 15.076C18.7757 15.167 18.4201 15.2224 18.0616 15.2414C17.281 15.2854 16.6463 15.2178 16.0116 15.1502H16.0116L16.0116 15.1502C15.3776 15.0827 14.7436 15.0152 13.964 15.0588C13.604 15.0771 13.2468 15.1309 12.8976 15.2196C12.8836 15.2239 12.8681 15.2282 12.8526 15.2324L12.8525 15.2325C12.837 15.2368 12.8216 15.2411 12.8076 15.2453ZM19.1994 16.7545C18.9714 19.6098 16.9213 22.1337 14.1446 22.2924C12.4397 22.3897 10.7368 21.3486 10.6448 19.6581C10.5735 18.2976 11.4153 17.3048 12.8843 16.9245C13.2313 16.8335 13.5869 16.7781 13.9453 16.7592C14.725 16.7152 15.359 16.7825 15.9929 16.8499C16.6277 16.9173 17.2623 16.9847 18.043 16.9404C18.403 16.9221 18.7602 16.8683 19.1094 16.7797L19.1425 16.7706L19.1426 16.7705C19.1619 16.7653 19.1818 16.7599 19.1994 16.7545Z" fill="white"/>
</g>
<defs>
<clipPath id="clip0_7558_1933">
<rect width="28" height="28" fill="white" transform="translate(2 2)"/>
</clipPath>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@ -295,50 +295,12 @@ StatusWindow {
applicationWindow.requestActivate() applicationWindow.requestActivate()
} }
SystemTrayIcon { StatusTrayIcon {
id: systemTray id: systemTray
visible: true objectName: "systemTray"
icon.source: { isProduction: production
if (production) { onActivateApp: {
if (Qt.platform.os == Constants.mac) applicationWindow.makeStatusAppActive()
return "imports/assets/png/status-logo-round-rect.png"
else
return "imports/assets/png/status-logo-circle.png"
} else {
if (Qt.platform.os == Constants.mac)
return "imports/assets/png/status-logo-dev-round-rect.png"
else
return "imports/assets/png/status-logo-dev-circle.png"
}
}
onMessageClicked: {
if (Qt.platform.os === Constants.windows) {
applicationWindow.makeStatusAppActive()
}
}
menu: Menu {
MenuItem {
text: qsTr("Open Status")
onTriggered: {
applicationWindow.makeStatusAppActive()
}
}
MenuSeparator {
}
MenuItem {
text: qsTr("Quit")
onTriggered: Qt.quit()
}
}
onActivated: {
if (reason !== SystemTrayIcon.Context) {
applicationWindow.makeStatusAppActive()
}
} }
} }