mirror of
https://github.com/tuxdotrs/tpanel.git
synced 2026-09-19 18:19:02 +05:30
refactor(theme): centralize theme
This commit is contained in:
@@ -11,18 +11,18 @@ Rectangle {
|
||||
property real maxValue: 100
|
||||
readonly property bool shouldVisualize: barCount > 0 && Cava.values.some(v => v >= 0.001)
|
||||
|
||||
implicitWidth: 96
|
||||
implicitHeight: 32
|
||||
radius: Appearance.radius
|
||||
color: Appearance.colors.inActive
|
||||
implicitWidth: Theme.cava.width
|
||||
implicitHeight: Theme.cava.height
|
||||
radius: Theme.radius
|
||||
color: Theme.colors.inActive
|
||||
visible: shouldVisualize
|
||||
|
||||
Row {
|
||||
id: barRow
|
||||
|
||||
anchors.fill: parent
|
||||
anchors.margins: 8
|
||||
spacing: 3
|
||||
anchors.margins: Theme.cava.innerMargin
|
||||
spacing: Theme.cava.barSpacing
|
||||
|
||||
Repeater {
|
||||
model: root.barCount
|
||||
@@ -34,15 +34,15 @@ Rectangle {
|
||||
readonly property real value: Cava.values[index] ?? 0
|
||||
|
||||
width: (barRow.width - barRow.spacing * (root.barCount - 1)) / root.barCount
|
||||
height: Math.max(2, (bar.value / root.maxValue) * barRow.height)
|
||||
height: Math.max(Theme.cava.barMinHeight, (bar.value / root.maxValue) * barRow.height)
|
||||
anchors.bottom: parent.bottom
|
||||
radius: bar.width / 2
|
||||
color: Appearance.colors.accent
|
||||
color: Theme.colors.accent
|
||||
antialiasing: true
|
||||
|
||||
Behavior on height {
|
||||
NumberAnimation {
|
||||
duration: Appearance.duration
|
||||
duration: Theme.duration
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,14 +8,12 @@ import qs.ui
|
||||
BarButton {
|
||||
id: root
|
||||
|
||||
property int iconSize: 16
|
||||
|
||||
hoverHighlight: false
|
||||
pointerCursor: false
|
||||
visible: SystemTray.items.values.length > 0
|
||||
|
||||
contentItem: Row {
|
||||
spacing: Appearance.spacing
|
||||
spacing: Theme.spacing
|
||||
|
||||
Repeater {
|
||||
model: SystemTray.items.values
|
||||
@@ -24,8 +22,8 @@ BarButton {
|
||||
required property var modelData
|
||||
|
||||
source: modelData.icon
|
||||
width: root.iconSize
|
||||
height: root.iconSize
|
||||
width: Theme.tray.iconSize
|
||||
height: Theme.tray.iconSize
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ Row {
|
||||
|
||||
property int count: 7
|
||||
|
||||
spacing: Appearance.spacing
|
||||
spacing: Theme.spacing
|
||||
|
||||
Repeater {
|
||||
model: root.count
|
||||
@@ -21,15 +21,15 @@ Row {
|
||||
property var ws: Hyprland.workspaces.values.find(w => w.id === pill.index + 1)
|
||||
property bool isActive: Hyprland.focusedWorkspace?.id === (pill.index + 1)
|
||||
|
||||
radius: 1000
|
||||
implicitHeight: 15
|
||||
implicitWidth: pill.isActive ? pill.implicitHeight * 2.3 : pill.implicitHeight
|
||||
radius: Theme.workspaces.radius
|
||||
implicitHeight: Theme.workspaces.height
|
||||
implicitWidth: pill.isActive ? pill.implicitHeight * Theme.workspaces.activeWidthRatio : pill.implicitHeight
|
||||
color: {
|
||||
if (handler.hovered)
|
||||
return Appearance.colors.accent;
|
||||
return Theme.colors.accent;
|
||||
if (pill.isActive || pill.ws)
|
||||
return Appearance.colors.accent;
|
||||
return Appearance.colors.inActive;
|
||||
return Theme.colors.accent;
|
||||
return Theme.colors.inActive;
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
@@ -45,13 +45,13 @@ Row {
|
||||
|
||||
Behavior on color {
|
||||
ColorAnimation {
|
||||
duration: Appearance.duration
|
||||
duration: Theme.duration
|
||||
}
|
||||
}
|
||||
|
||||
Behavior on implicitWidth {
|
||||
NumberAnimation {
|
||||
duration: Appearance.duration
|
||||
duration: Theme.duration
|
||||
easing.type: Easing.OutQuad
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,12 +26,12 @@ Rectangle {
|
||||
readonly property url themedIconUrl: iconName !== "" ? Quickshell.iconPath(iconName, false) : ""
|
||||
readonly property url iconUrl: `${Quickshell.shellPath("assets")}/icons/notification.svg`
|
||||
|
||||
implicitWidth: 360
|
||||
implicitHeight: content.implicitHeight + Appearance.padding * 2
|
||||
radius: Appearance.radius
|
||||
color: Appearance.colors.background
|
||||
border.width: critical ? 1 : 0
|
||||
border.color: Appearance.colors.accent
|
||||
implicitWidth: Theme.notification.width
|
||||
implicitHeight: content.implicitHeight + Theme.padding * 2
|
||||
radius: Theme.radius
|
||||
color: Theme.colors.background
|
||||
border.width: critical ? Theme.notification.borderWidth : 0
|
||||
border.color: Theme.colors.accent
|
||||
|
||||
Timer {
|
||||
id: countdown
|
||||
@@ -52,12 +52,12 @@ Rectangle {
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.top: parent.top
|
||||
anchors.margins: Appearance.padding
|
||||
spacing: Appearance.spacing
|
||||
anchors.margins: Theme.padding
|
||||
spacing: Theme.spacing
|
||||
|
||||
Item {
|
||||
width: 40
|
||||
height: 40
|
||||
width: Theme.notification.iconSize
|
||||
height: Theme.notification.iconSize
|
||||
Layout.alignment: Qt.AlignTop
|
||||
|
||||
Image {
|
||||
@@ -77,23 +77,23 @@ Rectangle {
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
spacing: 2
|
||||
spacing: Theme.notification.textSpacing
|
||||
Layout.fillWidth: true
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
|
||||
Text {
|
||||
text: root.notif?.appName ?? ""
|
||||
color: Appearance.colors.accent
|
||||
font.family: Appearance.font.family
|
||||
font.pointSize: Appearance.font.pointSize - 2
|
||||
color: Theme.colors.accent
|
||||
font.family: Theme.font.family
|
||||
font.pointSize: Theme.font.caption
|
||||
elide: Text.ElideRight
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
Text {
|
||||
text: root.notif?.summary ?? ""
|
||||
color: Appearance.colors.foreground
|
||||
font.family: Appearance.font.family
|
||||
font.pointSize: Appearance.font.pointSize
|
||||
color: Theme.colors.foreground
|
||||
font.family: Theme.font.family
|
||||
font.pointSize: Theme.font.pointSize
|
||||
font.weight: Font.DemiBold
|
||||
elide: Text.ElideRight
|
||||
Layout.fillWidth: true
|
||||
@@ -101,10 +101,10 @@ Rectangle {
|
||||
Text {
|
||||
text: root.notif?.body ?? ""
|
||||
visible: text !== ""
|
||||
color: Appearance.colors.foreground
|
||||
opacity: 0.8
|
||||
font.family: Appearance.font.family
|
||||
font.pointSize: Appearance.font.pointSize - 1
|
||||
color: Theme.colors.foreground
|
||||
opacity: Theme.notification.bodyOpacity
|
||||
font.family: Theme.font.family
|
||||
font.pointSize: Theme.font.body
|
||||
wrapMode: Text.Wrap
|
||||
maximumLineCount: 3
|
||||
elide: Text.ElideRight
|
||||
|
||||
Reference in New Issue
Block a user