xrootdatetime: fixing crash on initial boot

xrootdatetime: trying to fix crashes
xrootdatetime: allow errors
main
Zynh Ludwig 2024-10-30 20:33:17 -07:00
parent 28573bd36d
commit b0c18c7c15
1 changed files with 22 additions and 12 deletions

View File

@ -44,18 +44,28 @@ in
};
systemd.user.services.xrootdatetime = {
script = ''
while true; do
if [[ "$(${getExe pkgs.pamixer} --default-source --get-mute)" == "true" ]]; then
mutedString="Mic Muted "
else
mutedString=""
fi
dateTime=$(date +"<-- %A, %B %d -- %H:%M -->")
${getExe pkgs.xorg.xsetroot} -name "$mutedString$dateTime"
sleep 1
done
'';
script =
let
pamixer = getExe pkgs.pamixer;
xsetroot = getExe pkgs.xorg.xsetroot;
in
/* bash */ ''
while true; do
set +e # allow errors
mute="$(${pamixer} --default-source --get-mute)"
set -e # disallow errors
if [[ "$mute" == "true" ]]; then
mutedString="Mic Muted "
else
mutedString=""
fi
dateTime=$(date +"<-- %A, %B %d -- %H:%M -->")
${xsetroot} -name "$mutedString$dateTime"
sleep 1
done
'';
wantedBy = [ "graphical-session.target" ];
after = [ "pipewire.service" ];
serviceConfig.Restart = "on-failure";