From bc9612dc5259f2c090ee16941c1b7fca36213688 Mon Sep 17 00:00:00 2001 From: iFargle Date: Wed, 3 Jan 2024 18:03:56 +0900 Subject: [PATCH] Test --- nixos/common/desktops/plasma6/default.nix | 31 ++++++----------------- 1 file changed, 8 insertions(+), 23 deletions(-) diff --git a/nixos/common/desktops/plasma6/default.nix b/nixos/common/desktops/plasma6/default.nix index bc245f30..73e30a07 100644 --- a/nixos/common/desktops/plasma6/default.nix +++ b/nixos/common/desktops/plasma6/default.nix @@ -40,30 +40,20 @@ ''; after = [ "networking-online.target" ]; serviceConfig.Type = "oneshot"; - onSuccess = [ - "light-theme.service" - "dark-theme.service" - ]; + onSuccess = [ "set-theme.service" ]; }; - light-theme = { + set-theme = { enable = true; script = '' + if [ ! -f /tmp/wttr.sunrise ] ; then + systemctl --user start get-theme-times.service + fi SUNRISE=`date -d \`cat /tmp/wttr.sunrise\` +%s` SUNSET=`date -d \`cat /tmp/wttr.sunset\` +%s` CURRENT=`date +%s` if [ $CURRENT -gt $SUNRISE -a $CURRENT -lt $SUNSET ] ; then plasma-apply-colorscheme -platform offscreen Arc - fi - ''; - serviceConfig.Type = "oneshot"; - }; - dark-theme = { - enable = true; - script = '' - SUNRISE=`date -d \`cat /tmp/wttr.sunrise\` +%s` - SUNSET=`date -d \`cat /tmp/wttr.sunset\` +%s` - CURRENT=`date +%s` - if ! [ $CURRENT -gt $SUNRISE -a $CURRENT -lt $SUNSET ] ; then + else plasma-apply-colorscheme -platform offscreen ArcDark fi ''; @@ -77,14 +67,9 @@ partOf = [ "get-theme-times.service" ]; timerConfig.OnCalendar = ["1 hour"]; }; - "light-theme" = { + "set-theme" = { enable = true; - partOf = [ "light-theme.service" ]; - timerConfig.OnCalendar = [ "*-*-* *:*:*" ]; - }; - "dark-theme" = { - enable = true; - partOf = [ "dark-theme.service" ]; + partOf = [ "set-theme.service" ]; timerConfig.OnCalendar = [ "*-*-* *:*:*" ]; }; };