From 876dc3fc51009a1dbc6f09edd7a2794b20d73789 Mon Sep 17 00:00:00 2001 From: rope Date: Wed, 29 Jul 2026 22:48:31 +0100 Subject: [PATCH] quickshell: match caelestia volume, battery and brightness glyphs --- settings/quickshell.nix | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/settings/quickshell.nix b/settings/quickshell.nix index 51e429e..15c05c1 100644 --- a/settings/quickshell.nix +++ b/settings/quickshell.nix @@ -543,13 +543,20 @@ in Process { id: brightProc - property string osdIcon: "brightness_6" + property string osdIcon: "brightness" stdout: StdioCollector { // machine-readable: device,class,current,percent%,max onStreamFinished: { let f = text.trim().split("\n")[0].split(","); 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 { target: "osd" // floor 1%: `set 0%` turns the panel fully off - function brightnessUp(): void { root.setBrightness(["set", "5%+"], "brightness_6"); } - function brightnessDown(): void { root.setBrightness(["-n", "1", "set", "5%-"], "brightness_6"); } + function brightnessUp(): void { root.setBrightness(["set", "5%+"], "brightness"); } + function brightnessDown(): void { root.setBrightness(["-n", "1", "set", "5%-"], "brightness"); } function kbdUp(): 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`. component VolIcon: SIcon { 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 { anchors.fill: parent cursorShape: Qt.PointingHandCursor @@ -3141,7 +3154,7 @@ in spacing: 6 SIcon { anchors.verticalCenter: parent.verticalCenter - text: volWidget.muted ? "volume_off" : "volume_up" + text: volWidget.muted ? "no_sound" : "volume_up" font.pixelSize: 15 } SText { @@ -3616,7 +3629,9 @@ in Row { width: parent.width 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 { width: parent.width - 26 anchors.verticalCenter: parent.verticalCenter