fix icon centering issue fr

This commit is contained in:
lucy 2026-02-01 23:59:09 +01:00
parent 52a52b7aa2
commit 1eeff4798e
4 changed files with 21 additions and 5 deletions

View File

@ -1,4 +1,5 @@
import Quickshell.Services.UPower import Quickshell.Services.UPower
import QtQuick.Layouts
import QtQuick import QtQuick
import Quickshell.Widgets import Quickshell.Widgets
import Qt5Compat.GraphicalEffects import Qt5Compat.GraphicalEffects
@ -68,17 +69,20 @@ Loader {
implicitWidth: batRow.width implicitWidth: batRow.width
implicitHeight: Settings.config.barHeight implicitHeight: Settings.config.barHeight
Row { RowLayout {
id: batRow id: batRow
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
spacing: 5 spacing: 5
CustomText { CustomText {
id: batText id: batText
Layout.topMargin: 2
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
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" font.family: "Material Symbols Rounded"
text: root.getBatteryIcon() text: root.getBatteryIcon()
} }

View File

@ -1,4 +1,5 @@
import QtQuick import QtQuick
import QtQuick.Layouts
import Quickshell.Services.Mpris import Quickshell.Services.Mpris
import qs import qs
import qs.settings import qs.settings
@ -26,7 +27,7 @@ Rectangle {
implicitWidth: statusRow.implicitWidth implicitWidth: statusRow.implicitWidth
implicitHeight: statusRow.implicitHeight implicitHeight: statusRow.implicitHeight
Row { RowLayout {
id: statusRow id: statusRow
spacing: 5 spacing: 5
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
@ -34,10 +35,12 @@ Rectangle {
property var status: root.spotify != null ? !root.spotify.isPlaying ? "play_arrow" : "pause" : "" property var status: root.spotify != null ? !root.spotify.isPlaying ? "play_arrow" : "pause" : ""
CustomText { CustomText {
id: mprisText id: mprisText
Layout.topMargin: 2
text: root.spotify != null ? parent.combinedText : "" text: root.spotify != null ? parent.combinedText : ""
} }
CustomIcon { CustomIcon {
id: mprisStatus id: mprisStatus
Layout.topMargin: 2
text: root.spotify != null ? parent.status : "" text: root.spotify != null ? parent.status : ""
} }
} }

View File

@ -42,6 +42,7 @@ Rectangle {
anchors.centerIn: parent anchors.centerIn: parent
CustomText { CustomText {
id: volumeText id: volumeText
Layout.topMargin: 2
PwObjectTracker { PwObjectTracker {
objects: Pipewire.ready ? Pipewire.defaultAudioSink : [] objects: Pipewire.ready ? Pipewire.defaultAudioSink : []
@ -51,6 +52,7 @@ Rectangle {
} }
CustomIcon { CustomIcon {
id: volumeIcon id: volumeIcon
Layout.topMargin: 2
Layout.alignment: Qt.AlignVCenter Layout.alignment: Qt.AlignVCenter
opacity: Pipewire.ready ? root.sink.audio.muted ? 0.5 : 1 : 0 opacity: Pipewire.ready ? root.sink.audio.muted ? 0.5 : 1 : 0
text: Pipewire.ready ? root.getVolumeIcon() : null text: Pipewire.ready ? root.getVolumeIcon() : null

View File

@ -35,8 +35,9 @@ FloatingWindow {
ColumnLayout { ColumnLayout {
id: windowLayout id: windowLayout
spacing: 10 spacing: 5
anchors.fill: parent anchors.fill: parent
anchors.margins: 5
Rectangle { Rectangle {
id: textWrapper id: textWrapper
@ -44,7 +45,10 @@ FloatingWindow {
Layout.margins: 10 Layout.margins: 10
Layout.alignment: Qt.AlignCenter Layout.alignment: Qt.AlignCenter
Layout.bottomMargin: 0 Layout.bottomMargin: 0
radius: 14 topLeftRadius: 12
topRightRadius: 12
bottomLeftRadius: 4
bottomRightRadius: 4
implicitHeight: 30 implicitHeight: 30
color: Colors.surfaceContainerLow color: Colors.surfaceContainerLow
CustomText { CustomText {
@ -61,7 +65,10 @@ FloatingWindow {
Layout.fillWidth: true Layout.fillWidth: true
Layout.fillHeight: true Layout.fillHeight: true
Layout.margins: 10 Layout.margins: 10
radius: 14 topLeftRadius: 4
topRightRadius: 4
bottomLeftRadius: 12
bottomRightRadius: 12
color: Colors.surfaceContainerLow color: Colors.surfaceContainerLow
GridView { GridView {
id: gridRoot id: gridRoot