Make macbook muted when headphone unplugged, just like user experience of iPhone.
When use iPhone, if you unplug headphone, the sound played will be muted automatically, I think this is a good user experience, but on mac, when you do the same thing, the sound will be still playing, and it embarrassed me a few times during my job.
I do not know why Apple does not provide the same user experience between the two productions. Maybe in the future will. But now I just make a simple app to implement the same effect as iPhone.
It is hard to use picture to demonstrate the sound muted effect. So just use to log message to show how it works.
It just does two things:
Download app from here, and install like other mac apps.
The installer UI will be like this(please ignore the self-made slogan^_^):
##Usage [status_bar]: https://raw.githubusercontent.com/hanks/MuteIt_for_mac/master/MuteIt/demo/system_menu.jpg "status_bar"
MuteIt is just a status bar app, just a icon in the system menu bar. When it runs, it works.
Like below:
![alt text][status_bar]
And if you check Run on startup option, it will be added to the login item list like this:
##Implementation
- CoreAudio API
- detect defaut output device
- register callback function in the change event of output device, like plug and unplug headphone
- implement mute and unmute action in the callback function, here I just use a simple one-line actionscript to do mute action.
- Status bar application
-
It means the app has no window, no menu and just a icon in the system menu bar. Many app work like this. Like Alfred, popclip and etc. If your app function is very simple and a few menus can meet your needs. Status bar applcation is a good style you can try.
- Installer package
-
It is my first time to package a mac app manually, just follow tutorial here. It is fun.
when you first run MuteIt with no headphone, the sound will be muted.- when you unplug headphone, there will be a very short time that sound will still be playing and then be muted.
Waiting for your pull request
MIT Lisence