Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/403811d5.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"hex-app": minor
---

Show live dictation preview while recording (#237)
22 changes: 11 additions & 11 deletions Hex.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
objects = {

/* Begin PBXBuildFile section */
4F0D6A012F1A000100000001 /* HexCore in Frameworks */ = {isa = PBXBuildFile; productRef = 476316262E5FB31400913CDE /* HexCore */; };
4F0D6A022F1A000100000001 /* ComposableArchitecture in Frameworks */ = {isa = PBXBuildFile; productRef = 47E05E012D444EE900D26DA6 /* ComposableArchitecture */; };
47512ABF2E14D8C9000E25BA /* WhisperKit in Frameworks */ = {isa = PBXBuildFile; productRef = 47512ABE2E14D8C9000E25BA /* WhisperKit */; };
476316272E5FB31400913CDE /* HexCore in Frameworks */ = {isa = PBXBuildFile; productRef = 476316262E5FB31400913CDE /* HexCore */; };
4765045E2D45900200C7EA60 /* Pow in Frameworks */ = {isa = PBXBuildFile; productRef = 4765045D2D45900200C7EA60 /* Pow */; };
Expand All @@ -19,6 +17,8 @@
47E05E0A2D44525B00D26DA6 /* Dependencies in Frameworks */ = {isa = PBXBuildFile; productRef = 47E05E092D44525B00D26DA6 /* Dependencies */; };
47E05E0C2D44525B00D26DA6 /* DependenciesMacros in Frameworks */ = {isa = PBXBuildFile; productRef = 47E05E0B2D44525B00D26DA6 /* DependenciesMacros */; };
47E16A622EC6C9D300885CF7 /* FluidAudio in Frameworks */ = {isa = PBXBuildFile; productRef = 47E16A612EC6C9D300885CF7 /* FluidAudio */; };
4F0D6A012F1A000100000001 /* HexCore in Frameworks */ = {isa = PBXBuildFile; productRef = 476316262E5FB31400913CDE /* HexCore */; };
4F0D6A022F1A000100000001 /* ComposableArchitecture in Frameworks */ = {isa = PBXBuildFile; productRef = 47E05E012D444EE900D26DA6 /* ComposableArchitecture */; };
B5045C972D78DED500D0A119 /* MarkdownUI in Frameworks */ = {isa = PBXBuildFile; productRef = B5045C962D78DED500D0A119 /* MarkdownUI */; };
B53356002D7B8D4900E5F542 /* Localizable.xcstrings in Resources */ = {isa = PBXBuildFile; fileRef = B53355FF2D7B8D4900E5F542 /* Localizable.xcstrings */; };
/* End PBXBuildFile section */
Expand Down Expand Up @@ -53,11 +53,6 @@
/* End PBXFileSystemSynchronizedBuildFileExceptionSet section */

/* Begin PBXFileSystemSynchronizedRootGroup section */
4F0D6A032F1A000100000001 /* HexTests */ = {
isa = PBXFileSystemSynchronizedRootGroup;
path = HexTests;
sourceTree = "<group>";
};
47E05DF02D444EC600D26DA6 /* Hex */ = {
isa = PBXFileSystemSynchronizedRootGroup;
exceptions = (
Expand All @@ -66,6 +61,11 @@
path = Hex;
sourceTree = "<group>";
};
4F0D6A032F1A000100000001 /* HexTests */ = {
isa = PBXFileSystemSynchronizedRootGroup;
path = HexTests;
sourceTree = "<group>";
};
/* End PBXFileSystemSynchronizedRootGroup section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -446,8 +446,8 @@
47E05DFE2D444EC700D26DA6 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
AUTOMATION_APPLE_EVENTS = YES;
CODE_SIGN_ENTITLEMENTS = Hex/Hex.entitlements;
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
Expand All @@ -456,7 +456,7 @@
CURRENT_PROJECT_VERSION = 86;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_ASSET_PATHS = "\"Hex/Preview Content\"";
DEVELOPMENT_TEAM = QC99C9JE59;
DEVELOPMENT_TEAM = SK85S6YZP9;
EMIT_FRONTEND_COMMAND_LINES = YES;
ENABLE_APP_SANDBOX = YES;
ENABLE_HARDENED_RUNTIME = YES;
Expand Down Expand Up @@ -501,8 +501,8 @@
47E05DFF2D444EC700D26DA6 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
AUTOMATION_APPLE_EVENTS = YES;
CODE_SIGN_ENTITLEMENTS = Hex/Hex.entitlements;
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
Expand All @@ -511,7 +511,7 @@
CURRENT_PROJECT_VERSION = 86;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_ASSET_PATHS = "\"Hex/Preview Content\"";
DEVELOPMENT_TEAM = QC99C9JE59;
DEVELOPMENT_TEAM = SK85S6YZP9;
EMIT_FRONTEND_COMMAND_LINES = NO;
ENABLE_APP_SANDBOX = YES;
ENABLE_HARDENED_RUNTIME = YES;
Expand Down
19 changes: 17 additions & 2 deletions Hex/Clients/KeyEventMonitorClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,8 @@ struct KeyEventMonitorToken: Sendable {
public extension KeyEvent {
init(cgEvent: CGEvent, type: CGEventType, isFnPressed: Bool) {
let keyCode = Int(cgEvent.getIntegerValueField(.keyboardEventKeycode))
// Accessing keyboard layout / input source via Sauce must be on main thread.
let key: Key?
if cgEvent.type == .keyDown {
if type == .keyDown, !Self.isModifierKeyCode(keyCode) {
if Thread.isMainThread {
key = Sauce.shared.key(for: keyCode)
} else {
Expand All @@ -48,6 +47,18 @@ public extension KeyEvent {
}
self.init(key: key, modifiers: modifiers)
}

/// Modifier keys can emit keyDown/keyUp in addition to flagsChanged; treat them as modifier-only.
private static func isModifierKeyCode(_ keyCode: Int) -> Bool {
switch keyCode {
case Int(kVK_Command), Int(kVK_Shift), Int(kVK_CapsLock), Int(kVK_Option), Int(kVK_Control),
Int(kVK_RightCommand), Int(kVK_RightShift), Int(kVK_RightOption), Int(kVK_RightControl),
Int(kVK_Function):
return true
default:
return false
}
}
}

@DependencyClient
Expand Down Expand Up @@ -397,6 +408,10 @@ class KeyEventMonitorClientLive {
return Unmanaged.passUnretained(cgEvent)
}

if SyntheticKeyboardEvent.isTagged(cgEvent) {
return Unmanaged.passUnretained(cgEvent)
}

if type == .leftMouseDown || type == .rightMouseDown || type == .otherMouseDown {
_ = hotKeyClientLive.processInputEvent(.mouseClick)
return Unmanaged.passUnretained(cgEvent)
Expand Down
Loading