adapt Colors.qml to pull in colors from stylix

This commit is contained in:
lucy 2026-07-16 09:31:58 +02:00
commit 16343346ab
5 changed files with 98 additions and 86 deletions

View file

@ -18,15 +18,22 @@ Rectangle {
implicitHeight: moduleHeight
implicitWidth: batLayout.implicitWidth + 16
radius: Config.rounding
function batteryIcon() {
if (root.charging) { return "\uea33"; }
else if(root.percent <= 20) { return "\uea34" }
else if(root.percent <= 40) { return "\uea2f" }
else if(root.percent <= 60) { return "\uea30" }
else if(root.percent <= 80) { return "\uea31" }
else if(root.percent >= 80) { return "\uea32" }
}
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";
}
RowLayout {
id: batLayout
anchors.centerIn: root

View file

@ -9,7 +9,7 @@ import qs.settings
Rectangle {
id: root
color: clickHandler.containsMouse ? Colors.base02 : Colors.base01
property PwNode defaultAudio: Pipewire.ready ? Pipewire.preferredDefaultAudioSink : null
property PwNode defaultAudio: Pipewire.ready ? Pipewire.defaultAudioSink : null
property bool mute: Pipewire.ready ? defaultAudio?.audio.muted : null
radius: Config.rounding
required property double moduleHeight
@ -18,16 +18,16 @@ Rectangle {
function getVolumeIcon() {
let volume = Pipewire.ready ? root.defaultAudio.audio.volume : null;
if (root.mute) {
return "\uf1c3";
return "\ue04f";
}
if (volume <= 0.33) {
return "\u1019d";
return "\ue04e";
}
if (volume <= 0.66) {
return "\ueb4f";
return "\ue04d";
}
if (volume >= 0.66) {
return "\ueb51";
return "\ue050";
}
}