diff --git a/settings/quickshell.nix b/settings/quickshell.nix index 4741fdb..0c14177 100644 --- a/settings/quickshell.nix +++ b/settings/quickshell.nix @@ -4105,65 +4105,6 @@ in } ''} - ${lib.optionalString (!isMacbook) '' - // Wireless mouse battery — polled off the Keychron - // receiver via the mouse-battery script. Hidden while the - // mouse is off/asleep or the receiver is unplugged. - Item { - id: mouseBatWidget - visible: level > 0 - width: Theme.barWidth - height: mouseBatCol.height - - property int level: 0 - property bool charging: false - property color tint: charging ? Theme.accent - : level <= 15 ? Theme.err - : level <= 30 ? Theme.warn - : Theme.base05 - - Process { - id: mouseBatProc - command: [Commands.mouseBattery] - stdout: StdioCollector { - onStreamFinished: { - const f = text.trim().split(" "); - mouseBatWidget.level = parseInt(f[0]) || 0; - mouseBatWidget.charging = f[1] === "charging"; - } - } - } - - Timer { - interval: 60000 - repeat: true - running: true - triggeredOnStart: true - onTriggered: mouseBatProc.running = true - } - - Column { - id: mouseBatCol - anchors.horizontalCenter: parent.horizontalCenter - spacing: 0 - - SIcon { - anchors.horizontalCenter: parent.horizontalCenter - text: "mouse" - color: mouseBatWidget.tint - font.pixelSize: 16 - } - - SText { - anchors.horizontalCenter: parent.horizontalCenter - text: mouseBatWidget.level - color: mouseBatWidget.tint - font.pixelSize: 10 - } - } - } - ''} - // Quick settings — present on every host, so the shared // controls sit in the same place on all of them. Item { @@ -5533,6 +5474,87 @@ in width: 240 spacing: 8 + ${lib.optionalString (!isMacbook) '' + // Wireless mouse battery, read off the Keychron + // receiver by the mouse-battery script. Polls only + // while the panel is up; hidden while the mouse is + // off/asleep or the receiver is unplugged. + Card { + id: mouseBatCard + visible: level > 0 + width: parent.width + + property int level: 0 + property bool charging: false + property color tint: charging ? Theme.accent + : level <= 15 ? Theme.err + : level <= 30 ? Theme.warn + : Theme.base05 + + Process { + id: mouseBatProc + command: [Commands.mouseBattery] + stdout: StdioCollector { + onStreamFinished: { + const f = text.trim().split(" "); + mouseBatCard.level = parseInt(f[0]) || 0; + mouseBatCard.charging = f[1] === "charging"; + } + } + } + + Timer { + interval: 30000 + repeat: true + triggeredOnStart: true + running: qsDropdown.visible + onTriggered: mouseBatProc.running = true + } + + Item { + width: parent.width + height: 20 + + Row { + spacing: 6 + anchors.verticalCenter: parent.verticalCenter + SIcon { + anchors.verticalCenter: parent.verticalCenter + text: "mouse" + font.pixelSize: 15 + } + SText { + anchors.verticalCenter: parent.verticalCenter + text: "Mouse" + font.weight: Font.Medium + } + } + + Row { + anchors.right: parent.right + anchors.verticalCenter: parent.verticalCenter + spacing: 4 + SIcon { + anchors.verticalCenter: parent.verticalCenter + text: mouseBatCard.charging ? "battery-charging" + : mouseBatCard.level >= 75 ? "battery-full" + : mouseBatCard.level >= 50 ? "battery-medium" + : mouseBatCard.level >= 20 ? "battery-low" + : "battery" + color: mouseBatCard.tint + font.pixelSize: 15 + } + SText { + anchors.verticalCenter: parent.verticalCenter + text: mouseBatCard.level + "%" + color: mouseBatCard.tint + font.pixelSize: 11 + } + } + } + } + ''} + // Screen recorder. wf-recorder is held as a live // Process (not execDetached) so Stop can SIGINT it; // slurp's region pick happens inside the script,