-
-
Notifications
You must be signed in to change notification settings - Fork 489
Add on-window-detected info to debug-windows command resolves #1326 #1340
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,6 +10,19 @@ struct WindowDetectedCallback: ConvenienceCopyable, Equatable { | |
| rawRun ?? dieT("ID-46D063B2 should have discarded nil") | ||
| } | ||
|
|
||
| var debugInfo: Json { | ||
| var result: [String: Json] = [:] | ||
| result["matcher"] = matcher.debugInfo | ||
| if let commands = rawRun { | ||
| let commandsJson: [Json] = commands.map { command in | ||
| let args = command.args.rawArgs.value.joined(separator: ",") | ||
| return .string("\(command.info.kind.rawValue) \(args)") | ||
| } | ||
| result["commands"] = .array(commandsJson) | ||
| } | ||
| return .dict(result) | ||
| } | ||
|
|
||
| static func == (lhs: WindowDetectedCallback, rhs: WindowDetectedCallback) -> Bool { | ||
| return lhs.matcher == rhs.matcher && lhs.checkFurtherCallbacks == rhs.checkFurtherCallbacks && | ||
| zip(lhs.run, rhs.run).allSatisfy { $0.equals($1) } | ||
|
|
@@ -23,6 +36,26 @@ struct WindowDetectedCallbackMatcher: ConvenienceCopyable, Equatable { | |
| var workspace: String? | ||
| var duringAeroSpaceStartup: Bool? | ||
|
|
||
| var debugInfo: Json { | ||
| var resultParts: [String] = [] | ||
| if let appId = appId { | ||
| resultParts.append("appId=\"\(appId)\"") | ||
| } | ||
| if appNameRegexSubstring != nil { | ||
| resultParts.append("appNameRegexSubstrin=Regex") | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There's no way to get the actual regex string from the |
||
| } | ||
| if windowTitleRegexSubstring != nil { | ||
| resultParts.append("windowTitleRegexSubstring=Regex") | ||
| } | ||
| if let workspace = workspace { | ||
| resultParts.append("workspace=\"\(workspace)\"") | ||
| } | ||
| if let duringAeroSpaceStartup = duringAeroSpaceStartup { | ||
| resultParts.append("duringAeroSpaceStartup=\(duringAeroSpaceStartup)") | ||
| } | ||
| return .string(resultParts.joined(separator: ", ")) | ||
| } | ||
|
|
||
| static func == (lhs: WindowDetectedCallbackMatcher, rhs: WindowDetectedCallbackMatcher) -> Bool { | ||
| check( | ||
| lhs.appNameRegexSubstring == nil && | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yet another maintenance task: it's probably worth converting this struct to enum