forked from Shinonome/dots-hyprland
background: add weather widget
Co-Authored-By: Vague Syntax <173799252+vaguesyntax@users.noreply.github.com>
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
import QtQuick
|
||||
import qs
|
||||
import qs.services
|
||||
import qs.modules.common
|
||||
import qs.modules.common.functions
|
||||
import qs.modules.common.widgets
|
||||
import qs.modules.common.widgets.widgetCanvas
|
||||
import qs.modules.background.widgets
|
||||
|
||||
AbstractBackgroundWidget {
|
||||
id: root
|
||||
|
||||
configEntryName: "weather"
|
||||
|
||||
implicitHeight: backgroundShape.implicitHeight
|
||||
implicitWidth: backgroundShape.implicitWidth
|
||||
|
||||
StyledDropShadow {
|
||||
target: backgroundShape
|
||||
}
|
||||
|
||||
MaterialShape {
|
||||
id: backgroundShape
|
||||
anchors.fill: parent
|
||||
shape: MaterialShape.Shape.Pill
|
||||
color: Appearance.colors.colPrimaryContainer
|
||||
implicitSize: 230
|
||||
|
||||
StyledText {
|
||||
font {
|
||||
pixelSize: 84
|
||||
family: Appearance.font.family.expressive
|
||||
weight: Font.Medium
|
||||
}
|
||||
color: Appearance.colors.colPrimary
|
||||
text: Weather.data?.temp.substring(0,Weather.data?.temp.length - 1) ?? "--°"
|
||||
anchors {
|
||||
right: parent.right
|
||||
top: parent.top
|
||||
rightMargin: 26
|
||||
topMargin: 30
|
||||
}
|
||||
}
|
||||
|
||||
MaterialSymbol {
|
||||
iconSize: 84
|
||||
color: Appearance.colors.colOnPrimaryContainer
|
||||
text: Icons.getWeatherIcon(Weather.data.wCode) ?? "cloud"
|
||||
anchors {
|
||||
left: parent.left
|
||||
bottom: parent.bottom
|
||||
|
||||
leftMargin: 26
|
||||
bottomMargin: 30
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user