I really enjoy listening to some good music before sleeping. But the question is who will stop the music once you fall asleep, right? If you’re using iPhone you can schedule a timer which will stop playing after time elapses.

But what if you want to have the same functionality on Macbook too? Well, I was missing this feature so I decided to create a simple Bash script that uses AppleScript to stop Spotify playing after a defined time.

You can find the source code on Github.