From da03a3df96bed561151e72e69eee3cd3397443c6 Mon Sep 17 00:00:00 2001 From: Mark Nipper Date: Mon, 29 Apr 2024 01:41:19 -0700 Subject: Apply working xscreensaver configuration --- .../optional/desktops/services/xscreensaver.nix | 33 ++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'home') 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 + ''; } -- cgit v1.2.3