fix(waybar): show the power-profile indicator in the summer themes
custom/powerprofile only appeared in the generated bar -- its exec was a writeShellScript store path, which can't go in the summer themes' static whole-swap waybar.jsonc, so summer-day/night were missing it (the DND bell already had parity). Promote powerProfileStatus/Cycle to named writeShellScriptBins on PATH (waybar.nix home.packages) and reference them by bare name, then add custom/powerprofile to both summer waybar.jsonc + their waybar.css. Same pattern as the swaync bell. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -204,15 +204,12 @@ how to override it. Items marked ✓ are shipped.
|
|||||||
idle behaviour.
|
idle behaviour.
|
||||||
- Remaining: a boot-only→event-driven charge-limit re-apply (udev) if a
|
- Remaining: a boot-only→event-driven charge-limit re-apply (udev) if a
|
||||||
firmware resets the threshold on unplug.
|
firmware resets the threshold on unplug.
|
||||||
- Remaining: the `custom/powerprofile` Waybar indicator only lands in the
|
- ✓ **Waybar parity:** the `custom/powerprofile` indicator now shows in the
|
||||||
generated config — the summer-day/night whole-swap `waybar.jsonc` don't
|
summer-day/night whole-swap themes too. `powerProfileStatus`/`Cycle` are
|
||||||
show it (the module's exec points at Nix-built script store paths, which
|
named `writeShellScriptBin`s on PATH (`waybar.nix` home.packages), so the
|
||||||
can't go in static JSON). Fix by promoting `powerProfileStatus`/`Cycle`
|
generated config and the static `waybar.jsonc` both exec them by bare
|
||||||
from `writeShellScript` to named `writeShellScriptBin`s on PATH, then
|
name (the same parity the DND bell has). General pattern: any new
|
||||||
reference them by bare name from both the generated config and the
|
generated-config module needs adding to the whole-swap themes too.
|
||||||
whole-swap themes (the same parity the DND bell now has). General
|
|
||||||
pattern: any new generated-config module needs adding to the whole-swap
|
|
||||||
themes too.
|
|
||||||
- **Full hardware enablement (beyond nixos-hardware):** nixos-hardware
|
- **Full hardware enablement (beyond nixos-hardware):** nixos-hardware
|
||||||
profiles cover *basic* per-model functionality (quirks, drivers), but the
|
profiles cover *basic* per-model functionality (quirks, drivers), but the
|
||||||
*advanced* features of a machine — keyed more on the CPU/GPU generation
|
*advanced* features of a machine — keyed more on the CPU/GPU generation
|
||||||
|
|||||||
@@ -17,7 +17,11 @@ let
|
|||||||
# present) running PPD, so the module hides itself on desktops and
|
# present) running PPD, so the module hides itself on desktops and
|
||||||
# under the TLP backend — no system→home coupling. Speedometer glyphs
|
# under the TLP backend — no system→home coupling. Speedometer glyphs
|
||||||
# (slow/medium/fast) map to power-saver/balanced/performance.
|
# (slow/medium/fast) map to power-saver/balanced/performance.
|
||||||
powerProfileStatus = pkgs.writeShellScript "nomarchy-powerprofile-status" ''
|
#
|
||||||
|
# Named writeShellScriptBins (put on PATH via home.packages below) rather
|
||||||
|
# than bare writeShellScript store paths, so the whole-swap themes' static
|
||||||
|
# waybar.jsonc can exec them by name too — same as the swaync bell.
|
||||||
|
powerProfileStatus = pkgs.writeShellScriptBin "nomarchy-powerprofile-status" ''
|
||||||
case "$(ls /sys/class/power_supply/ 2>/dev/null)" in *BAT*) ;; *) exit 0 ;; esac
|
case "$(ls /sys/class/power_supply/ 2>/dev/null)" in *BAT*) ;; *) exit 0 ;; esac
|
||||||
command -v powerprofilesctl >/dev/null 2>&1 || exit 0
|
command -v powerprofilesctl >/dev/null 2>&1 || exit 0
|
||||||
prof=$(powerprofilesctl get 2>/dev/null) || exit 0
|
prof=$(powerprofilesctl get 2>/dev/null) || exit 0
|
||||||
@@ -29,7 +33,7 @@ let
|
|||||||
printf '{"text":"%s","tooltip":"Power profile: %s","class":"%s"}\n' "$icon" "$prof" "$prof"
|
printf '{"text":"%s","tooltip":"Power profile: %s","class":"%s"}\n' "$icon" "$prof" "$prof"
|
||||||
'';
|
'';
|
||||||
# Cycle to the next profile this machine actually offers (wraps around).
|
# Cycle to the next profile this machine actually offers (wraps around).
|
||||||
powerProfileCycle = pkgs.writeShellScript "nomarchy-powerprofile-cycle" ''
|
powerProfileCycle = pkgs.writeShellScriptBin "nomarchy-powerprofile-cycle" ''
|
||||||
command -v powerprofilesctl >/dev/null 2>&1 || exit 0
|
command -v powerprofilesctl >/dev/null 2>&1 || exit 0
|
||||||
cur=$(powerprofilesctl get 2>/dev/null) || exit 0
|
cur=$(powerprofilesctl get 2>/dev/null) || exit 0
|
||||||
avail=$(powerprofilesctl list 2>/dev/null | sed -nE 's/^[* ] ([a-z-]+):$/\1/p')
|
avail=$(powerprofilesctl list 2>/dev/null | sed -nE 's/^[* ] ([a-z-]+):$/\1/p')
|
||||||
@@ -112,10 +116,10 @@ let
|
|||||||
};
|
};
|
||||||
|
|
||||||
"custom/powerprofile" = {
|
"custom/powerprofile" = {
|
||||||
exec = "${powerProfileStatus}";
|
exec = "nomarchy-powerprofile-status";
|
||||||
return-type = "json";
|
return-type = "json";
|
||||||
interval = 5;
|
interval = 5;
|
||||||
on-click = "${powerProfileCycle}";
|
on-click = "nomarchy-powerprofile-cycle";
|
||||||
};
|
};
|
||||||
|
|
||||||
# swaync notification bell + Do-Not-Disturb state. `-swb` streams JSON
|
# swaync notification bell + Do-Not-Disturb state. `-swb` streams JSON
|
||||||
@@ -227,4 +231,9 @@ in
|
|||||||
else generatedStyle
|
else generatedStyle
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# The power-profile helpers on PATH, so both the generated bar and the
|
||||||
|
# whole-swap themes' static waybar.jsonc can exec them by name.
|
||||||
|
home.packages = lib.optionals config.nomarchy.waybar.enable
|
||||||
|
[ powerProfileStatus powerProfileCycle ];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ window#waybar {
|
|||||||
#workspaces,
|
#workspaces,
|
||||||
#pulseaudio,
|
#pulseaudio,
|
||||||
#network,
|
#network,
|
||||||
|
#custom-powerprofile,
|
||||||
#battery,
|
#battery,
|
||||||
#tray,
|
#tray,
|
||||||
#custom-notification,
|
#custom-notification,
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
"modules-left": ["custom/launcher", "clock", "clock#date"],
|
"modules-left": ["custom/launcher", "clock", "clock#date"],
|
||||||
"modules-center": ["hyprland/workspaces"],
|
"modules-center": ["hyprland/workspaces"],
|
||||||
"modules-right": ["pulseaudio", "network", "battery", "tray", "custom/notification", "custom/powermenu"],
|
"modules-right": ["pulseaudio", "network", "custom/powerprofile", "battery", "tray", "custom/notification", "custom/powermenu"],
|
||||||
|
|
||||||
"hyprland/workspaces": {
|
"hyprland/workspaces": {
|
||||||
"disable-scroll": true,
|
"disable-scroll": true,
|
||||||
@@ -80,6 +80,13 @@
|
|||||||
|
|
||||||
"tray": { "spacing": 8 },
|
"tray": { "spacing": 8 },
|
||||||
|
|
||||||
|
"custom/powerprofile": {
|
||||||
|
"return-type": "json",
|
||||||
|
"interval": 5,
|
||||||
|
"exec": "nomarchy-powerprofile-status",
|
||||||
|
"on-click": "nomarchy-powerprofile-cycle"
|
||||||
|
},
|
||||||
|
|
||||||
"custom/notification": {
|
"custom/notification": {
|
||||||
"format": "{icon}",
|
"format": "{icon}",
|
||||||
"return-type": "json",
|
"return-type": "json",
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ window#waybar {
|
|||||||
#workspaces,
|
#workspaces,
|
||||||
#pulseaudio,
|
#pulseaudio,
|
||||||
#network,
|
#network,
|
||||||
|
#custom-powerprofile,
|
||||||
#idle_inhibitor,
|
#idle_inhibitor,
|
||||||
#battery,
|
#battery,
|
||||||
#custom-notification,
|
#custom-notification,
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
"modules-left": ["custom/nomarchy", "clock", "clock#date"],
|
"modules-left": ["custom/nomarchy", "clock", "clock#date"],
|
||||||
"modules-center": ["hyprland/workspaces"],
|
"modules-center": ["hyprland/workspaces"],
|
||||||
"modules-right": ["idle_inhibitor", "pulseaudio", "network", "battery", "tray", "custom/notification", "custom/powermenu"],
|
"modules-right": ["idle_inhibitor", "pulseaudio", "network", "custom/powerprofile", "battery", "tray", "custom/notification", "custom/powermenu"],
|
||||||
|
|
||||||
"hyprland/workspaces": {
|
"hyprland/workspaces": {
|
||||||
"disable-scroll": true,
|
"disable-scroll": true,
|
||||||
@@ -87,6 +87,13 @@
|
|||||||
|
|
||||||
"tray": { "spacing": 8 },
|
"tray": { "spacing": 8 },
|
||||||
|
|
||||||
|
"custom/powerprofile": {
|
||||||
|
"return-type": "json",
|
||||||
|
"interval": 5,
|
||||||
|
"exec": "nomarchy-powerprofile-status",
|
||||||
|
"on-click": "nomarchy-powerprofile-cycle"
|
||||||
|
},
|
||||||
|
|
||||||
"custom/notification": {
|
"custom/notification": {
|
||||||
"format": "{icon}",
|
"format": "{icon}",
|
||||||
"return-type": "json",
|
"return-type": "json",
|
||||||
|
|||||||
Reference in New Issue
Block a user