hyprlock: disable fingerprint, add battery/weather/notifications
- Disable fingerprint auth (GDM holds the device; hyprlock can't claim it, blocking the auth thread). - Fix date format escaping (single quotes). - Add battery, weather, and latest mako notification labels. - Add hyprlock wrapper (crash guard), battery script, notifications script, and weather script.
This commit is contained in:
Executable
+31
@@ -0,0 +1,31 @@
|
||||
#!/usr/bin/env bash
|
||||
# Guard wrapper for hyprlock (0.9.x): upstream has crashes on DPMS-off / monitor
|
||||
# power transitions while the lock screen is running (hyprlock#991, #953, #695).
|
||||
# If the real hyprlock dies, this restarts it so the session doesn't end up in a
|
||||
# "lockscreen app died" state. Requires misc:allow_session_lock_restore = true
|
||||
# in Hyprland config for the replacement lock to be accepted.
|
||||
|
||||
set -u
|
||||
|
||||
REAL_HYPRLOCK=/usr/bin/hyprlock
|
||||
MAX_RESTARTS=20
|
||||
|
||||
restart=0
|
||||
while true; do
|
||||
"$REAL_HYPRLOCK" "$@"
|
||||
code=$?
|
||||
|
||||
# 0: exited cleanly (e.g. unlocked) -- done.
|
||||
# 1: auth failed, retry -- let the loop back off and try again.
|
||||
if [ "$code" -eq 0 ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
restart=$((restart + 1))
|
||||
if [ "$restart" -ge "$MAX_RESTARTS" ]; then
|
||||
exit "$code"
|
||||
fi
|
||||
|
||||
# Brief pause so a crash loop doesn't burn CPU (fade back in quickly).
|
||||
sleep 0.5
|
||||
done
|
||||
Executable
+39
@@ -0,0 +1,39 @@
|
||||
#!/usr/bin/env bash
|
||||
# Battery status for the hyprlock screen, e.g. " 18%".
|
||||
# Uses the first battery found under /sys/class/power_supply (BAT0/BAT1, ...);
|
||||
# prints nothing on desktops without a battery.
|
||||
set -u
|
||||
|
||||
bat=""
|
||||
for b in /sys/class/power_supply/BAT*; do
|
||||
if [ -r "${b}/capacity" ]; then
|
||||
bat="${b}"
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
[ -z "${bat}" ] && exit 0
|
||||
|
||||
cap="$(cat "${bat}/capacity" 2>/dev/null || echo 0)"
|
||||
status="$(cat "${bat}/status" 2>/dev/null || echo Unknown)"
|
||||
|
||||
case "${status}" in
|
||||
Charging|Full)
|
||||
icon=""
|
||||
;;
|
||||
*)
|
||||
if [ "${cap}" -ge 80 ]; then
|
||||
icon=""
|
||||
elif [ "${cap}" -ge 60 ]; then
|
||||
icon=""
|
||||
elif [ "${cap}" -ge 40 ]; then
|
||||
icon=""
|
||||
elif [ "${cap}" -ge 20 ]; then
|
||||
icon=""
|
||||
else
|
||||
icon=""
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
printf '%s %s%%' "${icon}" "${cap}"
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
#!/usr/bin/env bash
|
||||
# Latest mako notification for the hyprlock screen, Pango-escaped, e.g.
|
||||
# "Battery test: Battery at 18%". Prints nothing when there are no
|
||||
# notifications, so the label renders empty.
|
||||
set -u
|
||||
|
||||
makoctl list -j 2>/dev/null | jq -r '
|
||||
if length == 0 then
|
||||
empty
|
||||
else
|
||||
.[-1] as $n |
|
||||
(if $n.app_name != null and $n.app_name != "" then $n.app_name + ": " else "" end) +
|
||||
($n.summary // "") +
|
||||
(if $n.body != null and $n.body != "" then " — " + $n.body[0:80] else "" end)
|
||||
end' 2>/dev/null | sed 's/&/\&/g; s/</\</g; s/>/\>/g'
|
||||
Reference in New Issue
Block a user