Initial commit: HUDini — classic volume HUD for macOS
Menu bar utility that shows a centered HUD overlay with volume bars when system volume changes. CoreAudio monitoring, auto-fade, works on all spaces and fullscreen. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
commit
cee343dd96
9 changed files with 497 additions and 0 deletions
51
Sources/HUDini/HUDView.swift
Normal file
51
Sources/HUDini/HUDView.swift
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
import SwiftUI
|
||||
|
||||
struct HUDView: View {
|
||||
let volume: Float
|
||||
let isMuted: Bool
|
||||
|
||||
private let totalBars = 16
|
||||
private let cornerRadius: CGFloat = 18
|
||||
|
||||
var filledBars: Int {
|
||||
if isMuted { return 0 }
|
||||
return Int(round(Double(volume) * Double(totalBars)))
|
||||
}
|
||||
|
||||
var speakerIcon: String {
|
||||
if isMuted { return "speaker.slash.fill" }
|
||||
if volume == 0 { return "speaker.fill" }
|
||||
if volume < 0.33 { return "speaker.wave.1.fill" }
|
||||
if volume < 0.66 { return "speaker.wave.2.fill" }
|
||||
return "speaker.wave.3.fill"
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
VStack(spacing: 16) {
|
||||
Image(systemName: speakerIcon)
|
||||
.font(.system(size: 48, weight: .medium))
|
||||
.foregroundColor(.white)
|
||||
.frame(height: 60)
|
||||
|
||||
HStack(spacing: 4) {
|
||||
ForEach(0..<totalBars, id: \.self) { index in
|
||||
RoundedRectangle(cornerRadius: 2)
|
||||
.fill(index < filledBars ? Color.white : Color.white.opacity(0.2))
|
||||
.frame(height: 24)
|
||||
}
|
||||
}
|
||||
.padding(.horizontal, 20)
|
||||
}
|
||||
.frame(width: 200, height: 200)
|
||||
.background(
|
||||
RoundedRectangle(cornerRadius: cornerRadius)
|
||||
.fill(.ultraThinMaterial)
|
||||
.environment(\.colorScheme, .dark)
|
||||
)
|
||||
.background(
|
||||
RoundedRectangle(cornerRadius: cornerRadius)
|
||||
.fill(Color.black.opacity(0.55))
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue