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" ];
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 = [ "*-*-* *:*:*" ];
};
};