3

I don't want my computer play any sound through it's own speaker during work hours in weekdays. But I want to be able to listen to music using my headphones.

I guess something can be done with Automator to schedule a bunch of commands in order to do this.

1

3 Answers 3

4

You could try using breakaway and set up a simple applescript set volume output volume 0 to trigger when the headphones are unplugged. (And of course, you could set up another trigger to turn the volume back up when the headphones are plugged in again.)

3
  • 2
    Wow - that's far more elegant a solution than I expected. That software is awesome!
    – bmike
    May 11, 2012 at 21:31
  • 1
    Doesn't OSX automatically store two different volume levels for speakers and headphones? May 11, 2012 at 21:32
  • 2
    @Ben Yes, you could always just remember to manually mute & un-mute the speaker, but I'm not sure you could reliably script the volume levels to do this at 9 & 5. e.g. After work, you unplug your headphones and crank the volume up on your internal speakers. You schedule a script to set the volume to 0 at 9am the next day. However, if you happen to already have the headphones plugged in at 9am, your script would mute your headphones. When you unplug your headphones, the internal speaker volume will still be loud from the previous night.
    – Nix
    May 11, 2012 at 22:55
0

The simple solution would to always leave your headphones connected and lower the volume should you have music leaking from the headphones when they rest on the desk as opposed to on your head.

0

Breakaway is no longer maintained on its website, but it can still be downloaded from Sourceforge. I've associated it with the following two AppleScripts to mute the speaker and pause Spotify when the jack is disconnected, and to play Spotify when the jack is connected. Follow the instructions on makeuseof to see how to author AppleScript and connect it to Breakaway.

jack-disconnected.scpt

set volume output volume 0
tell application "System Events"
    set MyList to (name of every process)
end tell
if (MyList contains "Spotify") is true then
    tell application "Spotify" to pause
end if

jack-connected.scpt

tell application "System Events"
    set MyList to (name of every process)
end tell
if (MyList contains "Spotify") is true then
    tell application "Spotify"
        if player state is paused then play
    end tell
end if

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .