70 lines
2.2 KiB
QML
70 lines
2.2 KiB
QML
// Bar.qml
|
|
import Quickshell
|
|
import Quickshell.Io
|
|
import QtQuick
|
|
import QtQuick.Layouts
|
|
import Quickshell.Hyprland
|
|
|
|
Item {
|
|
id: root
|
|
width: row.width
|
|
height: row.height
|
|
RowLayout {
|
|
id: row
|
|
height: 15
|
|
Repeater {
|
|
id: repeater
|
|
model: 10
|
|
delegate: Item {
|
|
id: content
|
|
required property int index
|
|
property bool focused: HyprlandHelpers.getHyprlandWorkspaceById(index + 1).focused
|
|
property bool exists: HyprlandHelpers.getHyprlandWorkspaceById(index + 1) ? true : false
|
|
state: focused ? "FOCUSED" : (exists ? "EXISTS" : "NOT")
|
|
states: [
|
|
State {
|
|
name: "FOCUSED"
|
|
PropertyChanges {
|
|
target: content
|
|
width: 10
|
|
scale: 1
|
|
}
|
|
},
|
|
State {
|
|
name: "EXISTS"
|
|
PropertyChanges {
|
|
target: content
|
|
width: 10
|
|
scale: 0.85
|
|
}
|
|
},
|
|
State {
|
|
name: "NOT"
|
|
PropertyChanges {
|
|
target: content
|
|
width: 10
|
|
scale: 0.75
|
|
}
|
|
}
|
|
]
|
|
height: 15
|
|
Rectangle {
|
|
width: parent.width
|
|
height: parent.height
|
|
radius: 2.5
|
|
color: {
|
|
if (HyprlandHelpers.getHyprlandWorkspaceById(index + 1) != null) {
|
|
if (HyprlandHelpers.getHyprlandWorkspaceById(index + 1).focused) {
|
|
return Colors.primaryText;
|
|
}
|
|
return Colors.textSecondary;
|
|
} else {
|
|
return Colors.textDisabled;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|