xrootdatetime: force update on SIGUSR1

This commit is contained in:
Zynh Ludwig 2024-10-30 21:11:25 -07:00
parent b0c18c7c15
commit adc11bc50a

View file

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