battery stuff and fixed the weird workspace nonsense
This commit is contained in:
@@ -1,8 +1,46 @@
|
||||
import Quickshell
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import Quickshell.Services.UPower
|
||||
|
||||
Item {
|
||||
Text {
|
||||
text: "some"
|
||||
import "../Color.js" as Colors
|
||||
|
||||
import "./"
|
||||
|
||||
Container {
|
||||
id: batteryRoot
|
||||
|
||||
boxColor: Colors.green
|
||||
boxState: ""
|
||||
sourceComponent: batteryClosed
|
||||
visible: UPower.devices[0] ? true : false
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
enabled: true
|
||||
hoverEnabled: true
|
||||
propagateComposedEvents: true
|
||||
|
||||
onClicked: batteryRoot.boxState == "" ? batteryRoot.boxState = "open" : batteryRoot.boxState = ""
|
||||
onExited: batteryRoot.boxState = ""
|
||||
}
|
||||
|
||||
Component {
|
||||
id: batteryClosed
|
||||
|
||||
Item {
|
||||
id: batteryRoot
|
||||
|
||||
anchors.fill: parent
|
||||
|
||||
Text {
|
||||
color: Colors.base
|
||||
text: "something"
|
||||
|
||||
anchors {
|
||||
bottom: parent.bottom
|
||||
horizontalCenter: parent.horizontalCenter
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
64
Components/Utils/Container.qml
Normal file
64
Components/Utils/Container.qml
Normal file
@@ -0,0 +1,64 @@
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import Quickshell
|
||||
|
||||
Item {
|
||||
id: container
|
||||
|
||||
required property color boxColor
|
||||
property double boxHeight
|
||||
property double boxRadius
|
||||
required property string boxState
|
||||
property double boxWidth
|
||||
property double openHeight
|
||||
property double openWidth
|
||||
required property Component sourceComponent
|
||||
|
||||
Layout.topMargin: 0
|
||||
implicitHeight: boxHeight || 50
|
||||
implicitWidth: boxWidth || 30
|
||||
state: boxState
|
||||
|
||||
Behavior on anchors.topMargin {
|
||||
SmoothAnim {}
|
||||
}
|
||||
Behavior on implicitHeight {
|
||||
SmoothAnim {}
|
||||
}
|
||||
Behavior on implicitWidth {
|
||||
SmoothAnim {}
|
||||
}
|
||||
states: [
|
||||
State {
|
||||
name: ""
|
||||
},
|
||||
State {
|
||||
name: "open"
|
||||
|
||||
PropertyChanges {
|
||||
container.Layout.topMargin: 35
|
||||
container.implicitHeight: openHeight || 150
|
||||
container.implicitWidth: openWidth || 200
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
Rectangle {
|
||||
id: mainBackground
|
||||
|
||||
anchors.fill: parent
|
||||
color: container.boxColor
|
||||
radius: container.boxRadius || 10
|
||||
|
||||
Loader {
|
||||
anchors.fill: parent
|
||||
sourceComponent: container.sourceComponent
|
||||
}
|
||||
}
|
||||
|
||||
component SmoothAnim: SpringAnimation {
|
||||
damping: 0.18
|
||||
mass: 0.5
|
||||
spring: 3
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user