Coder Social home page Coder Social logo

muteit_for_mac's Introduction

MuteIt for mac

Make macbook muted when headphone unplugged, just like user experience of iPhone.

Why

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.

Demo

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:

  1. detect headphone unplugged and do mute action
  2. detect headphone plugged and do unmute action
    alt text

Install

Download app from here, and install like other mac apps.

The installer UI will be like this(please ignore the self-made slogan^_^):
alt text

##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:
alt text

##Implementation

  1. CoreAudio API
    1. detect defaut output device
    2. register callback function in the change event of output device, like plug and unplug headphone
    3. implement mute and unmute action in the callback function, here I just use a simple one-line actionscript to do mute action.
  2. 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.
  3. Installer package
      It is my first time to package a mac app manually, just follow tutorial here. It is fun.

Bugs

  1. when you first run MuteIt with no headphone, the sound will be muted.
  2. when you unplug headphone, there will be a very short time that sound will still be playing and then be muted.

Contribution

Waiting for your pull request

Lisence

MIT Lisence

muteit_for_mac's People

Contributors

hanks avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.