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,15 +44,25 @@ in
};
systemd.user.services.xrootdatetime = {
script = ''
script =
let
pamixer = getExe pkgs.pamixer;
xsetroot = getExe pkgs.xorg.xsetroot;
in
/* bash */ ''
while true; do
if [[ "$(${getExe pkgs.pamixer} --default-source --get-mute)" == "true" ]]; then
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 -->")
${getExe pkgs.xorg.xsetroot} -name "$mutedString$dateTime"
${xsetroot} -name "$mutedString$dateTime"
sleep 1
done
'';