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
9 changes: 8 additions & 1 deletion TypeaheadAI.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@
2BCB017D2A9EF9A6009F9FAC /* RequestStatus.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2BCB017C2A9EF9A6009F9FAC /* RequestStatus.swift */; };
2BCF84352A9DD90F00359841 /* HistoryManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2BCF84342A9DD90F00359841 /* HistoryManager.swift */; };
2BCF843A2A9DE6DA00359841 /* GeneralSettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2BCF84392A9DE6DA00359841 /* GeneralSettingsView.swift */; };
2BD3821C2B2B7A0100F96C19 /* LayoutManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2BD3821B2B2B7A0100F96C19 /* LayoutManager.swift */; };
2BD3821E2B2C4B2E00F96C19 /* CanSimulateEnter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2BD3821D2B2C4B2E00F96C19 /* CanSimulateEnter.swift */; };
2BDA45C32ABEE840006128BC /* MessageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2BDA45C22ABEE840006128BC /* MessageView.swift */; };
2BDDB9892B27DDE100D52BF0 /* SwiftSoup in Frameworks */ = {isa = PBXBuildFile; productRef = 2BDDB9882B27DDE100D52BF0 /* SwiftSoup */; };
Expand All @@ -111,6 +112,7 @@
2BDDB9932B28341C00D52BF0 /* FunctionManager+OpenApplication.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2BDDB9922B28341C00D52BF0 /* FunctionManager+OpenApplication.swift */; };
2BDDB9952B2834B100D52BF0 /* FunctionManager+OpenURL.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2BDDB9942B2834B100D52BF0 /* FunctionManager+OpenURL.swift */; };
2BDDB9972B28352800D52BF0 /* FunctionManager+PerformUIAction.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2BDDB9962B28352800D52BF0 /* FunctionManager+PerformUIAction.swift */; };
2BDDB9992B2AAE8000D52BF0 /* CanSimulateEnter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2BDDB9982B2AAE8000D52BF0 /* CanSimulateEnter.swift */; };
2BE0EC222AA0956C00E47C52 /* ModalView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2BE0EC212AA0956C00E47C52 /* ModalView.swift */; };
2BE0EC272AA17F9100E47C52 /* MouseClickMonitor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2BE0EC262AA17F9100E47C52 /* MouseClickMonitor.swift */; };
2BE7BB882B258B4C00164F88 /* CanGetUIElements.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2BE7BB872B258B4C00164F88 /* CanGetUIElements.swift */; };
Expand Down Expand Up @@ -234,6 +236,7 @@
2BCB017C2A9EF9A6009F9FAC /* RequestStatus.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RequestStatus.swift; sourceTree = "<group>"; };
2BCF84342A9DD90F00359841 /* HistoryManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HistoryManager.swift; sourceTree = "<group>"; };
2BCF84392A9DE6DA00359841 /* GeneralSettingsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GeneralSettingsView.swift; sourceTree = "<group>"; };
2BD3821B2B2B7A0100F96C19 /* LayoutManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LayoutManager.swift; sourceTree = "<group>"; };
2BD3821D2B2C4B2E00F96C19 /* CanSimulateEnter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CanSimulateEnter.swift; sourceTree = "<group>"; };
2BDA45C22ABEE840006128BC /* MessageView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MessageView.swift; sourceTree = "<group>"; };
2BDDB98A2B27DDFF00D52BF0 /* String+XMLMarkdown.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "String+XMLMarkdown.swift"; sourceTree = "<group>"; };
Expand All @@ -242,6 +245,7 @@
2BDDB9922B28341C00D52BF0 /* FunctionManager+OpenApplication.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "FunctionManager+OpenApplication.swift"; sourceTree = "<group>"; };
2BDDB9942B2834B100D52BF0 /* FunctionManager+OpenURL.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "FunctionManager+OpenURL.swift"; sourceTree = "<group>"; };
2BDDB9962B28352800D52BF0 /* FunctionManager+PerformUIAction.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "FunctionManager+PerformUIAction.swift"; sourceTree = "<group>"; };
2BDDB9982B2AAE8000D52BF0 /* CanSimulateEnter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CanSimulateEnter.swift; sourceTree = "<group>"; };
2BE0EC212AA0956C00E47C52 /* ModalView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ModalView.swift; sourceTree = "<group>"; };
2BE0EC242AA17DB600E47C52 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
2BE0EC262AA17F9100E47C52 /* MouseClickMonitor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MouseClickMonitor.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -385,6 +389,7 @@
2B11FCE02B0C468100325F38 /* CanSimulateClose.swift */,
2BD3821D2B2C4B2E00F96C19 /* CanSimulateEnter.swift */,
2B27450F2AB03A3D00F37D3E /* CanSimulateCopy.swift */,
2BDDB9982B2AAE8000D52BF0 /* CanSimulateEnter.swift */,
2B3792302AB83739008D812F /* CanSimulatePaste.swift */,
2B11FCE22B0C47FA00325F38 /* CanSimulateSelectAll.swift */,
2BE7BB872B258B4C00164F88 /* CanGetUIElements.swift */,
Expand Down Expand Up @@ -454,6 +459,7 @@
2BE0EC242AA17DB600E47C52 /* Info.plist */,
2BA7F0862A9ABBA8003D38BA /* TypeaheadAI.entitlements */,
2B3435022B1EA33500423EE8 /* String+HTMLParser.swift */,
2BD3821B2B2B7A0100F96C19 /* LayoutManager.swift */,
);
path = TypeaheadAI;
sourceTree = "<group>";
Expand Down Expand Up @@ -773,6 +779,7 @@
2BA7F0B32A9ABCBF003D38BA /* MenuView.swift in Sources */,
2B92BDBB2AA3D10800E65CFA /* ModalManager.swift in Sources */,
2BCF843A2A9DE6DA00359841 /* GeneralSettingsView.swift in Sources */,
2BD3821C2B2B7A0100F96C19 /* LayoutManager.swift in Sources */,
2B0116F32AF98D68000C78E1 /* LoggedOutAccountView.swift in Sources */,
2B33D87D2AAC3330001193A2 /* ProfileView.swift in Sources */,
2BA7F0B52A9ABCD7003D38BA /* QuickActionManager.swift in Sources */,
Expand All @@ -794,7 +801,7 @@
2B3792312AB83739008D812F /* CanSimulatePaste.swift in Sources */,
2B8CD4942B05D278003E0589 /* CanPerformOCR.swift in Sources */,
2B11FCE32B0C47FA00325F38 /* CanSimulateSelectAll.swift in Sources */,
2BD3821E2B2C4B2E00F96C19 /* CanSimulateEnter.swift in Sources */,
2BDDB9992B2AAE8000D52BF0 /* CanSimulateEnter.swift in Sources */,
2B1F20462B1987E400152F13 /* ConversationManager.swift in Sources */,
2B3FAC232AAAF44D00B2D405 /* LlamaWrapper.swift in Sources */,
2BDA45C32ABEE840006128BC /* MessageView.swift in Sources */,
Expand Down

This file was deleted.

1 change: 1 addition & 0 deletions TypeaheadAI/Actors/SpecialOpenActor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import AppKit
import CoreServices
import Foundation
import SwiftUI
import os.log

actor SpecialOpenActor: CanGetUIElements {
Expand Down
1 change: 1 addition & 0 deletions TypeaheadAI/AppContextManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import AppKit
import Foundation
import SwiftUI
import UserNotifications
import Vision
import os.log

Expand Down
7 changes: 7 additions & 0 deletions TypeaheadAI/Extensions/AXUIElement+Extension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -97,4 +97,11 @@ extension AXUIElement {

return actions
}

func isFocused() -> Bool {
guard let value = self.value(forAttribute: kAXFocusedAttribute) as? Bool else {
return false
}
return value
}
}
2 changes: 2 additions & 0 deletions TypeaheadAI/Functions/FunctionManager+PerformUIAction.swift
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,8 @@ extension FunctionManager: CanSimulateEnter {
try await simulateEnter()
}
}
} else {
try await Task.sleep(for: .milliseconds(100))
}
}

Expand Down
14 changes: 14 additions & 0 deletions TypeaheadAI/LayoutManager.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//
// LayoutManager.swift
// TypeaheadAI
//
// Created by Jeff Hara on 12/14/23.
//

import Foundation

class LayoutManager {
init() {

}
}
2 changes: 1 addition & 1 deletion TypeaheadAI/Models/AppContext.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import Foundation
struct AppContext: Codable, Equatable {
let appName: String?
let bundleIdentifier: String?
let pid: pid_t?
var url: URL? = nil
var screenshotPath: String? = nil
var ocrText: String? = nil
var pid: pid_t? = nil
var serializedUIElement: String? = nil
}
6 changes: 6 additions & 0 deletions TypeaheadAI/Models/UIElement.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ struct UIElement: Identifiable, Codable, Equatable {
let link: URL?
let point: CGPoint?
let size: CGSize?
let isFocused: Bool
let domId: String?
let domClasses: [String]?

Expand All @@ -42,6 +43,7 @@ extension UIElement {
self.role = role
self.point = element.pointValue(forAttribute: kAXPositionAttribute)
self.size = element.sizeValue(forAttribute: kAXSizeAttribute)
self.isFocused = element.isFocused()

if let titleAttr = element.stringValue(forAttribute: kAXTitleAttribute), !titleAttr.isEmpty {
self.title = titleAttr
Expand Down Expand Up @@ -177,6 +179,10 @@ extension UIElement {
}
}

if self.isFocused {
text += ", (in focus)"
}

var line = ""
if isIndexed {
line += "\(indentation)\(self.shortId): \(text)"
Expand Down
Loading