From 0d20fc73136512405cf53b984d6a32d9284c616a Mon Sep 17 00:00:00 2001 From: lucy Date: Fri, 15 May 2026 19:56:10 +0200 Subject: [PATCH] remove useless margin stuff --- modules/bar/ActiveWindow.qml | 23 +++++++++++--------- modules/bar/Bar.qml | 27 ++++++----------------- modules/bar/Bat.qml | 42 ++++++++++++++++++++++++++++++++++++ modules/bar/Clock.qml | 4 ---- modules/bar/Mpris.qml | 4 ---- modules/bar/Pw.qml | 4 ---- modules/bar/Tray.qml | 5 +---- modules/bar/Ws.qml | 4 ---- settings/settings.ini | 4 ++-- 9 files changed, 64 insertions(+), 53 deletions(-) create mode 100644 modules/bar/Bat.qml diff --git a/modules/bar/ActiveWindow.qml b/modules/bar/ActiveWindow.qml index df55b33..29b409a 100644 --- a/modules/bar/ActiveWindow.qml +++ b/modules/bar/ActiveWindow.qml @@ -1,24 +1,27 @@ import Quickshell.Widgets import Quickshell.Hyprland import QtQuick +import QtQuick.Layouts import qs import qs.widgets import qs.settings -WrapperRectangle { +ClippingWrapperRectangle { id: root - clip: true color: Colors.base01 - required property int barHeight - required property double vertMargin radius: Config.rounding - topMargin: vertMargin - bottomMargin: vertMargin leftMargin: 8 rightMargin: 8 - child: StyledText { - text: Hyprland.activeToplevel?.title ?? "Desktop" - width: root.width - root.leftMargin - root.rightMargin - elide: Text.ElideRight + child: RowLayout { + + WrapperRectangle { + Layout.fillHeight: true + color: 'transparent' + clip: true + StyledText { + text: Hyprland.activeToplevel?.title ?? "Desktop" + elide: Text.ElideRight + } + } } } diff --git a/modules/bar/Bar.qml b/modules/bar/Bar.qml index e040bb7..06ef958 100644 --- a/modules/bar/Bar.qml +++ b/modules/bar/Bar.qml @@ -26,25 +26,15 @@ Variants { anchors.leftMargin: 10 Ws { barScreen: root.modelData - barHeight: root.implicitHeight - } - ActiveWindow { - vertMargin: barHeight / 4 - 4 - barHeight: root.implicitHeight - Layout.maximumWidth: 300 - Layout.maximumHeight: barHeight - (barHeight / 4 + 2) - Layout.fillWidth: false } + ActiveWindow {} } RowLayout { id: centerLayout anchors.centerIn: parent spacing: 5 - Clock { - vertMargin: barHeight / 4 - 4 - barHeight: root.implicitHeight - } + Clock {} } RowLayout { @@ -53,15 +43,10 @@ Variants { anchors.verticalCenter: parent.verticalCenter spacing: 5 anchors.rightMargin: 10 - Mpris { - barHeight: root.implicitHeight - } - Pw { - barHeight: root.implicitHeight - } - Tray { - barHeight: root.implicitHeight - } + Mpris {} + Bat {} + Pw {} + Tray {} } } } diff --git a/modules/bar/Bat.qml b/modules/bar/Bat.qml new file mode 100644 index 0000000..7bc67c3 --- /dev/null +++ b/modules/bar/Bat.qml @@ -0,0 +1,42 @@ +import Quickshell.Widgets +import Quickshell.Services.UPower +import QtQuick +import QtQuick.Layouts +import qs +import qs.widgets +import qs.settings + +WrapperRectangle { + 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 + radius: Config.rounding + function batteryIcon(percent, charging) { + if (percent <= 15) + return charging ? "battery_charging_20" : "battery_alert"; + if (percent <= 30) + return charging ? "battery_charging_30" : "battery_2_bar"; + if (percent <= 50) + return charging ? "battery_charging_50" : "battery_3_bar"; + if (percent <= 70) + return charging ? "battery_charging_60" : "battery_4_bar"; + if (percent <= 85) + return charging ? "battery_charging_80" : "battery_5_bar"; + if (percent <= 95) + return charging ? "battery_charging_90" : "battery_6_bar"; + return charging ? "battery_charging_full" : "battery_full"; + } + child: RowLayout { + MaterialIcon { + text: root.batteryIcon(root.percent, root.charging) + } + StyledText { + text: Math.floor(root.percent) + "%" + } + } +} diff --git a/modules/bar/Clock.qml b/modules/bar/Clock.qml index 70a8d5f..217fa6f 100644 --- a/modules/bar/Clock.qml +++ b/modules/bar/Clock.qml @@ -9,10 +9,6 @@ WrapperRectangle { id: root clip: true color: Colors.base01 - required property int barHeight - required property double vertMargin - topMargin: vertMargin - bottomMargin: vertMargin leftMargin: 8 rightMargin: 8 radius: Config.rounding diff --git a/modules/bar/Mpris.qml b/modules/bar/Mpris.qml index fc6eb35..cedb9d5 100644 --- a/modules/bar/Mpris.qml +++ b/modules/bar/Mpris.qml @@ -9,11 +9,7 @@ import qs.settings WrapperRectangle { id: root property MprisPlayer spotify: findSpotify() - required property int barHeight - property double vertMargin: barHeight / 4 - 4 visible: spotify != null - topMargin: vertMargin - bottomMargin: vertMargin leftMargin: 8 rightMargin: 8 color: Colors.base01 diff --git a/modules/bar/Pw.qml b/modules/bar/Pw.qml index 18b5c6c..4a32822 100644 --- a/modules/bar/Pw.qml +++ b/modules/bar/Pw.qml @@ -9,13 +9,9 @@ import qs.settings WrapperRectangle { id: root color: Colors.base01 - required property int barHeight - property double vertMargin: barHeight / 4 - 4 property PwNode defaultAudio: Pipewire.ready ? Pipewire.preferredDefaultAudioSink : null property bool mute: Pipewire.ready ? defaultAudio?.audio.muted : null radius: Config.rounding - topMargin: vertMargin - bottomMargin: vertMargin leftMargin: 8 rightMargin: 8 function getVolumeIcon() { diff --git a/modules/bar/Tray.qml b/modules/bar/Tray.qml index 100ed1c..64838be 100644 --- a/modules/bar/Tray.qml +++ b/modules/bar/Tray.qml @@ -11,13 +11,10 @@ WrapperRectangle { id: root color: Colors.base01 visible: iconRepeater.count != 0 - required property int barHeight - property double vertMargin: barHeight / 4 - 4 - topMargin: vertMargin radius: Config.rounding - bottomMargin: vertMargin leftMargin: 8 rightMargin: 8 + margin: 1 child: RowLayout { id: iconlayout diff --git a/modules/bar/Ws.qml b/modules/bar/Ws.qml index 32ee289..79cb6ee 100644 --- a/modules/bar/Ws.qml +++ b/modules/bar/Ws.qml @@ -11,13 +11,9 @@ import qs.settings WrapperRectangle { id: root required property ShellScreen barScreen - required property int barHeight - readonly property double vertMargin: barHeight / 4 - 4 property HyprlandMonitor hyprBarScreen: Hyprland.monitorFor(root.barScreen) radius: Config.rounding color: Colors.base01 - topMargin: vertMargin - bottomMargin: vertMargin leftMargin: 8 rightMargin: 8 child: RowLayout { diff --git a/settings/settings.ini b/settings/settings.ini index 43fdd98..d63718c 100644 --- a/settings/settings.ini +++ b/settings/settings.ini @@ -1,6 +1,6 @@ [General] barHeight=30 font=Maple Mono -fontSize=12 +fontSize=14 roudning=16 -wallpaper=@Variant(\0\0\0\x11\0\0\0 file:///home/lucy/.wall/Kita.png) +wallpaper=@Variant(\0\0\0\x11\0\0\0\x31\x66ile:///home/lucy/.wall/kikis_deliveryservice.png)