xrootdatetime: force update on SIGUSR1

main
Zynh Ludwig 2024-10-30 21:11:25 -07:00
parent b0c18c7c15
commit adc11bc50a
1 changed files with 9 additions and 2 deletions

View File

@ -50,7 +50,7 @@ in
xsetroot = getExe pkgs.xorg.xsetroot;
in
/* bash */ ''
while true; do
function update_x_root() {
set +e # allow errors
mute="$(${pamixer} --default-source --get-mute)"
set -e # disallow errors
@ -63,7 +63,14 @@ in
dateTime=$(date +"<-- %A, %B %d -- %H:%M -->")
${xsetroot} -name "$mutedString$dateTime"
sleep 1
}
trap update_x_root SIGUSR1
while true; do
sleep 1 &
wait
update_x_root
done
'';
wantedBy = [ "graphical-session.target" ];