quickshell: anchor-based layout instead of RowLayout
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
1cb2389b0d
commit
45275e29c9
1 changed files with 75 additions and 82 deletions
|
|
@ -457,14 +457,12 @@ in
|
|||
implicitHeight: 30
|
||||
color: "#D1${c.base00}"
|
||||
|
||||
RowLayout {
|
||||
anchors.fill: parent
|
||||
spacing: 0
|
||||
|
||||
// Workspaces
|
||||
// Left — workspaces
|
||||
Row {
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: 6
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
spacing: 0
|
||||
Layout.leftMargin: 6
|
||||
|
||||
Repeater {
|
||||
model: Hyprland.workspaces
|
||||
|
|
@ -482,7 +480,6 @@ in
|
|||
font.pixelSize: 13
|
||||
}
|
||||
|
||||
// Underline indicator
|
||||
Rectangle {
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
|
|
@ -500,12 +497,10 @@ in
|
|||
}
|
||||
}
|
||||
|
||||
// Spacer
|
||||
Item { Layout.fillWidth: true }
|
||||
|
||||
// Clock
|
||||
// Center — clock
|
||||
Text {
|
||||
id: clockText
|
||||
anchors.centerIn: parent
|
||||
property date now: new Date()
|
||||
text: now.toLocaleTimeString(Qt.locale(), "HH:mm")
|
||||
color: "#${c.base05}"
|
||||
|
|
@ -526,15 +521,18 @@ in
|
|||
}
|
||||
}
|
||||
|
||||
// Spacer
|
||||
Item { Layout.fillWidth: true }
|
||||
// Right — network, battery, tray
|
||||
Row {
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: 8
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
spacing: 10
|
||||
|
||||
// Network status
|
||||
Item {
|
||||
id: netWidget
|
||||
Layout.preferredHeight: 30
|
||||
Layout.preferredWidth: netRow.width
|
||||
Layout.rightMargin: 10
|
||||
width: 16
|
||||
height: 30
|
||||
|
||||
property string netState: ""
|
||||
property string netConn: ""
|
||||
|
|
@ -571,18 +569,13 @@ in
|
|||
}
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
id: netRow
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
spacing: 6
|
||||
|
||||
Text {
|
||||
anchors.centerIn: parent
|
||||
text: netWidget.netIcon
|
||||
color: "#${c.base05}"
|
||||
font.family: "FiraMono Nerd Font"
|
||||
font.pixelSize: 14
|
||||
}
|
||||
}
|
||||
|
||||
Process {
|
||||
id: nmEditorProc
|
||||
|
|
@ -599,9 +592,8 @@ in
|
|||
// Battery
|
||||
Item {
|
||||
id: batteryWidget
|
||||
Layout.preferredHeight: 30
|
||||
Layout.preferredWidth: batteryRow.width
|
||||
Layout.rightMargin: 10
|
||||
width: batteryText.width + 4 + batteryIconText.width
|
||||
height: 30
|
||||
|
||||
property int batteryLevel: 0
|
||||
property bool charging: false
|
||||
|
|
@ -641,12 +633,12 @@ in
|
|||
}
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
id: batteryRow
|
||||
Row {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
spacing: 4
|
||||
|
||||
Text {
|
||||
id: batteryText
|
||||
text: batteryWidget.batteryLevel + "%"
|
||||
color: batteryWidget.batteryLevel <= 15 ? "#${c.base08}"
|
||||
: batteryWidget.batteryLevel <= 30 ? "#${c.base0A}"
|
||||
|
|
@ -656,6 +648,7 @@ in
|
|||
}
|
||||
|
||||
Text {
|
||||
id: batteryIconText
|
||||
text: batteryWidget.batteryIcon
|
||||
color: batteryWidget.batteryLevel <= 15 ? "#${c.base08}"
|
||||
: batteryWidget.batteryLevel <= 30 ? "#${c.base0A}"
|
||||
|
|
@ -667,19 +660,19 @@ in
|
|||
}
|
||||
''}
|
||||
|
||||
// Tray icons inline
|
||||
RowLayout {
|
||||
// Tray icons
|
||||
Row {
|
||||
id: trayArea
|
||||
spacing: 8
|
||||
Layout.rightMargin: 8
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
|
||||
Repeater {
|
||||
model: SystemTray.items
|
||||
|
||||
Item {
|
||||
required property var modelData
|
||||
Layout.preferredWidth: 16
|
||||
Layout.preferredHeight: 16
|
||||
width: 16
|
||||
height: 16
|
||||
|
||||
Image {
|
||||
id: trayIcon
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue