diff options
| author | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-04-30 17:46:47 +1000 |
|---|---|---|
| committer | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-04-30 17:46:47 +1000 |
| commit | 472ed40289078c7f6dff2bdda55b27cc55ccd2e4 (patch) | |
| tree | 9346ec870de82d52d5e153285a894ee0b9f9c096 /modules | |
| parent | bluetooth: lazy update devices (diff) | |
| download | caelestia-shell-472ed40289078c7f6dff2bdda55b27cc55ccd2e4.tar.gz caelestia-shell-472ed40289078c7f6dff2bdda55b27cc55ccd2e4.tar.bz2 caelestia-shell-472ed40289078c7f6dff2bdda55b27cc55ccd2e4.zip | |
refactor: use layout for bar
Also add power icon
Diffstat (limited to 'modules')
| -rw-r--r-- | modules/bar/Pills.qml | 38 | ||||
| -rw-r--r-- | modules/bar/components/Power.qml | 10 |
2 files changed, 33 insertions, 15 deletions
diff --git a/modules/bar/Pills.qml b/modules/bar/Pills.qml index 0bbf620..f54b0cf 100644 --- a/modules/bar/Pills.qml +++ b/modules/bar/Pills.qml @@ -6,15 +6,18 @@ import "components" import "components/workspaces" import Quickshell.Wayland import QtQuick +import QtQuick.Layouts Item { - Item { + BoxLayout { id: root function get(horiz, vert) { return BarConfig.vertical ? vert : horiz; } + spacing: Appearance.padding.large + anchors.fill: parent anchors.leftMargin: get(BarConfig.sizes.floatingGapLarge, BarConfig.sizes.floatingGap) anchors.topMargin: get(BarConfig.sizes.floatingGap, BarConfig.sizes.floatingGapLarge) @@ -22,8 +25,6 @@ Item { anchors.bottomMargin: get(0, BarConfig.sizes.floatingGapLarge) Pill { - anchors.left: parent.left - OsIcon { id: osIcon @@ -44,10 +45,12 @@ Item { } } - Pill { - anchors.horizontalCenter: root.get(parent.horizontalCenter, undefined) - anchors.verticalCenter: root.get(undefined, parent.verticalCenter) + Item { + Layout.fillWidth: true + Layout.fillHeight: true + } + Pill { ActiveWindow { vertical: BarConfig.vertical @@ -56,10 +59,12 @@ Item { } } - Pill { - anchors.right: rightPill.left - anchors.rightMargin: Appearance.padding.normal + Item { + Layout.fillWidth: true + Layout.fillHeight: true + } + Pill { Tray { vertical: BarConfig.vertical @@ -69,10 +74,6 @@ Item { } Pill { - id: rightPill - - anchors.right: parent.right - Clock { id: clock @@ -92,6 +93,13 @@ Item { 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 { @@ -101,7 +109,7 @@ Item { radius: Appearance.rounding.full padding: BarConfig.vertical ? [Appearance.padding.large, 0] : [0, Appearance.padding.large] - width: BarConfig.vertical ? BarConfig.sizes.height : implicitWidth - height: BarConfig.vertical ? implicitHeight : BarConfig.sizes.height + Layout.minimumWidth: BarConfig.sizes.height + Layout.minimumHeight: BarConfig.sizes.height } } diff --git a/modules/bar/components/Power.qml b/modules/bar/components/Power.qml new file mode 100644 index 0000000..ba34238 --- /dev/null +++ b/modules/bar/components/Power.qml @@ -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 +} |