Last active
November 21, 2019 22:23
-
-
Save alber70g/284c09a2a4d84f34f7bf55bbe6e0a43e to your computer and use it in GitHub Desktop.
Execute command based on sunset sundawn
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function selectmode --description "Select light or darkmode based on time" | |
set currentday (date +%j) | |
if test $currentday -gt "280" || test $currentday -lt "90" | |
set sundawn "0900" | |
set sunset "1700" | |
else | |
set sundawn "0600" | |
set sunset "2000" | |
end | |
set currenttime (date +%H%M) | |
if test $currenttime -gt $sundawn && test $currenttime -lt $sunset | |
lightmode | |
else | |
darkmode | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment