diff options
-rw-r--r-- | home/nipsy/common/optional/desktops/services/xscreensaver.nix | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/home/nipsy/common/optional/desktops/services/xscreensaver.nix b/home/nipsy/common/optional/desktops/services/xscreensaver.nix index 1d1dcb5..be9497d 100644 --- a/home/nipsy/common/optional/desktops/services/xscreensaver.nix +++ b/home/nipsy/common/optional/desktops/services/xscreensaver.nix @@ -1,5 +1,38 @@ +{ lib, ... }: { services.xscreensaver = { enable = true; }; + + home.activation.xscreensaver = lib.hm.dag.entryAfter ["writeBoundary"] '' + conf=$HOME/.xscreensaver + + if grep -q '^fade:'$'\t' $conf; then + run sed -i -e 's/^fade:\t.*$/fade:\t\tFalse/' $conf + else + run echo -e 'fade:\t\tFalse' >> $conf + fi + + if grep -q '^mode:'$'\t' $conf; then + run sed -i -e 's/^mode:\t.*$/mode:\t\trandom/' $conf + else + run echo -e 'mode:\t\trandom' >> $conf + fi + + if grep -q '^splash:'$'\t' $conf; then + run sed -i -e 's/^splash:\t.*$/splash:\t\tFalse/' $conf + else + run echo -e 'splash:\t\tFalse' >> $conf + fi + + if grep -q '^timeout:'$'\t' $conf; then + run sed -i -e 's/^timeout:\t.*$/timeout:\t0:10:00/' $conf + else + run echo -e 'timeout:\t0:10:00' >> $conf + fi + + if /run/current-system/sw/bin/systemctl --user --quiet is-active xscreensaver.service; then + /run/current-system/sw/bin/systemctl --user restart xscreensaver.service + fi + ''; } |