remove margin in volume and bat

This commit is contained in:
lucy 2026-02-06 20:16:22 +01:00
parent 318ca10e44
commit 62f7a986e8
4 changed files with 11 additions and 41 deletions

View File

@ -15,7 +15,7 @@ Loader {
sourceComponent: Rectangle { sourceComponent: Rectangle {
id: container id: container
radius: implicitHeight / 2 radius: implicitHeight / 2
color: clickHandler.containsMouse ? Colors.primaryContainer : Colors.surfaceContainer color: Colors.surfaceContainer
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
implicitWidth: UPower.displayDevice.isLaptopBattery ? root.implicitWidth + 20 : 0 implicitWidth: UPower.displayDevice.isLaptopBattery ? root.implicitWidth + 20 : 0
implicitHeight: Settings.config.barHeight - 10 implicitHeight: Settings.config.barHeight - 10
@ -75,50 +75,12 @@ Loader {
CustomText { CustomText {
id: batText id: batText
Layout.topMargin: 2
text: Math.round(UPower.displayDevice.percentage * 100) + "%" text: Math.round(UPower.displayDevice.percentage * 100) + "%"
} }
CustomIcon { CustomIcon {
id: batIcon id: batIcon
Layout.topMargin: 2
font.family: "Material Symbols Rounded"
text: root.getBatteryIcon() text: root.getBatteryIcon()
} }
Item {
implicitWidth: 12
implicitHeight: 12
IconImage {
id: rawProfileIcon
anchors.fill: parent
source: Quickshell.iconPath(root.getProfileIcon())
visible: false
}
ColorOverlay {
anchors.fill: parent
source: rawProfileIcon
color: Colors.onSurfaceColor
}
}
}
MouseArea {
id: clickHandler
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
acceptedButtons: Qt.LeftButton | Qt.RightButton
hoverEnabled: true
onClicked: mouse => {
const modes = [PowerProfile.PowerSaver, PowerProfile.Balanced, PowerProfile.Performance];
let current = PowerProfiles.profile;
let currentIndex = modes.indexOf(current);
let nextIndex = (currentIndex + 1) % modes.length;
let prevIndex = (currentIndex - 1) % modes.length;
if (mouse.button == Qt.LeftButton)
PowerProfiles.profile = modes[nextIndex];
if (mouse.button == Qt.RightButton)
PowerProfiles.profile = modes[prevIndex];
}
} }
} }
} }

View File

@ -0,0 +1,10 @@
import Quickshell
import QtQuick
import Quickshell.Io
import qs
import qs.settings
Rectangle {
id: root
implicitHeight: Settings.config.barHeight
}

View File

@ -66,7 +66,6 @@ Rectangle {
id: innerContent id: innerContent
required property var modelData required property var modelData
// THIS fixes the centering issue: // THIS fixes the centering issue:
anchors.centerIn: parent
spacing: 8 spacing: 8
CustomIcon { CustomIcon {

View File

@ -42,7 +42,6 @@ Rectangle {
height: parent.height height: parent.height
CustomText { CustomText {
id: volumeText id: volumeText
Layout.topMargin: 1
PwObjectTracker { PwObjectTracker {
objects: Pipewire.ready ? Pipewire.defaultAudioSink : [] objects: Pipewire.ready ? Pipewire.defaultAudioSink : []
} }