Skip to content

Instantly share code, notes, and snippets.

@alber70g
Last active November 21, 2019 22:23
Show Gist options
  • Save alber70g/284c09a2a4d84f34f7bf55bbe6e0a43e to your computer and use it in GitHub Desktop.
Save alber70g/284c09a2a4d84f34f7bf55bbe6e0a43e to your computer and use it in GitHub Desktop.
Execute command based on sunset sundawn
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