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