This commit is contained in:
iFargle 2024-01-03 18:03:56 +09:00
parent 81946115c6
commit bc9612dc52

View file

@ -40,30 +40,20 @@
''; '';
after = [ "networking-online.target" ]; after = [ "networking-online.target" ];
serviceConfig.Type = "oneshot"; serviceConfig.Type = "oneshot";
onSuccess = [ onSuccess = [ "set-theme.service" ];
"light-theme.service"
"dark-theme.service"
];
}; };
light-theme = { set-theme = {
enable = true; enable = true;
script = '' script = ''
if [ ! -f /tmp/wttr.sunrise ] ; then
systemctl --user start get-theme-times.service
fi
SUNRISE=`date -d \`cat /tmp/wttr.sunrise\` +%s` SUNRISE=`date -d \`cat /tmp/wttr.sunrise\` +%s`
SUNSET=`date -d \`cat /tmp/wttr.sunset\` +%s` SUNSET=`date -d \`cat /tmp/wttr.sunset\` +%s`
CURRENT=`date +%s` CURRENT=`date +%s`
if [ $CURRENT -gt $SUNRISE -a $CURRENT -lt $SUNSET ] ; then if [ $CURRENT -gt $SUNRISE -a $CURRENT -lt $SUNSET ] ; then
plasma-apply-colorscheme -platform offscreen Arc plasma-apply-colorscheme -platform offscreen Arc
fi else
'';
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
plasma-apply-colorscheme -platform offscreen ArcDark plasma-apply-colorscheme -platform offscreen ArcDark
fi fi
''; '';
@ -77,14 +67,9 @@
partOf = [ "get-theme-times.service" ]; partOf = [ "get-theme-times.service" ];
timerConfig.OnCalendar = ["1 hour"]; timerConfig.OnCalendar = ["1 hour"];
}; };
"light-theme" = { "set-theme" = {
enable = true; enable = true;
partOf = [ "light-theme.service" ]; partOf = [ "set-theme.service" ];
timerConfig.OnCalendar = [ "*-*-* *:*:*" ];
};
"dark-theme" = {
enable = true;
partOf = [ "dark-theme.service" ];
timerConfig.OnCalendar = [ "*-*-* *:*:*" ]; timerConfig.OnCalendar = [ "*-*-* *:*:*" ];
}; };
}; };