bar: animate bluetooth devices

This commit is contained in:
2 * r + 2 * t 2025-04-30 17:19:30 +10:00
parent d7083e8923
commit 1ed0db3b48
4 changed files with 28 additions and 18 deletions

View file

@ -2,6 +2,7 @@ import "root:/widgets"
import "root:/services" import "root:/services"
import "root:/utils" import "root:/utils"
import "root:/config" import "root:/config"
import Quickshell
import QtQuick import QtQuick
import QtQuick.Controls import QtQuick.Controls
@ -33,7 +34,7 @@ StyledRect {
font.pointSize: Appearance.font.size.larger font.pointSize: Appearance.font.size.larger
} }
BoxLayout { Box {
anchors.left: vertical ? undefined : bluetooth.right anchors.left: vertical ? undefined : bluetooth.right
anchors.leftMargin: vertical ? 0 : Appearance.padding.smaller anchors.leftMargin: vertical ? 0 : Appearance.padding.smaller
anchors.top: vertical ? bluetooth.bottom : undefined anchors.top: vertical ? bluetooth.bottom : undefined
@ -43,7 +44,9 @@ StyledRect {
anchors.verticalCenter: vertical ? undefined : bluetooth.verticalCenter anchors.verticalCenter: vertical ? undefined : bluetooth.verticalCenter
Repeater { Repeater {
model: Bluetooth.connected model: ScriptModel {
values: Bluetooth.devices.filter(d => d.connected)
}
MaterialIcon { MaterialIcon {
required property Bluetooth.Device modelData required property Bluetooth.Device modelData

View file

@ -41,26 +41,12 @@ Item {
height: BarConfig.sizes.innerHeight height: BarConfig.sizes.innerHeight
} }
Grid { Box {
flow: root.vertical ? GridLayout.TopToBottom : GridLayout.LeftToRight
rows: root.vertical ? -1 : 1
columns: root.vertical ? 1 : -1
spacing: Appearance.padding.small
anchors.left: vertical ? undefined : indicator.right anchors.left: vertical ? undefined : indicator.right
anchors.top: vertical ? indicator.bottom : undefined anchors.top: vertical ? indicator.bottom : undefined
anchors.verticalCenter: vertical ? undefined : indicator.verticalCenter anchors.verticalCenter: vertical ? undefined : indicator.verticalCenter
anchors.horizontalCenter: vertical ? indicator.horizontalCenter : undefined anchors.horizontalCenter: vertical ? indicator.horizontalCenter : undefined
add: Transition {
Anim {
properties: "scale"
from: 0
to: 1
duration: Appearance.anim.durations.small
}
}
Repeater { Repeater {
model: ScriptModel { model: ScriptModel {
values: Hyprland.clients.filter(c => c.workspace.id === root.ws) values: Hyprland.clients.filter(c => c.workspace.id === root.ws)

View file

@ -10,7 +10,6 @@ Singleton {
property bool powered property bool powered
property bool discovering property bool discovering
property list<Device> devices: [] property list<Device> devices: []
readonly property list<Device> connected: devices.filter(d => d.connected)
Process { Process {
running: true running: true

22
widgets/Box.qml Normal file
View file

@ -0,0 +1,22 @@
import "root:/config"
import QtQuick
Grid {
property bool vertical: parent.vertical ?? false // Propagate from parent
flow: vertical ? Grid.TopToBottom : Grid.LeftToRight
rows: vertical ? -1 : 1
columns: vertical ? 1 : -1
spacing: Appearance.spacing.small
add: Transition {
NumberAnimation {
properties: "scale"
from: 0
to: 1
duration: Appearance.anim.durations.normal
easing.type: Easing.BezierSpline
easing.bezierCurve: Appearance.anim.curves.standardDecel
}
}
}