nosignal-shell/modules/bar/Bar.qml
2 * r + 2 * t bb09f65d50 bar: fix vertical switching
IT WORKS AFHJIASHFGUOADGHOASF
Need to reload the preset when changing between but eh
2025-05-01 18:51:22 +10:00

121 lines
3 KiB
QML

import "root:/widgets"
import "root:/config"
import Quickshell
import QtQuick
Variants {
model: Quickshell.screens
StyledWindow {
id: win
required property ShellScreen modelData
screen: modelData
name: "bar"
width: BarConfig.vertical ? BarConfig.sizes.totalHeight : -1
height: BarConfig.vertical ? -1 : BarConfig.sizes.totalHeight
anchors.top: true
anchors.left: true
Component.onCompleted: {
if (BarConfig.vertical)
win.anchors.bottom = true;
else
win.anchors.right = true;
}
Connections {
target: BarConfig
function onVerticalChanged(): void {
win.visible = false;
if (BarConfig.vertical) {
win.anchors.right = false;
win.anchors.bottom = true;
} else {
win.anchors.bottom = false;
win.anchors.right = true;
}
win.visible = true;
}
}
Preset {
presetName: "pills"
sourceComponent: Pills {}
}
Preset {
presetName: "panel"
sourceComponent: Panel {}
}
}
component Preset: Loader {
id: loader
required property string presetName
anchors.fill: parent
asynchronous: true
active: false
opacity: 0
states: [
State {
name: "visible"
when: BarConfig.preset.name === loader.presetName
PropertyChanges {
loader.opacity: 1
loader.active: true
}
}
]
transitions: [
Transition {
from: ""
to: "visible"
SequentialAnimation {
PropertyAction {}
NumberAnimation {
property: "opacity"
duration: Appearance.anim.durations.large
easing.type: Easing.BezierSpline
easing.bezierCurve: Appearance.anim.curves.standard
}
}
},
Transition {
from: "visible"
to: ""
SequentialAnimation {
NumberAnimation {
property: "opacity"
duration: Appearance.anim.durations.large
easing.type: Easing.BezierSpline
easing.bezierCurve: Appearance.anim.curves.standard
}
PropertyAction {}
}
}
]
Connections {
target: BarConfig
function onVerticalChanged(): void {
if (loader.state === "visible") {
loader.active = false;
loader.active = true;
}
}
}
}
}