1

I'm on a MacBook with a touchbar – that's how I control volume levels.

In practice, I only use two volume levels: "silent" (two bars) and "loud" (13 bars). It is a bit annoying to go through all the in-between levels when I want to go from one to the other.

Is there a trick or a touchbar app to allow me to define "silent" and "loud" levels and then jump between them quickly?

2

You can control the volume with AppleScript. For example:

set volume output volume 100

will set the volume to 100%

set volume output volume 5

will set it to 5%.

Via shell script, the commands would look like this:

osascript -e 'set volume output volume 100'

So that's part one: how to jump between 2 volume levels.

Part two is "How do I invoke those commands?"

I don't know any way to do it via the Touch Bar, but if I was committed to using that, I would look at BetterTouchTool.

My preferred solution would be a keyboard shortcut using Keyboard Maestro.

You could also use FastScripts.

2

You could set it up as an Automator Quick Action (Service) containing a simple toggle-switch Applescript

Applescript volume runs from 0 to 100 so doesn't precisely line up with a whole number of bars, so you may need to juggle the two values until they're comfortable. Using 50 as an arbitrary comparison allows for if it's ever been adjusted manually to anything other than these two defined volumes.

on run {input, parameters}
    
    set currentVolume to output volume of (get volume settings)
    if currentVolume is less than 50 then
        set volume output volume 80
    else
        set volume output volume 20
    end if
    
    return input
end run

enter image description here

Save as 'Volume Toggle' so you can find it in Services, then you will find it right at the bottom of the list in System Prefs > Keyboard > Shortcuts > Services, where you can set an 'action' command to trigger it - e.g. Cmd ⌘ Opt ⌥ Shift ⇧ V (chosen so it won't conflict with anything else).
You may need to logout & back in for the shortcut to fully register system-wide.
Using this method will not provide any visual feedback as to the resulting volume setting.

enter image description here

5
  • It should be noted that finding a global keyboard shortcut that will not conflict in all applications one typically uses can be difficult. For example, the keyboard shortcut chosen in this answer conflicts with one in Safari. So if Safari has focus when one presses ⌥⇧⌘V the volume may not be changed. On my system Safari eats the keyboard shortcut. I've found using CheatSheet to be handy when trying to ascertain a global keyboard shortcut that will not conflict with the applications I use. (Not affiliated with the developer.) – user3439894 Apr 7 at 13:52
  • The ⌥⇧⌘V keyboard shortcut also conflicts with TextEdit. RE: "Using this method will not provide any visual feedback as to the resulting volume setting." -- If one has the Sound menu extra showing on the menu bar one may see visible confirmation that the volume level has changed. For example, in macOS Catalina the number of sound waves shown on the Sound icon increases/decreases, thus providing visual confirmation. BTW... There is no need for return input in the AppleScript -code in this use case. – user3439894 Apr 7 at 14:05
  • tbh, I just threw in that shortcut as a bit of a guess. once I'd done I just discarded the whole lot. i would normally use multiple modifiers + an F-Key for this type of global task. – Tetsujin Apr 7 at 14:18
  • Nice solution without any external dependencies. I'd prefer to integrate more closely with the touch bar, that's where my muscle memory goes when dealing with volume and brightness and similar, but it's a nice solution anyway. Thank you. – Borek Bernard Apr 8 at 6:44
  • You may be able to do this from the touch bar - I've never owned one so have no experience with it at all. Try asking as a separate question… 'how to get a service to launch from the touch bar?' etc. Link back to this one for context. – Tetsujin Apr 8 at 6:48

You must log in to answer this question.

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