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" = {
enable = true;
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" ];
serviceConfig.Type = "oneshot";
onSuccess = [
@ -44,14 +47,11 @@
};
light-theme = {
enable = true;
path = [ pkgs.at pkgs.fx pkgs.nodejs pkgs.bash ];
script = ''
# Also need to do checks of what the current theme is and apply it if it isn't already set
SUNRISE=`fx /tmp/wttr.in .weather[0].astronomy[0].sunrise`
SUNSET=`fx /tmp/wttr.in .weather[0].astronomy[0].sunset`
NOW=`date +'%I:%M %p'`
if [[ $SUNRISE == $NOW ]] ; then
echo "Setting Arc colorscheme"
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
'';
@ -59,12 +59,11 @@
};
dark-theme = {
enable = true;
path = [ pkgs.at pkgs.fx pkgs.nodejs pkgs.bash ];
script = ''
SUNSET=`fx /tmp/wttr.in .weather[0].astronomy[0].sunset`
NOW=`date +'%I:%M %p'`
if [[ $SUNSET == $NOW ]] ; then
echo "Setting ArcDark colorscheme"
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
fi
'';