mirror of
https://github.com/FBukovina/Atoll.git
synced 2026-10-27 15:14:33 +00:00
Working Indicators
This commit is contained in:
parent
79eb1311bf
commit
1a45d4e7f4
16 changed files with 629 additions and 17 deletions
35
DynamicIsland/managers/SystemVolumeManager.swift
Normal file
35
DynamicIsland/managers/SystemVolumeManager.swift
Normal 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
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue