quickshell: match caelestia volume, battery and brightness glyphs

This commit is contained in:
rope 2026-07-29 22:48:31 +01:00
parent 1b59058b91
commit 876dc3fc51

View file

@ -543,13 +543,20 @@ in
Process { Process {
id: brightProc id: brightProc
property string osdIcon: "brightness_6" property string osdIcon: "brightness"
stdout: StdioCollector { stdout: StdioCollector {
// machine-readable: device,class,current,percent%,max // machine-readable: device,class,current,percent%,max
onStreamFinished: { onStreamFinished: {
let f = text.trim().split("\n")[0].split(","); let f = text.trim().split("\n")[0].split(",");
if (f.length < 5) return; if (f.length < 5) return;
root.osdBrightness(brightProc.osdIcon, parseInt(f[3]) / 100); let v = parseInt(f[3]) / 100;
// "brightness" is a request to grade the glyph by
// level (caelestia's OSD mapping); the kbd path
// passes a literal icon instead.
let ic = brightProc.osdIcon === "brightness"
? "brightness_" + (Math.round(v * 6) + 1)
: brightProc.osdIcon;
root.osdBrightness(ic, v);
} }
} }
} }
@ -566,8 +573,8 @@ in
IpcHandler { IpcHandler {
target: "osd" target: "osd"
// floor 1%: `set 0%` turns the panel fully off // floor 1%: `set 0%` turns the panel fully off
function brightnessUp(): void { root.setBrightness(["set", "5%+"], "brightness_6"); } function brightnessUp(): void { root.setBrightness(["set", "5%+"], "brightness"); }
function brightnessDown(): void { root.setBrightness(["-n", "1", "set", "5%-"], "brightness_6"); } function brightnessDown(): void { root.setBrightness(["-n", "1", "set", "5%-"], "brightness"); }
function kbdUp(): void { root.setBrightness(["-d", "smc::kbd_backlight", "set", "10%+"], "keyboard"); } function kbdUp(): void { root.setBrightness(["-d", "smc::kbd_backlight", "set", "10%+"], "keyboard"); }
function kbdDown(): void { root.setBrightness(["-d", "smc::kbd_backlight", "set", "10%-"], "keyboard"); } function kbdDown(): void { root.setBrightness(["-d", "smc::kbd_backlight", "set", "10%-"], "keyboard"); }
} }
@ -816,7 +823,13 @@ in
// with a fill that greys when `audioNode.muted`. // with a fill that greys when `audioNode.muted`.
component VolIcon: SIcon { component VolIcon: SIcon {
property var audioNode: null property var audioNode: null
text: (audioNode && audioNode.muted) ? "volume_off" : "volume_up" // caelestia's getVolumeIcon, so the slider's glyph tracks
// its level and not just the mute flag.
text: !audioNode ? "volume_up"
: audioNode.muted ? "no_sound"
: audioNode.volume >= 0.5 ? "volume_up"
: audioNode.volume > 0 ? "volume_down"
: "volume_mute"
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
@ -3141,7 +3154,7 @@ in
spacing: 6 spacing: 6
SIcon { SIcon {
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
text: volWidget.muted ? "volume_off" : "volume_up" text: volWidget.muted ? "no_sound" : "volume_up"
font.pixelSize: 15 font.pixelSize: 15
} }
SText { SText {
@ -3616,7 +3629,9 @@ in
Row { Row {
width: parent.width width: parent.width
spacing: 8 spacing: 8
SIcon { width: 18; anchors.verticalCenter: parent.verticalCenter; text: "brightness_6"; font.pixelSize: 16 } // caelestia's OSD mapping: the glyph tracks the
// level instead of sitting on one static step.
SIcon { width: 18; anchors.verticalCenter: parent.verticalCenter; text: "brightness_" + (Math.round(brightCard.screenB * 6) + 1); font.pixelSize: 16 }
PillSlider { PillSlider {
width: parent.width - 26 width: parent.width - 26
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter