aerospace fork
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031323334import AppKitimport Commonimport ISSoundAdditions
struct VolumeCommand: Command { let args: VolumeCmdArgs /*conforms*/ let shouldResetClosedWindowsCache = false
func run(_ env: CmdEnv, _ io: CmdIo) -> BinaryExitCode { switch args.action.val { case .up: Sound.output.increaseVolume(by: 0.0625, autoMuteUnmute: true) case .down: Sound.output.decreaseVolume(by: 0.0625, autoMuteUnmute: true) case .muteToggle: Sound.output.isMuted.toggle() case .muteOn: Sound.output.isMuted = true case .muteOff: Sound.output.isMuted = false case .set(let int): Sound.output.setVolume(Float(int) / 100, autoMuteUnmute: true) } if args.gui { do { VolumePanel.shared.update(with: Sound.output.isMuted ? 0 : try Sound.output.readVolume()) } catch { return .fail(io.err(bugPrompt(String(describing: error)))) } } return .succ }}