made the pill again but better

This commit is contained in:
2026-06-14 16:21:49 +01:00
parent a8a69c116f
commit 23407ea36b
5 changed files with 71 additions and 37 deletions

View File

@@ -48,7 +48,7 @@ Scope {
Item { Item {
anchors { anchors {
fill: parent fill: parent
topMargin: 2 topMargin: 3
} }
Row { Row {

View File

@@ -22,6 +22,12 @@ Container {
State { State {
name: "" name: ""
PropertyChanges {
centerPill.boxHeight: 28
centerPill.boxRadius: 9
centerPill.boxWidth: 100
}
StateChangeScript { StateChangeScript {
script: { script: {
if (centerPill.previousState != "hovered") { if (centerPill.previousState != "hovered") {
@@ -36,6 +42,7 @@ Container {
PropertyChanges { PropertyChanges {
centerPill.boxHeight: 35 centerPill.boxHeight: 35
centerPill.boxRadius: 15
centerPill.boxWidth: 110 centerPill.boxWidth: 110
} }
@@ -86,19 +93,48 @@ Container {
Component { Component {
id: fullTime id: fullTime
Column { Item {
Layout.alignment: Qt.AlignCenter Rectangle {
spacing: 5 anchors.fill: parent
radius: 30
Item { gradient: Gradient {
CenteredText { GradientStop {
text: Time.time color: "transparent"
position: 0.0
}
GradientStop {
color: "transparent"
position: 0.6
}
GradientStop {
color: Colors.red
position: 1.0
}
} }
} }
Item { Column {
CenteredText { anchors.centerIn: parent
spacing: 5
StyledText {
anchors.horizontalCenter: parent.horizontalCenter
font.pointSize: 30
text: Time.time
}
StyledText {
anchors.horizontalCenter: parent.horizontalCenter
color: Colors.surface0
text: Time.date text: Time.date
font {
pointSize: 9
weight: 400
}
} }
} }
} }

View File

@@ -1,14 +1,7 @@
import QtQuick import QtQuick
import "../Color.js" as Colors import "../Color.js" as Colors
Text { StyledText {
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
color: Colors.base
font {
family: "FiraMono Nerd Font"
pointSize: 12
weight: 600
}
} }

View File

@@ -22,7 +22,7 @@ Item {
function getVisible() { function getVisible() {
if (containerRoot.exclusiveToScreen) { if (containerRoot.exclusiveToScreen) {
if (Hyprland.focusedMonitor != containerRoot.exclusiveMonitor) { if (Hyprland.focusedMonitor != containerRoot.exclusiveMonitor) {
return -2 - containerRoot.boxHeight - 5; return -4 - containerRoot.boxHeight - 5;
} else { } else {
return 0; return 0;
} }
@@ -31,6 +31,7 @@ Item {
} }
} }
clip: true
implicitHeight: boxHeight implicitHeight: boxHeight
implicitWidth: boxWidth implicitWidth: boxWidth
@@ -44,8 +45,9 @@ Item {
} }
} }
Behavior on boxRadius { Behavior on boxRadius {
NumberAnimation { SpringAnimation {
duration: 100 damping: 0.3
spring: 4
} }
} }
Behavior on boxWidth { Behavior on boxWidth {
@@ -87,33 +89,24 @@ Item {
anchors.fill: parent anchors.fill: parent
popEnter: Transition { replaceEnter: Transition {
PropertyAnimation { PropertyAnimation {
duration: 200 duration: 100
from: 0 from: 0
property: "opacity" property: "opacity"
to: 1 to: 1
} }
}
popExit: Transition {
PropertyAnimation { PropertyAnimation {
duration: 200 duration: 100
from: 1 from: -5
property: "opacity" property: "anchors.topMargin"
to: 0 to: 0
} }
} }
pushEnter: Transition { replaceExit: Transition {
PropertyAnimation { PropertyAnimation {
duration: 200 duration: 100
from: 0
property: "opacity"
to: 1
}
}
pushExit: Transition {
PropertyAnimation {
duration: 200
from: 1 from: 1
property: "opacity" property: "opacity"
to: 0 to: 0

12
Components/StyledText.qml Normal file
View File

@@ -0,0 +1,12 @@
import QtQuick
import "../Color.js" as Colors
Text {
color: Colors.base
font {
family: "FiraMono Nerd Font"
pointSize: 12
weight: 600
}
}