Update theming

This commit is contained in:
iFargle 2024-01-03 14:24:21 +09:00
parent 61d114c852
commit 0816974e82

View file

@ -34,7 +34,10 @@
"get-theme-times" = { "get-theme-times" = {
enable = true; enable = true;
path = [ pkgs.curl ]; path = [ pkgs.curl ];
script = "curl wttr.in?format=j1 > /tmp/wttr.in"; script = ''
curl -s wttr.in/?format=%S > /tmp/wttr.sunrise
curl -s wttr.in/?format=%s > /tmp/wttr.sunset
'';
after = [ "networking-online.target" ]; after = [ "networking-online.target" ];
serviceConfig.Type = "oneshot"; serviceConfig.Type = "oneshot";
onSuccess = [ onSuccess = [
@ -44,14 +47,11 @@
}; };
light-theme = { light-theme = {
enable = true; enable = true;
path = [ pkgs.at pkgs.fx pkgs.nodejs pkgs.bash ];
script = '' script = ''
# Also need to do checks of what the current theme is and apply it if it isn't already set SUNRISE=`date -d \`cat /tmp/wttr.sunrise\` +%s`
SUNRISE=`fx /tmp/wttr.in .weather[0].astronomy[0].sunrise` SUNSET=`date -d \`cat /tmp/wttr.sunset\` +%s`
SUNSET=`fx /tmp/wttr.in .weather[0].astronomy[0].sunset` CURRENT=`date +%s`
NOW=`date +'%I:%M %p'` if [ $CURRENT -gt $SUNRISE -a $CURRENT -lt $SUNSET ] ; then
if [[ $SUNRISE == $NOW ]] ; then
echo "Setting Arc colorscheme"
plasma-apply-colorscheme -platform offscreen Arc plasma-apply-colorscheme -platform offscreen Arc
fi fi
''; '';
@ -59,12 +59,11 @@
}; };
dark-theme = { dark-theme = {
enable = true; enable = true;
path = [ pkgs.at pkgs.fx pkgs.nodejs pkgs.bash ];
script = '' script = ''
SUNSET=`fx /tmp/wttr.in .weather[0].astronomy[0].sunset` SUNRISE=`date -d \`cat /tmp/wttr.sunrise\` +%s`
NOW=`date +'%I:%M %p'` SUNSET=`date -d \`cat /tmp/wttr.sunset\` +%s`
if [[ $SUNSET == $NOW ]] ; then CURRENT=`date +%s`
echo "Setting ArcDark colorscheme" if ! [ $CURRENT -gt $SUNRISE -a $CURRENT -lt $SUNSET ] ; then
plasma-apply-colorscheme -platform offscreen ArcDark plasma-apply-colorscheme -platform offscreen ArcDark
fi fi
''; '';