@lattices/cli 0.4.14 → 0.6.0
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.
- package/README.md +5 -7
- package/apps/mac/Info.plist +4 -4
- package/apps/mac/Lattices.app/Contents/Info.plist +4 -12
- package/apps/mac/Lattices.app/Contents/MacOS/Lattices +0 -0
- package/bin/lattices-app.ts +110 -17
- package/bin/lattices-build +125 -0
- package/bin/lattices-dev +89 -16
- package/bin/lattices.ts +977 -16
- package/docs/agents.md +81 -4
- package/docs/ai-chat-ux-review.md +416 -0
- package/docs/api.md +135 -3
- package/docs/app.md +30 -8
- package/docs/config.md +4 -0
- package/docs/mouse-gestures.md +60 -1
- package/docs/proposals/LAT-004-interactive-overlay-actors.md +1 -1
- package/docs/proposals/LAT-005-action-runtime-product-spine.md +914 -0
- package/docs/proposals/LAT-006-mira-in-lattices.md +553 -0
- package/docs/proposals/LAT-007-unified-app-shell.md +128 -0
- package/docs/reference/dewey.config.ts +2 -2
- package/docs/release.md +171 -0
- package/docs/repo-structure.md +5 -5
- package/docs/voice.md +11 -27
- package/package.json +11 -10
- package/apps/mac/Package.swift +0 -27
- package/apps/mac/Sources/AppShell/App.swift +0 -26
- package/apps/mac/Sources/AppShell/AppActivationCoordinator.swift +0 -27
- package/apps/mac/Sources/AppShell/AppDelegate.swift +0 -189
- package/apps/mac/Sources/AppShell/AppServicesBootstrap.swift +0 -25
- package/apps/mac/Sources/AppShell/AppShellView.swift +0 -171
- package/apps/mac/Sources/AppShell/AppUpdater.swift +0 -305
- package/apps/mac/Sources/AppShell/CliActionLauncher.swift +0 -50
- package/apps/mac/Sources/AppShell/HomeDashboardView.swift +0 -133
- package/apps/mac/Sources/AppShell/HotkeyBootstrap.swift +0 -87
- package/apps/mac/Sources/AppShell/KeyRecorderView.swift +0 -210
- package/apps/mac/Sources/AppShell/LatticesRuntime.swift +0 -104
- package/apps/mac/Sources/AppShell/MainView.swift +0 -847
- package/apps/mac/Sources/AppShell/MainWindow.swift +0 -83
- package/apps/mac/Sources/AppShell/MenuBarController.swift +0 -177
- package/apps/mac/Sources/AppShell/OnboardingView.swift +0 -483
- package/apps/mac/Sources/AppShell/PermissionsAssistantView.swift +0 -366
- package/apps/mac/Sources/AppShell/PermissionsAssistantWindow.swift +0 -70
- package/apps/mac/Sources/AppShell/Preferences.swift +0 -297
- package/apps/mac/Sources/AppShell/SettingsView.swift +0 -3163
- package/apps/mac/Sources/AppShell/SettingsWindow.swift +0 -34
- package/apps/mac/Sources/AppShell/WorkspaceInspectorPresenter.swift +0 -13
- package/apps/mac/Sources/Core/Actions/HotkeyManager.swift +0 -256
- package/apps/mac/Sources/Core/Actions/HotkeyStore.swift +0 -399
- package/apps/mac/Sources/Core/Actions/IntentEngine.swift +0 -988
- package/apps/mac/Sources/Core/Actions/IntentSchema.swift +0 -94
- package/apps/mac/Sources/Core/Actions/Intents/CreateLayerIntent.swift +0 -54
- package/apps/mac/Sources/Core/Actions/Intents/DistributeIntent.swift +0 -56
- package/apps/mac/Sources/Core/Actions/Intents/FocusIntent.swift +0 -69
- package/apps/mac/Sources/Core/Actions/Intents/HelpIntent.swift +0 -41
- package/apps/mac/Sources/Core/Actions/Intents/KillIntent.swift +0 -47
- package/apps/mac/Sources/Core/Actions/Intents/LatticeIntent.swift +0 -53
- package/apps/mac/Sources/Core/Actions/Intents/LaunchIntent.swift +0 -67
- package/apps/mac/Sources/Core/Actions/Intents/ListSessionsIntent.swift +0 -32
- package/apps/mac/Sources/Core/Actions/Intents/ListWindowsIntent.swift +0 -30
- package/apps/mac/Sources/Core/Actions/Intents/ScanIntent.swift +0 -52
- package/apps/mac/Sources/Core/Actions/Intents/SearchIntent.swift +0 -190
- package/apps/mac/Sources/Core/Actions/Intents/SwitchLayerIntent.swift +0 -50
- package/apps/mac/Sources/Core/Actions/Intents/TileIntent.swift +0 -61
- package/apps/mac/Sources/Core/Actions/PaletteCommand.swift +0 -439
- package/apps/mac/Sources/Core/Actions/VoiceIntentResolver.swift +0 -713
- package/apps/mac/Sources/Core/Companion/CompanionActivityLog.swift +0 -70
- package/apps/mac/Sources/Core/Companion/CompanionKeyboardController.swift +0 -141
- package/apps/mac/Sources/Core/Companion/LatticesCompanionBridgeServer.swift +0 -454
- package/apps/mac/Sources/Core/Companion/LatticesCompanionCockpit.swift +0 -555
- package/apps/mac/Sources/Core/Companion/LatticesCompanionSecurityCoordinator.swift +0 -629
- package/apps/mac/Sources/Core/Companion/LatticesCompanionTrackpadController.swift +0 -204
- package/apps/mac/Sources/Core/Companion/LatticesDeckHost.swift +0 -1463
- package/apps/mac/Sources/Core/Daemon/DaemonProtocol.swift +0 -114
- package/apps/mac/Sources/Core/Daemon/DaemonServer.swift +0 -427
- package/apps/mac/Sources/Core/Daemon/LatticesApi.swift +0 -2965
- package/apps/mac/Sources/Core/Desktop/AccessibilityTextExtractor.swift +0 -111
- package/apps/mac/Sources/Core/Desktop/AppTypeClassifier.swift +0 -106
- package/apps/mac/Sources/Core/Desktop/DesktopModel.swift +0 -331
- package/apps/mac/Sources/Core/Desktop/DesktopModelTypes.swift +0 -73
- package/apps/mac/Sources/Core/Desktop/InventoryManager.swift +0 -35
- package/apps/mac/Sources/Core/Desktop/InventoryPath.swift +0 -43
- package/apps/mac/Sources/Core/Desktop/MouseFinder.swift +0 -527
- package/apps/mac/Sources/Core/Desktop/OcrModel.swift +0 -467
- package/apps/mac/Sources/Core/Desktop/OcrStore.swift +0 -329
- package/apps/mac/Sources/Core/Desktop/PlacementSpec.swift +0 -195
- package/apps/mac/Sources/Core/Desktop/SessionWindowLocator.swift +0 -139
- package/apps/mac/Sources/Core/Desktop/TilePickerView.swift +0 -209
- package/apps/mac/Sources/Core/Desktop/WindowCapture.swift +0 -33
- package/apps/mac/Sources/Core/Desktop/WindowDragSnapController.swift +0 -429
- package/apps/mac/Sources/Core/Desktop/WindowPreviewCard.swift +0 -100
- package/apps/mac/Sources/Core/Desktop/WindowPreviewStore.swift +0 -112
- package/apps/mac/Sources/Core/Desktop/WindowSelectionStore.swift +0 -76
- package/apps/mac/Sources/Core/Desktop/WindowTiler.swift +0 -2222
- package/apps/mac/Sources/Core/Input/EventTapBreaker.swift +0 -124
- package/apps/mac/Sources/Core/Input/EventTapThread.swift +0 -54
- package/apps/mac/Sources/Core/Input/InputCaptureResetCenter.swift +0 -20
- package/apps/mac/Sources/Core/Input/KeyboardRemapConfig.swift +0 -69
- package/apps/mac/Sources/Core/Input/KeyboardRemapController.swift +0 -346
- package/apps/mac/Sources/Core/Input/KeyboardRemapStore.swift +0 -141
- package/apps/mac/Sources/Core/Input/MouseGestureConfig.swift +0 -499
- package/apps/mac/Sources/Core/Input/MouseGestureController.swift +0 -2583
- package/apps/mac/Sources/Core/Input/MouseInputDeviceStore.swift +0 -98
- package/apps/mac/Sources/Core/Input/MouseInputEventViewer.swift +0 -272
- package/apps/mac/Sources/Core/Input/MouseShortcutStore.swift +0 -170
- package/apps/mac/Sources/Core/Input/SecureEventInputMonitor.swift +0 -39
- package/apps/mac/Sources/Core/Input/ShapeRecognizer.swift +0 -624
- package/apps/mac/Sources/Core/Input/TapBudgetMeter.swift +0 -56
- package/apps/mac/Sources/Core/Overlays/AppWindowShell.swift +0 -63
- package/apps/mac/Sources/Core/Overlays/CommandMode/CommandModeState.swift +0 -1566
- package/apps/mac/Sources/Core/Overlays/CommandMode/CommandModeView.swift +0 -1927
- package/apps/mac/Sources/Core/Overlays/CommandMode/CommandModeWindow.swift +0 -196
- package/apps/mac/Sources/Core/Overlays/CommandPalette/CommandPaletteView.swift +0 -307
- package/apps/mac/Sources/Core/Overlays/CommandPalette/CommandPaletteWindow.swift +0 -67
- package/apps/mac/Sources/Core/Overlays/HUD/CheatSheetHUD.swift +0 -576
- package/apps/mac/Sources/Core/Overlays/HUD/HUDBottomBar.swift +0 -279
- package/apps/mac/Sources/Core/Overlays/HUD/HUDController.swift +0 -1158
- package/apps/mac/Sources/Core/Overlays/HUD/HUDLeftBar.swift +0 -849
- package/apps/mac/Sources/Core/Overlays/HUD/HUDMinimap.swift +0 -179
- package/apps/mac/Sources/Core/Overlays/HUD/HUDRightBar.swift +0 -596
- package/apps/mac/Sources/Core/Overlays/HUD/HUDState.swift +0 -367
- package/apps/mac/Sources/Core/Overlays/HUD/HUDTopBar.swift +0 -243
- package/apps/mac/Sources/Core/Overlays/HUD/LauncherHUD.swift +0 -334
- package/apps/mac/Sources/Core/Overlays/HUD/LayerBezel.swift +0 -203
- package/apps/mac/Sources/Core/Overlays/OmniSearch/OmniSearchState.swift +0 -280
- package/apps/mac/Sources/Core/Overlays/OmniSearch/OmniSearchView.swift +0 -422
- package/apps/mac/Sources/Core/Overlays/OmniSearch/OmniSearchWindow.swift +0 -94
- package/apps/mac/Sources/Core/Overlays/OverlayPanelShell.swift +0 -241
- package/apps/mac/Sources/Core/Overlays/ScreenMap/ScreenMapState.swift +0 -3135
- package/apps/mac/Sources/Core/Overlays/ScreenMap/ScreenMapView.swift +0 -3977
- package/apps/mac/Sources/Core/Overlays/ScreenMap/ScreenMapWindowController.swift +0 -119
- package/apps/mac/Sources/Core/Overlays/ScreenOverlayCanvasController.swift +0 -1217
- package/apps/mac/Sources/Core/Overlays/Voice/VoiceCommandWindow.swift +0 -1575
- package/apps/mac/Sources/Core/Pi/PiAuthNextStepCard.swift +0 -148
- package/apps/mac/Sources/Core/Pi/PiAuthPromptCard.swift +0 -90
- package/apps/mac/Sources/Core/Pi/PiChatDock.swift +0 -564
- package/apps/mac/Sources/Core/Pi/PiChatSession.swift +0 -1948
- package/apps/mac/Sources/Core/Pi/PiInstallCallout.swift +0 -86
- package/apps/mac/Sources/Core/Pi/PiProviderSetupCallout.swift +0 -99
- package/apps/mac/Sources/Core/Pi/PiWorkspaceView.swift +0 -510
- package/apps/mac/Sources/Core/System/Capability.swift +0 -79
- package/apps/mac/Sources/Core/System/DiagnosticLog.swift +0 -373
- package/apps/mac/Sources/Core/System/EventBus.swift +0 -31
- package/apps/mac/Sources/Core/System/PermissionChecker.swift +0 -224
- package/apps/mac/Sources/Core/System/ProcessModel.swift +0 -199
- package/apps/mac/Sources/Core/System/ProcessQuery.swift +0 -151
- package/apps/mac/Sources/Core/System/SystemTelemetryMonitor.swift +0 -273
- package/apps/mac/Sources/Core/Voice/AdvisorLearningStore.swift +0 -90
- package/apps/mac/Sources/Core/Voice/AgentSession.swift +0 -377
- package/apps/mac/Sources/Core/Voice/AudioProvider.swift +0 -555
- package/apps/mac/Sources/Core/Voice/HandsOffSession.swift +0 -839
- package/apps/mac/Sources/Core/Voice/VoiceChatView.swift +0 -192
- package/apps/mac/Sources/Core/Voice/VoxClient.swift +0 -454
- package/apps/mac/Sources/Core/Workspace/Project.swift +0 -28
- package/apps/mac/Sources/Core/Workspace/ProjectScanner.swift +0 -141
- package/apps/mac/Sources/Core/Workspace/SessionLayerStore.swift +0 -285
- package/apps/mac/Sources/Core/Workspace/SessionManager.swift +0 -75
- package/apps/mac/Sources/Core/Workspace/Terminal/Terminal.swift +0 -259
- package/apps/mac/Sources/Core/Workspace/Terminal/TerminalQuery.swift +0 -156
- package/apps/mac/Sources/Core/Workspace/Terminal/TerminalSynthesizer.swift +0 -200
- package/apps/mac/Sources/Core/Workspace/Tmux/TmuxModel.swift +0 -60
- package/apps/mac/Sources/Core/Workspace/Tmux/TmuxQuery.swift +0 -105
- package/apps/mac/Sources/Core/Workspace/WorkspaceManager.swift +0 -1027
- package/apps/mac/Sources/UI/ActionRow.swift +0 -78
- package/apps/mac/Sources/UI/OrphanRow.swift +0 -129
- package/apps/mac/Sources/UI/ProjectRow.swift +0 -368
- package/apps/mac/Sources/UI/TabGroupRow.swift +0 -178
- package/apps/mac/Sources/UI/Theme.swift +0 -164
- package/apps/mac/Tests/StageDragTests.swift +0 -333
- package/apps/mac/Tests/StageJoinTests.swift +0 -313
- package/apps/mac/Tests/StageManagerTests.swift +0 -280
- package/apps/mac/Tests/StageTileTests.swift +0 -353
- package/swift/Package.swift +0 -20
- package/swift/Sources/DeckKit/DeckAction.swift +0 -51
- package/swift/Sources/DeckKit/DeckBridgeSecurity.swift +0 -152
- package/swift/Sources/DeckKit/DeckCockpit.swift +0 -82
- package/swift/Sources/DeckKit/DeckHost.swift +0 -7
- package/swift/Sources/DeckKit/DeckManifest.swift +0 -145
- package/swift/Sources/DeckKit/DeckRuntimeSnapshot.swift +0 -533
- package/swift/Sources/DeckKit/DeckTrackpad.swift +0 -63
- package/swift/Sources/DeckKit/DeckValue.swift +0 -93
- package/swift/Sources/DeckKit/DeckVoiceError.swift +0 -88
- package/swift/Tests/DeckKitTests/DeckKitTests.swift +0 -286
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import AppKit
|
|
2
|
-
|
|
3
|
-
/// Thin redirect — Settings is now a page inside the unified app window.
|
|
4
|
-
final class SettingsWindowController {
|
|
5
|
-
static let shared = SettingsWindowController()
|
|
6
|
-
|
|
7
|
-
var isVisible: Bool { ScreenMapWindowController.shared.isVisible }
|
|
8
|
-
|
|
9
|
-
func toggle() {
|
|
10
|
-
if isVisible { close() } else { show() }
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
func show() {
|
|
14
|
-
ScreenMapWindowController.shared.showPage(.settings)
|
|
15
|
-
DispatchQueue.main.async {
|
|
16
|
-
NotificationCenter.default.post(name: .latticesShowGeneralSettings, object: nil)
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
func showCompanion() {
|
|
21
|
-
ScreenMapWindowController.shared.showPage(.companionSettings)
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
func showAssistant() {
|
|
25
|
-
ScreenMapWindowController.shared.showPage(.settings)
|
|
26
|
-
DispatchQueue.main.async {
|
|
27
|
-
NotificationCenter.default.post(name: .latticesShowAssistantSettings, object: nil)
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
func close() {
|
|
32
|
-
ScreenMapWindowController.shared.close()
|
|
33
|
-
}
|
|
34
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import AppKit
|
|
2
|
-
|
|
3
|
-
enum WorkspaceInspectorPresenter {
|
|
4
|
-
static func show() {
|
|
5
|
-
guard let entry = DesktopModel.shared.frontmostWindow(),
|
|
6
|
-
entry.app != "Lattices" else {
|
|
7
|
-
ScreenMapWindowController.shared.showPage(.screenMap)
|
|
8
|
-
return
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
ScreenMapWindowController.shared.showWindow(wid: entry.wid)
|
|
12
|
-
}
|
|
13
|
-
}
|
|
@@ -1,256 +0,0 @@
|
|
|
1
|
-
import Carbon
|
|
2
|
-
import AppKit
|
|
3
|
-
import Foundation
|
|
4
|
-
|
|
5
|
-
/// Global callback registry keyed by hotkey ID
|
|
6
|
-
private var hotkeyCallbacks: [UInt32: () -> Void] = [:]
|
|
7
|
-
|
|
8
|
-
/// Whether the global Carbon event handler has been installed
|
|
9
|
-
private var eventHandlerInstalled = false
|
|
10
|
-
|
|
11
|
-
class HotkeyManager {
|
|
12
|
-
static let shared = HotkeyManager()
|
|
13
|
-
private var hotKeyRefs: [UInt32: EventHotKeyRef] = [:]
|
|
14
|
-
|
|
15
|
-
private func ensureEventHandler() {
|
|
16
|
-
guard !eventHandlerInstalled else { return }
|
|
17
|
-
eventHandlerInstalled = true
|
|
18
|
-
|
|
19
|
-
var eventType = EventTypeSpec(
|
|
20
|
-
eventClass: OSType(kEventClassKeyboard),
|
|
21
|
-
eventKind: UInt32(kEventHotKeyPressed)
|
|
22
|
-
)
|
|
23
|
-
|
|
24
|
-
InstallEventHandler(
|
|
25
|
-
GetApplicationEventTarget(),
|
|
26
|
-
{ (_: EventHandlerCallRef?, event: EventRef?, _: UnsafeMutableRawPointer?) -> OSStatus in
|
|
27
|
-
guard let event else { return OSStatus(eventNotHandledErr) }
|
|
28
|
-
var hotkeyID = EventHotKeyID()
|
|
29
|
-
GetEventParameter(
|
|
30
|
-
event,
|
|
31
|
-
EventParamName(kEventParamDirectObject),
|
|
32
|
-
EventParamType(typeEventHotKeyID),
|
|
33
|
-
nil,
|
|
34
|
-
MemoryLayout<EventHotKeyID>.size,
|
|
35
|
-
nil,
|
|
36
|
-
&hotkeyID
|
|
37
|
-
)
|
|
38
|
-
DiagnosticLog.shared.info("HotkeyManager: fired id=\(hotkeyID.id)")
|
|
39
|
-
hotkeyCallbacks[hotkeyID.id]?()
|
|
40
|
-
return noErr
|
|
41
|
-
},
|
|
42
|
-
1,
|
|
43
|
-
&eventType,
|
|
44
|
-
nil,
|
|
45
|
-
nil
|
|
46
|
-
)
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
/// Register Cmd+Shift+M as the global hotkey (palette toggle)
|
|
50
|
-
func register(callback: @escaping () -> Void) {
|
|
51
|
-
ensureEventHandler()
|
|
52
|
-
|
|
53
|
-
let id: UInt32 = 1
|
|
54
|
-
hotkeyCallbacks[id] = callback
|
|
55
|
-
|
|
56
|
-
let hotKeyID = EventHotKeyID(
|
|
57
|
-
signature: OSType(0x444D5558), // "DMUX"
|
|
58
|
-
id: id
|
|
59
|
-
)
|
|
60
|
-
|
|
61
|
-
var ref: EventHotKeyRef?
|
|
62
|
-
RegisterEventHotKey(
|
|
63
|
-
46, // 'M'
|
|
64
|
-
UInt32(cmdKey | shiftKey),
|
|
65
|
-
hotKeyID,
|
|
66
|
-
GetApplicationEventTarget(),
|
|
67
|
-
0,
|
|
68
|
-
&ref
|
|
69
|
-
)
|
|
70
|
-
if let ref { hotKeyRefs[id] = ref }
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
/// Register Hyper+1 (Cmd+Ctrl+Option+Shift+1) for command mode
|
|
74
|
-
func registerCommandMode(callback: @escaping () -> Void) {
|
|
75
|
-
ensureEventHandler()
|
|
76
|
-
let id: UInt32 = 200
|
|
77
|
-
hotkeyCallbacks[id] = callback
|
|
78
|
-
let hotKeyID = EventHotKeyID(
|
|
79
|
-
signature: OSType(0x444D5558), // "DMUX"
|
|
80
|
-
id: id
|
|
81
|
-
)
|
|
82
|
-
var ref: EventHotKeyRef?
|
|
83
|
-
RegisterEventHotKey(
|
|
84
|
-
18, // '1' key
|
|
85
|
-
UInt32(cmdKey | controlKey | optionKey | shiftKey), // Hyper
|
|
86
|
-
hotKeyID,
|
|
87
|
-
GetApplicationEventTarget(),
|
|
88
|
-
0,
|
|
89
|
-
&ref
|
|
90
|
-
)
|
|
91
|
-
if let ref { hotKeyRefs[id] = ref }
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
/// Register Hyper+2 (Cmd+Ctrl+Option+Shift+2) for bezel mode
|
|
95
|
-
func registerBezelHotkey(callback: @escaping () -> Void) {
|
|
96
|
-
ensureEventHandler()
|
|
97
|
-
let id: UInt32 = 201
|
|
98
|
-
hotkeyCallbacks[id] = callback
|
|
99
|
-
let hotKeyID = EventHotKeyID(
|
|
100
|
-
signature: OSType(0x444D5558), // "DMUX"
|
|
101
|
-
id: id
|
|
102
|
-
)
|
|
103
|
-
var ref: EventHotKeyRef?
|
|
104
|
-
RegisterEventHotKey(
|
|
105
|
-
19, // '2' key
|
|
106
|
-
UInt32(cmdKey | controlKey | optionKey | shiftKey), // Hyper
|
|
107
|
-
hotKeyID,
|
|
108
|
-
GetApplicationEventTarget(),
|
|
109
|
-
0,
|
|
110
|
-
&ref
|
|
111
|
-
)
|
|
112
|
-
if let ref { hotKeyRefs[id] = ref }
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
/// Register Cmd+Option+1/2/3... hotkeys for layer switching
|
|
116
|
-
func registerLayerHotkeys(count: Int, callback: @escaping (Int) -> Void) {
|
|
117
|
-
ensureEventHandler()
|
|
118
|
-
|
|
119
|
-
// Key codes for number keys 1-9
|
|
120
|
-
let keyCodes: [UInt32] = [18, 19, 20, 21, 23, 22, 26, 28, 25]
|
|
121
|
-
let limit = min(count, keyCodes.count)
|
|
122
|
-
|
|
123
|
-
for i in 0..<limit {
|
|
124
|
-
let id: UInt32 = 101 + UInt32(i)
|
|
125
|
-
|
|
126
|
-
// Unregister existing if re-registering
|
|
127
|
-
if let existing = hotKeyRefs[id] {
|
|
128
|
-
UnregisterEventHotKey(existing)
|
|
129
|
-
hotKeyRefs.removeValue(forKey: id)
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
let layerIndex = i
|
|
133
|
-
hotkeyCallbacks[id] = { callback(layerIndex) }
|
|
134
|
-
|
|
135
|
-
let hotKeyID = EventHotKeyID(
|
|
136
|
-
signature: OSType(0x444D5558), // "DMUX"
|
|
137
|
-
id: id
|
|
138
|
-
)
|
|
139
|
-
|
|
140
|
-
var ref: EventHotKeyRef?
|
|
141
|
-
RegisterEventHotKey(
|
|
142
|
-
keyCodes[i],
|
|
143
|
-
UInt32(cmdKey | optionKey),
|
|
144
|
-
hotKeyID,
|
|
145
|
-
GetApplicationEventTarget(),
|
|
146
|
-
0,
|
|
147
|
-
&ref
|
|
148
|
-
)
|
|
149
|
-
if let ref { hotKeyRefs[id] = ref }
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
/// Register a single global hotkey with a given ID, key code, and Carbon modifier mask
|
|
154
|
-
func registerSingle(id: UInt32, keyCode: UInt32, modifiers: UInt32, callback: @escaping () -> Void) {
|
|
155
|
-
ensureEventHandler()
|
|
156
|
-
|
|
157
|
-
if let existing = hotKeyRefs[id] {
|
|
158
|
-
UnregisterEventHotKey(existing)
|
|
159
|
-
hotKeyRefs.removeValue(forKey: id)
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
hotkeyCallbacks[id] = callback
|
|
163
|
-
|
|
164
|
-
let hotKeyID = EventHotKeyID(
|
|
165
|
-
signature: OSType(0x444D5558), // "DMUX"
|
|
166
|
-
id: id
|
|
167
|
-
)
|
|
168
|
-
|
|
169
|
-
var ref: EventHotKeyRef?
|
|
170
|
-
let status = RegisterEventHotKey(
|
|
171
|
-
keyCode,
|
|
172
|
-
modifiers,
|
|
173
|
-
hotKeyID,
|
|
174
|
-
GetApplicationEventTarget(),
|
|
175
|
-
0,
|
|
176
|
-
&ref
|
|
177
|
-
)
|
|
178
|
-
if let ref {
|
|
179
|
-
hotKeyRefs[id] = ref
|
|
180
|
-
DiagnosticLog.shared.info("HotkeyManager: registered id=\(id) keyCode=\(keyCode) mods=\(modifiers)")
|
|
181
|
-
} else {
|
|
182
|
-
DiagnosticLog.shared.warn("HotkeyManager: failed to register id=\(id) keyCode=\(keyCode) mods=\(modifiers) status=\(status)")
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
/// Unregister all global hotkeys and clear callbacks
|
|
187
|
-
func unregisterAll() {
|
|
188
|
-
for (id, ref) in hotKeyRefs {
|
|
189
|
-
UnregisterEventHotKey(ref)
|
|
190
|
-
hotkeyCallbacks.removeValue(forKey: id)
|
|
191
|
-
}
|
|
192
|
-
hotKeyRefs.removeAll()
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
/// Register Ctrl+Option window tiling hotkeys (Magnet-style)
|
|
196
|
-
func registerTileHotkeys() {
|
|
197
|
-
let mods = UInt32(controlKey | optionKey)
|
|
198
|
-
|
|
199
|
-
// Ctrl+Option+← → left
|
|
200
|
-
registerSingle(id: 300, keyCode: 123, modifiers: mods) {
|
|
201
|
-
WindowTiler.tileFrontmostViaAX(to: .left)
|
|
202
|
-
}
|
|
203
|
-
// Ctrl+Option+→ → right
|
|
204
|
-
registerSingle(id: 301, keyCode: 124, modifiers: mods) {
|
|
205
|
-
WindowTiler.tileFrontmostViaAX(to: .right)
|
|
206
|
-
}
|
|
207
|
-
// Ctrl+Option+Return → maximize
|
|
208
|
-
registerSingle(id: 302, keyCode: 36, modifiers: mods) {
|
|
209
|
-
WindowTiler.tileFrontmostViaAX(to: .maximize)
|
|
210
|
-
}
|
|
211
|
-
// Ctrl+Option+C → center
|
|
212
|
-
registerSingle(id: 303, keyCode: 8, modifiers: mods) {
|
|
213
|
-
WindowTiler.tileFrontmostViaAX(to: .center)
|
|
214
|
-
}
|
|
215
|
-
// Ctrl+Option+U → top-left
|
|
216
|
-
registerSingle(id: 304, keyCode: 32, modifiers: mods) {
|
|
217
|
-
WindowTiler.tileFrontmostViaAX(to: .topLeft)
|
|
218
|
-
}
|
|
219
|
-
// Ctrl+Option+I → top-right
|
|
220
|
-
registerSingle(id: 305, keyCode: 34, modifiers: mods) {
|
|
221
|
-
WindowTiler.tileFrontmostViaAX(to: .topRight)
|
|
222
|
-
}
|
|
223
|
-
// Ctrl+Option+J → bottom-left
|
|
224
|
-
registerSingle(id: 306, keyCode: 38, modifiers: mods) {
|
|
225
|
-
WindowTiler.tileFrontmostViaAX(to: .bottomLeft)
|
|
226
|
-
}
|
|
227
|
-
// Ctrl+Option+K → bottom-right
|
|
228
|
-
registerSingle(id: 307, keyCode: 40, modifiers: mods) {
|
|
229
|
-
WindowTiler.tileFrontmostViaAX(to: .bottomRight)
|
|
230
|
-
}
|
|
231
|
-
// Ctrl+Option+↑ → top
|
|
232
|
-
registerSingle(id: 308, keyCode: 126, modifiers: mods) {
|
|
233
|
-
WindowTiler.tileFrontmostViaAX(to: .top)
|
|
234
|
-
}
|
|
235
|
-
// Ctrl+Option+↓ → bottom
|
|
236
|
-
registerSingle(id: 309, keyCode: 125, modifiers: mods) {
|
|
237
|
-
WindowTiler.tileFrontmostViaAX(to: .bottom)
|
|
238
|
-
}
|
|
239
|
-
// Ctrl+Option+D → distribute visible windows
|
|
240
|
-
registerSingle(id: 310, keyCode: 2, modifiers: mods) {
|
|
241
|
-
WindowTiler.distributeVisible()
|
|
242
|
-
}
|
|
243
|
-
// Ctrl+Option+1 → left third
|
|
244
|
-
registerSingle(id: 311, keyCode: 18, modifiers: mods) {
|
|
245
|
-
WindowTiler.tileFrontmostViaAX(to: .leftThird)
|
|
246
|
-
}
|
|
247
|
-
// Ctrl+Option+2 → center third
|
|
248
|
-
registerSingle(id: 312, keyCode: 19, modifiers: mods) {
|
|
249
|
-
WindowTiler.tileFrontmostViaAX(to: .centerThird)
|
|
250
|
-
}
|
|
251
|
-
// Ctrl+Option+3 → right third
|
|
252
|
-
registerSingle(id: 313, keyCode: 20, modifiers: mods) {
|
|
253
|
-
WindowTiler.tileFrontmostViaAX(to: .rightThird)
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
}
|