Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save botanicus/2c096771367ea6ca455f378aad5a8e84 to your computer and use it in GitHub Desktop.
Save botanicus/2c096771367ea6ca455f378aad5a8e84 to your computer and use it in GitHub Desktop.
#!/bin/sh
# TODO: Rewrite to Ruby, so we can parse the config and display proper from - to in the notification.
BEFORE=$(networksetup -getairportpower en0)
internet-usage-limiter.is_online && /usr/sbin/networksetup -setairportpower en0 on || /usr/sbin/networksetup -setairportpower en0 off
if test "$(networksetup -getairportpower en0)" = "Wi-Fi Power (en0): Off" && test "$BEFORE" = "Wi-Fi Power (en0): On"; then
osascript -e 'display notification "Your WiFi has been switched off. Use the go-online utility to get online between 9:30 and 18:20." with title "Mindfulness"'
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment