refactor: use layout for bar
Also add power icon
This commit is contained in:
parent
81055262d2
commit
472ed40289
2 changed files with 33 additions and 15 deletions
|
|
@ -6,15 +6,18 @@ import "components"
|
||||||
import "components/workspaces"
|
import "components/workspaces"
|
||||||
import Quickshell.Wayland
|
import Quickshell.Wayland
|
||||||
import QtQuick
|
import QtQuick
|
||||||
|
import QtQuick.Layouts
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
Item {
|
BoxLayout {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
function get(horiz, vert) {
|
function get(horiz, vert) {
|
||||||
return BarConfig.vertical ? vert : horiz;
|
return BarConfig.vertical ? vert : horiz;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
spacing: Appearance.padding.large
|
||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.leftMargin: get(BarConfig.sizes.floatingGapLarge, BarConfig.sizes.floatingGap)
|
anchors.leftMargin: get(BarConfig.sizes.floatingGapLarge, BarConfig.sizes.floatingGap)
|
||||||
anchors.topMargin: get(BarConfig.sizes.floatingGap, BarConfig.sizes.floatingGapLarge)
|
anchors.topMargin: get(BarConfig.sizes.floatingGap, BarConfig.sizes.floatingGapLarge)
|
||||||
|
|
@ -22,8 +25,6 @@ Item {
|
||||||
anchors.bottomMargin: get(0, BarConfig.sizes.floatingGapLarge)
|
anchors.bottomMargin: get(0, BarConfig.sizes.floatingGapLarge)
|
||||||
|
|
||||||
Pill {
|
Pill {
|
||||||
anchors.left: parent.left
|
|
||||||
|
|
||||||
OsIcon {
|
OsIcon {
|
||||||
id: osIcon
|
id: osIcon
|
||||||
|
|
||||||
|
|
@ -44,10 +45,12 @@ Item {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Pill {
|
Item {
|
||||||
anchors.horizontalCenter: root.get(parent.horizontalCenter, undefined)
|
Layout.fillWidth: true
|
||||||
anchors.verticalCenter: root.get(undefined, parent.verticalCenter)
|
Layout.fillHeight: true
|
||||||
|
}
|
||||||
|
|
||||||
|
Pill {
|
||||||
ActiveWindow {
|
ActiveWindow {
|
||||||
vertical: BarConfig.vertical
|
vertical: BarConfig.vertical
|
||||||
|
|
||||||
|
|
@ -56,10 +59,12 @@ Item {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Pill {
|
Item {
|
||||||
anchors.right: rightPill.left
|
Layout.fillWidth: true
|
||||||
anchors.rightMargin: Appearance.padding.normal
|
Layout.fillHeight: true
|
||||||
|
}
|
||||||
|
|
||||||
|
Pill {
|
||||||
Tray {
|
Tray {
|
||||||
vertical: BarConfig.vertical
|
vertical: BarConfig.vertical
|
||||||
|
|
||||||
|
|
@ -69,10 +74,6 @@ Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
Pill {
|
Pill {
|
||||||
id: rightPill
|
|
||||||
|
|
||||||
anchors.right: parent.right
|
|
||||||
|
|
||||||
Clock {
|
Clock {
|
||||||
id: clock
|
id: clock
|
||||||
|
|
||||||
|
|
@ -92,6 +93,13 @@ Item {
|
||||||
anchors.verticalCenter: root.get(parent.verticalCenter, undefined)
|
anchors.verticalCenter: root.get(parent.verticalCenter, undefined)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Pill {
|
||||||
|
Power {
|
||||||
|
anchors.horizontalCenter: root.get(undefined, parent.horizontalCenter)
|
||||||
|
anchors.verticalCenter: root.get(parent.verticalCenter, undefined)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
component Pill: PaddedRect {
|
component Pill: PaddedRect {
|
||||||
|
|
@ -101,7 +109,7 @@ Item {
|
||||||
radius: Appearance.rounding.full
|
radius: Appearance.rounding.full
|
||||||
padding: BarConfig.vertical ? [Appearance.padding.large, 0] : [0, Appearance.padding.large]
|
padding: BarConfig.vertical ? [Appearance.padding.large, 0] : [0, Appearance.padding.large]
|
||||||
|
|
||||||
width: BarConfig.vertical ? BarConfig.sizes.height : implicitWidth
|
Layout.minimumWidth: BarConfig.sizes.height
|
||||||
height: BarConfig.vertical ? implicitHeight : BarConfig.sizes.height
|
Layout.minimumHeight: BarConfig.sizes.height
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
10
modules/bar/components/Power.qml
Normal file
10
modules/bar/components/Power.qml
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
import "root:/widgets"
|
||||||
|
import "root:/config"
|
||||||
|
|
||||||
|
MaterialIcon {
|
||||||
|
text: "power_settings_new"
|
||||||
|
color: Appearance.colours.red
|
||||||
|
font.bold: true
|
||||||
|
x: implicitWidth + Appearance.padding.large * 2 - BarConfig.sizes.height
|
||||||
|
width: BarConfig.sizes.height - Appearance.padding.large * 2
|
||||||
|
}
|
||||||
Loading…
Add table
Reference in a new issue