diff --git a/modules/bar/ActiveWindow.qml b/modules/bar/ActiveWindow.qml index 35d474b..335048c 100644 --- a/modules/bar/ActiveWindow.qml +++ b/modules/bar/ActiveWindow.qml @@ -6,13 +6,16 @@ import qs import qs.widgets import qs.settings -ClippingWrapperRectangle { +Rectangle { id: root + required property double moduleHeight + implicitHeight: moduleHeight + implicitWidth: titleLayout.width + 32 color: Colors.base01 radius: Config.rounding - leftMargin: 8 - rightMargin: 8 - child: RowLayout { + RowLayout { + id: titleLayout + anchors.centerIn: root WrapperRectangle { Layout.maximumWidth: 400 color: 'transparent' diff --git a/modules/bar/Bar.qml b/modules/bar/Bar.qml index f570a83..f0cc91b 100644 --- a/modules/bar/Bar.qml +++ b/modules/bar/Bar.qml @@ -11,6 +11,7 @@ Variants { delegate: WlrLayershell { id: root required property var modelData + property double moduleHeight: implicitHeight - 8 screen: modelData anchors { top: true @@ -28,16 +29,21 @@ Variants { anchors.verticalCenter: parent.verticalCenter anchors.leftMargin: 10 Ws { + moduleHeight: root.moduleHeight barScreen: root.modelData } - ActiveWindow {} + ActiveWindow { + moduleHeight: root.moduleHeight + } } RowLayout { id: centerLayout anchors.centerIn: parent spacing: 5 - Clock {} + Clock { + moduleHeight: root.moduleHeight + } } RowLayout { @@ -46,10 +52,18 @@ Variants { anchors.verticalCenter: parent.verticalCenter spacing: 5 anchors.rightMargin: 10 - Mpris {} - Bat {} - Pw {} - Tray {} + Mpris { + moduleHeight: root.moduleHeight + } + Bat { + moduleHeight: root.moduleHeight + } + Pw { + moduleHeight: root.moduleHeight + } + Tray { + moduleHeight: root.moduleHeight + } } } } diff --git a/modules/bar/Bat.qml b/modules/bar/Bat.qml index 7bc67c3..df41b10 100644 --- a/modules/bar/Bat.qml +++ b/modules/bar/Bat.qml @@ -6,15 +6,16 @@ import qs import qs.widgets import qs.settings -WrapperRectangle { +Rectangle { id: root clip: true color: Colors.base01 property double percent: UPower.displayDevice.percentage * 100 property bool hasBattery: UPower.displayDevice.isLaptopBattery property bool charging: UPower.displayDevice.state == UPowerDeviceState.Charging - leftMargin: 8 - rightMargin: 8 + required property double moduleHeight + implicitHeight: moduleHeight + implicitWidth: batLayout.implicitWidth + 16 radius: Config.rounding function batteryIcon(percent, charging) { if (percent <= 15) @@ -31,7 +32,9 @@ WrapperRectangle { return charging ? "battery_charging_90" : "battery_6_bar"; return charging ? "battery_charging_full" : "battery_full"; } - child: RowLayout { + RowLayout { + id: batLayout + anchors.centerIn: root MaterialIcon { text: root.batteryIcon(root.percent, root.charging) } diff --git a/modules/bar/Clock.qml b/modules/bar/Clock.qml index 217fa6f..e053e8d 100644 --- a/modules/bar/Clock.qml +++ b/modules/bar/Clock.qml @@ -5,18 +5,21 @@ import qs import qs.widgets import qs.settings -WrapperRectangle { +Rectangle { id: root clip: true + required property double moduleHeight + implicitHeight: moduleHeight + implicitWidth: clockText.implicitWidth + 32 color: Colors.base01 - leftMargin: 8 - rightMargin: 8 radius: Config.rounding SystemClock { id: clock precision: SystemClock.Seconds } - child: StyledText { - text: Qt.formatDateTime(clock.date, "d.M.yy - hh:mm") + StyledText { + id: clockText + anchors.centerIn: root + text: Qt.formatDateTime(clock.date, "d.M.yy - hh:mm") } } diff --git a/modules/bar/Mpris.qml b/modules/bar/Mpris.qml index d404948..02026e6 100644 --- a/modules/bar/Mpris.qml +++ b/modules/bar/Mpris.qml @@ -6,8 +6,11 @@ import qs import qs.widgets import qs.settings -WrapperRectangle { +Rectangle { id: root + required property double moduleHeight + implicitHeight: moduleHeight + implicitWidth: songLayout.implicitWidth + 32 property MprisPlayer spotify: { for (const player of Mpris.players.values) { if (player.identity === "Spotify") @@ -16,16 +19,18 @@ WrapperRectangle { return null; } visible: spotify !== null && spotify.playbackState === MprisPlaybackState.Playing - leftMargin: 8 - rightMargin: 8 + clip: true color: Colors.base01 radius: Config.rounding - child: RowLayout { + RowLayout { + id: songLayout + anchors.centerIn: root MaterialIcon { text: "music_note_2" } StyledText { Layout.maximumWidth: 400 + Layout.maximumHeight: Config.barHeight / 1.6 text: root.spotify?.trackTitle + " - " + root.spotify?.trackArtists elide: Text.ElideRight } diff --git a/modules/bar/Pw.qml b/modules/bar/Pw.qml index 4a32822..e0a893d 100644 --- a/modules/bar/Pw.qml +++ b/modules/bar/Pw.qml @@ -6,14 +6,15 @@ import qs import qs.widgets import qs.settings -WrapperRectangle { +Rectangle { id: root color: Colors.base01 property PwNode defaultAudio: Pipewire.ready ? Pipewire.preferredDefaultAudioSink : null property bool mute: Pipewire.ready ? defaultAudio?.audio.muted : null radius: Config.rounding - leftMargin: 8 - rightMargin: 8 + required property double moduleHeight + implicitHeight: moduleHeight + implicitWidth: pwLayout.implicitWidth + 16 function getVolumeIcon() { let volume = Pipewire.ready ? root.defaultAudio.audio.volume : null; if (root.mute) { @@ -32,7 +33,10 @@ WrapperRectangle { PwObjectTracker { objects: [Pipewire.ready ? Pipewire.defaultAudioSink : null] } - child: RowLayout { + + RowLayout { + id: pwLayout + anchors.centerIn: root spacing: 4 MaterialIcon { text: root.getVolumeIcon() diff --git a/modules/bar/Tray.qml b/modules/bar/Tray.qml index a32a9e3..3d52346 100644 --- a/modules/bar/Tray.qml +++ b/modules/bar/Tray.qml @@ -7,17 +7,19 @@ import QtQuick.Layouts import qs import qs.settings -WrapperRectangle { +Rectangle { id: root color: Colors.base01 visible: iconRepeater.count != 0 radius: Config.rounding Layout.fillHeight: true - leftMargin: 8 - rightMargin: 8 + required property double moduleHeight + implicitHeight: moduleHeight + implicitWidth: iconlayout.implicitWidth + 16 - child: RowLayout { + RowLayout { id: iconlayout + anchors.centerIn: root Repeater { id: iconRepeater model: SystemTray.items diff --git a/modules/bar/Ws.qml b/modules/bar/Ws.qml index 79cb6ee..7c5f84e 100644 --- a/modules/bar/Ws.qml +++ b/modules/bar/Ws.qml @@ -8,22 +8,27 @@ import qs import qs.widgets import qs.settings -WrapperRectangle { +Rectangle { id: root required property ShellScreen barScreen + required property double moduleHeight property HyprlandMonitor hyprBarScreen: Hyprland.monitorFor(root.barScreen) radius: Config.rounding color: Colors.base01 - leftMargin: 8 - rightMargin: 8 - child: RowLayout { + implicitWidth: wsLayout.implicitWidth + 32 + implicitHeight: moduleHeight + + RowLayout { id: wsLayout + anchors.centerIn: parent + anchors.horizontalCenter: parent.horizontalCenter spacing: 8 Repeater { id: wsRepeater model: Hyprland.workspaces delegate: WrapperRectangle { id: wsWrapper + anchors.verticalCenter: parent.verticalCenter parent: wsLayout color: 'transparent' visible: modelData.monitor == root.hyprBarScreen diff --git a/settings/settings.ini b/settings/settings.ini index 0601bf8..5ba5e25 100644 --- a/settings/settings.ini +++ b/settings/settings.ini @@ -1,7 +1,7 @@ [General] barHeight=34 -font=Maple Mono -fontSize=16 +font=ProFont IIx Nerd Font +fontSize=14 opacity=0.5 -roudning=16 +roudning=20 wallpaper=@Variant(\0\0\0\x11\0\0\0!file:///home/lucy/.wall/mooon.png)