fix(desktop): hardware findings — charge limit, polkit ws, bar deps
All checks were successful
Check / eval (push) Successful in 3m3s

Latitude 5310 QA:
- Clock tooltip: drop empty {calendar} popup; plain date+zone
- Charge limit: restart oneshot via polkit + dual write/delay for
  Dell unplug race; toast verifies sysfs; looser menu match
- pwvucontrol ships with waybar (right-click volume)
- Print/region→clipboard toasts success
- Polkit (and pinentry) open on current workspace + stayfocused

V0: flake check --no-build green. V3: retest A3/A4/B1/tooltip/polkit.
This commit is contained in:
2026-07-10 13:29:44 +01:00
parent 3bc8a46927
commit 910f357f08
11 changed files with 134 additions and 42 deletions

View File

@@ -493,10 +493,17 @@ in
# Polkit auth (hyprpolkitagent — app id / binary name in the package)
# and pinentry-qt (keys.nix default; org.gnupg.pinentry-qt desktop).
# workspace current: agent was started on ws1 at login; without this
# the dialog opens on that workspace and the current one looks dead
# (hardware: Snapshots menu from ws≠1). stayfocused so it grabs
# attention when it lands.
"float 1, match:class (?i)^(hyprpolkitagent|\\.hyprpolkitagent-wrapped)$"
"center 1, match:class (?i)^(hyprpolkitagent|\\.hyprpolkitagent-wrapped)$"
"workspace current, match:class (?i)^(hyprpolkitagent|\\.hyprpolkitagent-wrapped)$"
"stayfocused 1, match:class (?i)^(hyprpolkitagent|\\.hyprpolkitagent-wrapped)$"
"float 1, match:class (?i)^(pinentry(-qt)?|org\\.gnupg\\.pinentry-qt)$"
"center 1, match:class (?i)^(pinentry(-qt)?|org\\.gnupg\\.pinentry-qt)$"
"workspace current, match:class (?i)^(pinentry(-qt)?|org\\.gnupg\\.pinentry-qt)$"
];
# Rendered from ./keybinds.nix (the cheatsheet reads the same list),

View File

@@ -72,7 +72,7 @@
# Bare Print → region to clipboard; the two → file binds save a
# timestamped PNG under ~/Pictures/Screenshots and toast the path, the
# same plumbing the Capture menu's "→ file" rows use.
{ mods = ""; key = "Print"; action = "exec, grim -g \"$(slurp)\" - | wl-copy"; desc = "Screenshot region clipboard"; }
{ mods = ""; key = "Print"; action = "exec, grim -g \"$(slurp)\" - | wl-copy && notify-send Screenshot \"Region copied to clipboard.\""; desc = "Screenshot region clipboard"; }
{ mods = "SHIFT"; key = "Print"; action = "exec, f=$HOME/Pictures/Screenshots/$(date +%Y%m%d-%H%M%S).png; mkdir -p $HOME/Pictures/Screenshots && grim -g \"$(slurp)\" \"$f\" && notify-send \"Screenshot saved\" \"$f\""; desc = "Screenshot region file"; }
{ mods = "CTRL"; key = "Print"; action = "exec, f=$HOME/Pictures/Screenshots/$(date +%Y%m%d-%H%M%S).png; mkdir -p $HOME/Pictures/Screenshots && grim \"$f\" && notify-send \"Screenshot saved\" \"$f\""; desc = "Screenshot screen file"; }
{ mods = "$mod SHIFT"; key = "Print"; action = "exec, f=$HOME/Pictures/Screenshots/$(date +%Y%m%d-%H%M%S).png; mkdir -p $HOME/Pictures/Screenshots && grim -g \"$(slurp)\" - | satty --filename - --fullscreen --output-filename \"$f\""; desc = "Annotate region"; }

View File

@@ -321,26 +321,48 @@ let
fi
back
} | rofi_menu -show-icons -p "Power profile: ''${curp:-n/a}, limit: ''${curc:-default}") || exit 0
# Persist in-flake + apply live to sysfs (udev makes the node
# group-writable for users Bernardo 2026-07-10).
# Persist in-flake, then re-apply via the root oneshot (polkit
# allows users to restart it) so a non-writable sysfs node still
# updates. Fallback: direct echo if the node is group-writable.
set_limit() {
nomarchy-theme-sync --quiet set settings.power.batteryChargeLimit "$1" --no-switch
n="$1"; [ "$n" = null ] && n=100
applied=
if systemctl restart nomarchy-battery-charge-limit.service 2>/dev/null; then
applied=1
else
for d in /sys/class/power_supply/*/; do
[ "$(cat "$d/type" 2>/dev/null)" = Battery ] || continue
[ "$(cat "$d/scope" 2>/dev/null || echo System)" = Device ] && continue
thresh="$d/charge_control_end_threshold"
if [ -w "$thresh" ] && echo "$n" > "$thresh" 2>/dev/null; then
applied=1
fi
done
fi
actual=
for d in /sys/class/power_supply/*/; do
[ "$(cat "$d/type" 2>/dev/null)" = Battery ] || continue
[ "$(cat "$d/scope" 2>/dev/null || echo System)" = Device ] && continue
thresh="$d/charge_control_end_threshold"
[ -w "$thresh" ] && echo "$n" > "$thresh" 2>/dev/null || true
[ -r "$d/charge_control_end_threshold" ] \
&& actual=$(cat "$d/charge_control_end_threshold" 2>/dev/null) && break
done
notify-send "Battery limit" "$2 applied now."
if [ -n "$applied" ] && [ -n "$actual" ]; then
notify-send "Battery limit" "$2 sysfs now $actual%."
elif [ -n "$applied" ]; then
notify-send "Battery limit" "$2 applied (could not re-read sysfs)."
else
notify-send -u critical "Battery limit" \
"Saved in theme-state but could not write sysfs (need rebuild or users-group on threshold)."
fi
}
case "$choice" in
"$BACK") exec "$0" ;;
"Profile: "*) powerprofilesctl set "''${choice#Profile: }" ;;
"Charge limit: 80%"*) set_limit 80 "Set to 80%" ;;
"Charge limit: 90%"*) set_limit 90 "Set to 90%" ;;
"Charge limit: 60%"*) set_limit 60 "Set to 60%" ;;
"Charge limit: Off"*) set_limit null "Off charges to 100%" ;;
*"Charge limit: 80%"*) set_limit 80 "Set to 80%" ;;
*"Charge limit: 90%"*) set_limit 90 "Set to 90%" ;;
*"Charge limit: 60%"*) set_limit 60 "Set to 60%" ;;
*"Charge limit: Off"*) set_limit null "Off charges to 100%" ;;
esac ;;
theme)
@@ -521,7 +543,9 @@ ${themeRows}
file="$dir/$(date +%Y%m%d-%H%M%S).png"
case "$choice" in
"$BACK") exec "$0" tools ;;
*"Region clipboard"*) grim -g "$(slurp)" - | wl-copy ;;
*"Region clipboard"*)
grim -g "$(slurp)" - | wl-copy \
&& notify-send "Screenshot" "Region copied to clipboard." ;;
*"Region file"*) mkdir -p "$dir"; grim -g "$(slurp)" "$file" \
&& notify-send "Screenshot saved" "$file" ;;
*"Annotate region"*) mkdir -p "$dir"; grim -g "$(slurp)" - | satty --filename - --fullscreen --output-filename "$file" ;;
@@ -535,7 +559,9 @@ ${themeRows}
|| { notify-send "OCR" "No text recognized in that region."; exit 0; }
printf '%s' "$txt" | wl-copy
notify-send "OCR" "Copied $(printf '%s' "$txt" | wc -w) word(s) to the clipboard." ;;
*"Full screen clipboard"*) grim - | wl-copy ;;
*"Full screen clipboard"*)
grim - | wl-copy \
&& notify-send "Screenshot" "Screen copied to clipboard." ;;
*"Full screen file"*) mkdir -p "$dir"; grim "$file" \
&& notify-send "Screenshot saved" "$file" ;;
*"Stop recording"*) exec nomarchy-record stop ;;
@@ -937,21 +963,43 @@ ${themeRows}
set_limit() {
nomarchy-theme-sync --quiet set settings.power.batteryChargeLimit "$1" --no-switch
n="$1"; [ "$n" = null ] && n=100
applied=
if systemctl restart nomarchy-battery-charge-limit.service 2>/dev/null; then
applied=1
else
for d in /sys/class/power_supply/*/; do
[ "$(cat "$d/type" 2>/dev/null)" = Battery ] || continue
[ "$(cat "$d/scope" 2>/dev/null || echo System)" = Device ] && continue
thresh="$d/charge_control_end_threshold"
if [ -w "$thresh" ] && echo "$n" > "$thresh" 2>/dev/null; then
applied=1
fi
done
fi
actual=
for d in /sys/class/power_supply/*/; do
[ "$(cat "$d/type" 2>/dev/null)" = Battery ] || continue
[ "$(cat "$d/scope" 2>/dev/null || echo System)" = Device ] && continue
thresh="$d/charge_control_end_threshold"
[ -w "$thresh" ] && echo "$n" > "$thresh" 2>/dev/null || true
[ -r "$d/charge_control_end_threshold" ] \
&& actual=$(cat "$d/charge_control_end_threshold" 2>/dev/null) && break
done
notify-send "Battery limit" "$2 applied now."
if [ -n "$applied" ] && [ -n "$actual" ]; then
notify-send "Battery limit" "$2 sysfs now $actual%."
elif [ -n "$applied" ]; then
notify-send "Battery limit" "$2 applied (could not re-read sysfs)."
else
notify-send -u critical "Battery limit" \
"Saved in theme-state but could not write sysfs (need rebuild or users-group on threshold)."
fi
}
case "$sel" in
"$BACK") exec "$0" system ;;
"80%"*) set_limit 80 "Set to 80%" ;;
"90%"*) set_limit 90 "Set to 90%" ;;
"60%"*) set_limit 60 "Set to 60%" ;;
"Off"*) set_limit null "Off charges to 100%" ;;
"Custom"*)
# Order: Off (100%) before 90/80/60 so "100%" does not hit *0%* patterns.
*Off*|*100%*) set_limit null "Off charges to 100%" ;;
*90%*) set_limit 90 "Set to 90%" ;;
*80%*) set_limit 80 "Set to 80%" ;;
*60%*) set_limit 60 "Set to 60%" ;;
*Custom*)
limit=$(rofi_menu -p "Charge limit % (50100)" < /dev/null) || exit 0
[ -n "$limit" ] || exit 0
case "$limit" in

View File

@@ -204,12 +204,14 @@ let
# into clock + clock#date — one click surface for the calendar).
format = "{:%H:%M · %a %d %b}";
# Left-click → the calendar (nomarchy-calendar → calcurse in a floating
# ghostty). Long weekday/month name + zone + month grid ride in the
# tooltip so the bar stays compact.
# ghostty). Tooltip is plain date/zone only — embedding {calendar}
# produced an empty popup on hardware (2026-07-10); month view is
# one click away.
on-click = "nomarchy-calendar";
tooltip = true;
# The zone line stays live under auto-timezone (the tz-watch SIGUSR2
# reload keeps it showing the currently *detected* zone).
tooltip-format = "{:%A %d %B %Y}\n{:%Z (UTC%z)}\n<tt><small>{calendar}</small></tt>";
tooltip-format = "{:%A, %d %B %Y}\n{:%Z (UTC%z)}";
};
# Active keyboard layout (per focused device) — only placed in
@@ -503,10 +505,12 @@ in
);
};
# The power-profile helpers on PATH, so both the generated bar and the
# whole-swap themes' static waybar.jsonc can exec them by name — plus
# the supervisor hyprland.nix exec-onces. calcurse is the clock-click
# calendar (feature dependency of the bar, not an opt-in app).
# Bar helpers on PATH (whole-swap jsoncs exec them by bare name) +
# feature deps of bar clicks: calcurse (clock), pwvucontrol (volume
# right-click) — not opt-in template packages.
home.packages = lib.optionals config.nomarchy.waybar.enable
[ waybarSupervisor powerProfileStatus powerProfileCycle vpnStatus doctorStatus calendarLauncher pkgs.calcurse ];
[ waybarSupervisor powerProfileStatus powerProfileCycle vpnStatus doctorStatus calendarLauncher
pkgs.calcurse
pkgs.pwvucontrol
];
}