Last active
          January 26, 2020 22:51 
        
      - 
      
 - 
        
Save maximeborges/beadfc09a1d5b846282a7a77de6952f8 to your computer and use it in GitHub Desktop.  
    Script using `wakeup` to use my computer as an alarm clock
  
        
  
    
      This file contains hidden or 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
    
  
  
    
  | TIME="07:30" | |
| NEW_VOLUME="36%" | |
| WAKE_VOLUME="45%" | |
| # Check if the time is still today or tomorrow | |
| if [ $(($(date -d "$TIME" +%s)-$(date +%s))) -lt 0 ] | |
| then | |
| TOMORROW="TOMORROW" | |
| fi | |
| # Got to sleep | |
| sudo wakeup -a $(date -d "$TIME $TOMORROW" +%s) | |
| # Wait a bit before playing with Alsa | |
| sleep 2 | |
| # Turn the volume up | |
| amixer -D pulse sset Master $WAKE_VOLUME | |
| # Wake up my speakers with a low frequency sinus that is filtered anyway | |
| pactl load-module module-sine frequency=30 | |
| sleep 4 | |
| pactl unload-module module-sine | |
| # Put the volume back to normal | |
| amixer -D pulse sset Master $NEW_VOLUME | |
| # Play some music here | |
| # ... | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment