diff --git a/README.md b/README.md index 3a388fe..58b3dda 100644 --- a/README.md +++ b/README.md @@ -28,4 +28,4 @@ loudness.getMuted(function (err, mute) { ## OS Support -Currently Mac OS X and Linux (ALSA) is supported, please send a pull requests if you are using another setup. +Currently Mac OS X and Linux (ALSA) is supported, please send a pull request if you are using another setup. diff --git a/impl/linux.js b/impl/linux.js index 56e50a5..9212d9a 100644 --- a/impl/linux.js +++ b/impl/linux.js @@ -101,7 +101,15 @@ module.exports.getMuted = function (cb) { }; module.exports.setMuted = function (val, cb) { - amixer(['set', 'PCM', (val?'mute':'unmute')], function (err) { - cb(err); + amixer(['set', 'Master', (val?'mute':'unmute')], function (err) { + if(err) return cb(err); + + amixer(['set', '-D', 'pulse', 'Master', (val?'mute':'unmute')], function (err) { + // Ignore error if pulseaudio is not running + if(err && err.message.includes("Mixer attach pulse error: Connection refused")) + cb(); + else + cb(err); + }); }); };