Working Indicators

This commit is contained in:
Hariharan Mudaliar 2025-09-06 19:28:38 +05:30
commit 1a45d4e7f4
16 changed files with 629 additions and 17 deletions

View file

@ -0,0 +1,35 @@
//
// SystemVolumeManager.swift
// DynamicIsland
//
// Adapted from TheBoringWorker-HUD VolumeManager.swift
// Created by GitHub Copilot on 06/09/25.
//
import Foundation
class SystemVolumeManager {
private init() {}
static func isMuted() -> Bool {
do {
return try AppleScriptRunner.run(script: "return output muted of (get volume settings)") == "true"
} catch {
NSLog("Error while trying to retrieve muted properties of device: \(error). Returning default value false.")
return false
}
}
static func getOutputVolume() -> Float {
do {
if let volumeStr = Float(try AppleScriptRunner.run(script: "return output volume of (get volume settings)")) {
return volumeStr / 100
} else {
NSLog("Error while trying to parse volume string value. Returning default volume value 1.")
}
} catch {
NSLog("Error while trying to retrieve volume properties of device: \(error). Returning default volume value 1.")
}
return 0.01
}
}