2024-12-12 16:17 : id 409
This commit is contained in:
parent
80a01bbc29
commit
a1e466958d
@ -117,6 +117,13 @@ in
|
|||||||
};
|
};
|
||||||
"scripts/mode-switcher-based-on-sunlight.sh" = {
|
"scripts/mode-switcher-based-on-sunlight.sh" = {
|
||||||
text = ''
|
text = ''
|
||||||
|
run_a_command() {
|
||||||
|
if [[ "$light" == "DAY" ]]; then
|
||||||
|
notify-send "day"
|
||||||
|
else
|
||||||
|
notify-send "night"
|
||||||
|
fi
|
||||||
|
};
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# Set your latitude and longitude
|
# Set your latitude and longitude
|
||||||
LATITUDE="53.43N"
|
LATITUDE="53.43N"
|
||||||
@ -124,14 +131,14 @@ in
|
|||||||
|
|
||||||
# Calculate the sunrise and sunset times for today using sunwait
|
# Calculate the sunrise and sunset times for today using sunwait
|
||||||
light=$(sunwait poll $LATITUDE $LONGITUDE)
|
light=$(sunwait poll $LATITUDE $LONGITUDE)
|
||||||
echo $sunrise_time
|
|
||||||
echo $sunset_time
|
|
||||||
|
|
||||||
if [[ "$light" == "DAY" ]]; then
|
run_a_command
|
||||||
echo "It's daylight. Running daytime command..."
|
while sleep 5; do
|
||||||
else
|
new_light=$(sunwait poll $LATITUDE $LONGITUDE)
|
||||||
echo "It's night. Running nighttime command..."
|
if [[ "$new_light" != "$light" ]]; do
|
||||||
fi
|
run_a_command
|
||||||
|
do
|
||||||
|
done
|
||||||
'';
|
'';
|
||||||
executable = true;
|
executable = true;
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user