Skip to content

Commit 543ef3c

Browse files
nesquena-hermesHermes Agent
andauthored
fix: v1.2.1 — hotkey OSStatus check, redundant default seed removed, checkbox init cleanup (#33)
Co-authored-by: Hermes Agent <hermes@nesquena-hermes.local>
1 parent 0770986 commit 543ef3c

3 files changed

Lines changed: 13 additions & 6 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Changelog
22

3+
## [v1.2.1] — 2026-04-20
4+
5+
### Fixed
6+
- **RegisterEventHotKey OSStatus now checked** — if Cmd+Shift+H is already claimed by another app (Alfred, Raycast, etc.), a diagnostic `NSLog` fires instead of silently no-opping. Surfaced by the v1.2.0 independent review.
7+
- **Redundant `notificationsEnabled` seed removed** — `seedDefaultsIfNeeded()` was setting `notificationsEnabled` alongside `UserDefaults.standard.register(defaults:)`, which already covers both fresh installs and upgrades. The seed in `register(defaults:)` is the authoritative one; the duplicate in `seedDefaultsIfNeeded` is removed.
8+
- **Notifications checkbox init cleaned up** — `target` and `action` are now set in the `NSButton` initializer directly, removing the redundant two-line post-init reassignment.
9+
310
## [v1.2.0] — 2026-04-20
411

512
### Fixed

‎Sources/HermesAgent/AppDelegate.swift‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ class AppDelegate: NSObject, NSApplicationDelegate {
7777
defaults.set(defaultRemotePort, forKey: "remotePort")
7878
defaults.set(defaultTargetURL, forKey: "targetURL")
7979
defaults.set("direct", forKey: "connectionMode")
80-
defaults.set(true, forKey: "notificationsEnabled")
8180
}
8281
}
8382

@@ -344,14 +343,17 @@ class AppDelegate: NSObject, NSApplicationDelegate {
344343
1, &eventSpec, selfPtr, &carbonEventHandler
345344
)
346345
let hkID = EventHotKeyID(signature: OSType(0x4845_524D), id: 1) // 'HERM'
347-
RegisterEventHotKey(
346+
let status = RegisterEventHotKey(
348347
UInt32(kVK_ANSI_H),
349348
UInt32(cmdKey | shiftKey),
350349
hkID,
351350
GetApplicationEventTarget(),
352351
0,
353352
&carbonHotKeyRef
354353
)
354+
if status != noErr {
355+
NSLog("[HermesAgent] RegisterEventHotKey failed (OSStatus %d) — Cmd+Shift+H may already be claimed by another app.", status)
356+
}
355357
}
356358

357359
func applicationWillTerminate(_ notification: Notification) {

‎Sources/HermesAgent/PreferencesWindowController.swift‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,13 +135,11 @@ class PreferencesWindowController: NSWindowController {
135135
// Notifications toggle (fix #28)
136136
notificationsCheckbox = NSButton(
137137
checkboxWithTitle: "Show a notification when a response completes while the app is in the background",
138-
target: nil,
139-
action: nil)
138+
target: self,
139+
action: #selector(toggleNotifications(_:)))
140140
notificationsCheckbox.frame = NSRect(x: 164, y: y, width: 290, height: 22)
141141
notificationsCheckbox.state =
142142
UserDefaults.standard.bool(forKey: "notificationsEnabled") ? .on : .off
143-
notificationsCheckbox.target = self
144-
notificationsCheckbox.action = #selector(toggleNotifications(_:))
145143
content.addSubview(notificationsCheckbox)
146144
y -= 36
147145

0 commit comments

Comments
 (0)