From b0c18c7c152acc8ac3300962209a673979fe9fd5 Mon Sep 17 00:00:00 2001 From: Zynh Ludwig Date: Wed, 30 Oct 2024 20:33:17 -0700 Subject: [PATCH] xrootdatetime: fixing crash on initial boot xrootdatetime: trying to fix crashes xrootdatetime: allow errors --- modules/dwm.nix | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/modules/dwm.nix b/modules/dwm.nix index 6b03c34..ce90302 100644 --- a/modules/dwm.nix +++ b/modules/dwm.nix @@ -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";