ai-notify 0.4.1 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -13,6 +13,35 @@
|
|
|
13
13
|
|
|
14
14
|
import Cocoa
|
|
15
15
|
|
|
16
|
+
// NSSlider.trackFillColor is unreliable for blue: AppKit matches the resolved fill
|
|
17
|
+
// to the system accent and routes it through the accent path, which desaturates to
|
|
18
|
+
// gray while the control isn't the key view (a menu slider never is). A non-accent
|
|
19
|
+
// color like the ツンデレ pink is exempt, which is why only the blue volume slider
|
|
20
|
+
// went gray. Drawing the bar ourselves sidesteps the accent path completely.
|
|
21
|
+
final class FilledSliderCell: NSSliderCell {
|
|
22
|
+
var fillColor: NSColor = NSColor(srgbRed: 0, green: 122.0 / 255.0, blue: 1, alpha: 1)
|
|
23
|
+
|
|
24
|
+
override func drawBar(inside rect: NSRect, flipped: Bool) {
|
|
25
|
+
let h: CGFloat = 4
|
|
26
|
+
var bar = rect
|
|
27
|
+
bar.origin.y += (bar.height - h) / 2
|
|
28
|
+
bar.size.height = h
|
|
29
|
+
let radius = h / 2
|
|
30
|
+
|
|
31
|
+
NSColor.tertiaryLabelColor.setFill()
|
|
32
|
+
NSBezierPath(roundedRect: bar, xRadius: radius, yRadius: radius).fill()
|
|
33
|
+
|
|
34
|
+
let span = maxValue - minValue
|
|
35
|
+
guard span > 0 else { return }
|
|
36
|
+
let frac = CGFloat((doubleValue - minValue) / span)
|
|
37
|
+
guard frac > 0 else { return }
|
|
38
|
+
var fill = bar
|
|
39
|
+
fill.size.width = min(bar.width, max(h, bar.width * frac))
|
|
40
|
+
fillColor.setFill()
|
|
41
|
+
NSBezierPath(roundedRect: fill, xRadius: radius, yRadius: radius).fill()
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
16
45
|
enum State {
|
|
17
46
|
static func dir() -> String {
|
|
18
47
|
let env = ProcessInfo.processInfo.environment
|
|
@@ -172,10 +201,11 @@ final class AppDelegate: NSObject, NSApplicationDelegate {
|
|
|
172
201
|
private func sliderRow(value: Double, action: Selector, identifier: String?) -> NSMenuItem {
|
|
173
202
|
let row = NSView(frame: NSRect(x: 0, y: 0, width: 220, height: 26))
|
|
174
203
|
let icon = NSTextField(labelWithString: "🔊"); icon.frame = NSRect(x: 12, y: 4, width: 20, height: 18)
|
|
175
|
-
let slider = NSSlider(
|
|
176
|
-
slider.
|
|
204
|
+
let slider = NSSlider(frame: NSRect(x: 36, y: 3, width: 170, height: 20))
|
|
205
|
+
slider.cell = FilledSliderCell() // self-drawn blue fill; see FilledSliderCell
|
|
206
|
+
slider.minValue = 0; slider.maxValue = 2; slider.doubleValue = value
|
|
207
|
+
slider.target = self; slider.action = action
|
|
177
208
|
slider.isContinuous = (identifier == nil)
|
|
178
|
-
slider.trackFillColor = .controlAccentColor // stay blue even when not focused
|
|
179
209
|
if let id = identifier { slider.identifier = NSUserInterfaceItemIdentifier(id) }
|
|
180
210
|
row.addSubview(icon); row.addSubview(slider)
|
|
181
211
|
let item = NSMenuItem(); item.view = row
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ai-notify",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.2",
|
|
4
4
|
"description": "Desktop, sound, and spoken notifications for terminal AI coding agents (Claude Code, Codex, Gemini, ...) — with one mute switch that covers all of them, across every terminal.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|