Compare commits

...

2 Commits

Author SHA1 Message Date
52a52b7aa2 fix icon size 2026-02-01 18:10:01 +01:00
9ffcfa08cb fix centering issue of font icon 2026-02-01 17:51:55 +01:00
3 changed files with 55 additions and 57 deletions

View File

@ -1,4 +1,5 @@
import Quickshell.Io import Quickshell.Io
import QtQuick.Layouts
import QtQuick import QtQuick
import Quickshell.Services.Pipewire import Quickshell.Services.Pipewire
import qs.settings import qs.settings
@ -6,17 +7,12 @@ import qs.reusables
import qs import qs
Rectangle { Rectangle {
id: container id: root
radius: implicitHeight / 2 radius: implicitHeight / 2
color: pavuArea.containsMouse ? Colors.primaryContainer : Colors.surfaceContainer color: pavuArea.containsMouse ? Colors.primaryContainer : Colors.surfaceContainer
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
implicitWidth: root.implicitWidth + 20 implicitWidth: textRow.implicitWidth + 20
implicitHeight: Settings.config.barHeight - 10 implicitHeight: Settings.config.barHeight - 8
Item {
id: root
anchors.centerIn: parent
implicitWidth: textRow.width
implicitHeight: Settings.config.barHeight
property var sink: Pipewire.defaultAudioSink property var sink: Pipewire.defaultAudioSink
function getVolumeIcon() { function getVolumeIcon() {
// Safety check: if Pipewire is dead or sink is missing // Safety check: if Pipewire is dead or sink is missing
@ -40,13 +36,13 @@ Rectangle {
// If it's loud, prepare the ears! // If it's loud, prepare the ears!
return "volume_up"; return "volume_up";
} }
Row { RowLayout {
id: textRow id: textRow
anchors.centerIn: root spacing: 2
spacing: 5 anchors.centerIn: parent
CustomText { CustomText {
id: volumeText id: volumeText
anchors.verticalCenter: parent.verticalCenter
PwObjectTracker { PwObjectTracker {
objects: Pipewire.ready ? Pipewire.defaultAudioSink : [] objects: Pipewire.ready ? Pipewire.defaultAudioSink : []
} }
@ -55,7 +51,7 @@ Rectangle {
} }
CustomIcon { CustomIcon {
id: volumeIcon id: volumeIcon
anchors.verticalCenter: parent.verticalCenter 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
} }
@ -72,5 +68,4 @@ Rectangle {
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
hoverEnabled: true hoverEnabled: true
} }
}
} }

View File

@ -3,9 +3,11 @@ import qs.settings
import qs import qs
Text { Text {
verticalAlignment: Text.AlignVCenter
property bool fill: true property bool fill: true
font.family: fill ? "Material Symbols Rounded Filled" : "Material Symbols Rounded" font.family: fill ? "Material Symbols Rounded Filled" : "Material Symbols Rounded"
color: Colors.onSurfaceColor color: Colors.onSurfaceColor
font.pixelSize: Settings.config.fontSize + 2
font.variableAxes: ({ font.variableAxes: ({
GRAD: 100, GRAD: 100,
opsz: fill ? 48 : 20, opsz: fill ? 48 : 20,

View File

@ -3,6 +3,7 @@ import qs
import qs.settings import qs.settings
Text { Text {
verticalAlignment: Text.AlignVCenter
color: Colors.onSurfaceColor color: Colors.onSurfaceColor
font.family: Settings.config.font font.family: Settings.config.font
font.pixelSize: Settings.config.fontSize font.pixelSize: Settings.config.fontSize