Add on-window-detected info to debug-windows command resolves #1326#1340
Closed
hieberr wants to merge 2 commits intonikitabobko:mainfrom
Closed
Add on-window-detected info to debug-windows command resolves #1326#1340hieberr wants to merge 2 commits intonikitabobko:mainfrom
hieberr wants to merge 2 commits intonikitabobko:mainfrom
Conversation
hieberr
commented
Apr 24, 2025
| resultParts.append("appId=\"\(appId)\"") | ||
| } | ||
| if let _ = appNameRegexSubstring { | ||
| resultParts.append("appNameRegexSubstrin=Regex") |
Contributor
Author
There was a problem hiding this comment.
There's no way to get the actual regex string from the Regex. So, I just hardcode "Regex" in here and for windowTitleRegexSubstring. It's maybe enough just to know that there was a regex that matched. If we want to actually have the regex string we could save it when parsing the config.
Owner
|
lol, I didn't expect that somebody would jump into maintenance tasks, thanks I've merged your commit with the following minor patch on top: commit 6bb5aa68af0b28a2a2a7efb2cfd6090038ec0047
Author: Nikita Bobko <git@bobko.xyz>
AuthorDate: Fri Apr 25 00:30:37 2025 +0200
Commit: Nikita Bobko <git@bobko.xyz>
CommitDate: Fri Apr 25 00:30:37 2025 +0200
fixup! Add matching on-window-detected info to debug-windows command
diff --git a/Sources/AppBundle/command/impl/ConfigCommand.swift b/Sources/AppBundle/command/impl/ConfigCommand.swift
index 58ba728c..118a9fbb 100644
--- a/Sources/AppBundle/command/impl/ConfigCommand.swift
+++ b/Sources/AppBundle/command/impl/ConfigCommand.swift
@@ -135,12 +135,18 @@ extension ConfigMapValue {
}
}
+extension [Command] {
+ var prettyDescription: String {
+ map { $0.args.description }.joined(separator: "; ")
+ }
+}
+
@MainActor func buildConfigMap() -> ConfigMapValue {
let mode = config.modes.mapValues { (mode: Mode) -> ConfigMapValue in
var keyNotationToScript: [String: ConfigMapValue] = [:]
for binding in mode.bindings.values {
keyNotationToScript[binding.descriptionWithKeyNotation] =
- .scalar(.string(binding.commands.map { $0.args.description }.joined(separator: "; ")))
+ .scalar(.string(binding.commands.prettyDescription))
}
return .map(["binding": .map(keyNotationToScript)])
}
diff --git a/Sources/AppBundle/command/impl/DebugWindowsCommand.swift b/Sources/AppBundle/command/impl/DebugWindowsCommand.swift
index 6e42b0cf..d2250de8 100644
--- a/Sources/AppBundle/command/impl/DebugWindowsCommand.swift
+++ b/Sources/AppBundle/command/impl/DebugWindowsCommand.swift
@@ -91,7 +91,7 @@ private func dumpWindowDebugInfo(_ window: Window) async throws -> String {
var matchingCallbacks: [Json] = []
for callback in config.onWindowDetected where try await callback.matches(window) {
- matchingCallbacks.append(callback.debugInfo)
+ matchingCallbacks.append(callback.debugJson)
}
result["Aero.on-window-detected"] = .array(matchingCallbacks)
diff --git a/Sources/AppBundle/config/parseOnWindowDetected.swift b/Sources/AppBundle/config/parseOnWindowDetected.swift
index 421655ab..eccae241 100644
--- a/Sources/AppBundle/config/parseOnWindowDetected.swift
+++ b/Sources/AppBundle/config/parseOnWindowDetected.swift
@@ -10,15 +10,11 @@ struct WindowDetectedCallback: ConvenienceCopyable, Equatable {
rawRun ?? dieT("ID-46D063B2 should have discarded nil")
}
- var debugInfo: Json {
+ var debugJson: 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)
+ result["commands"] = .string(commands.prettyDescription)
}
return .dict(result)
}
|
nikitabobko
reviewed
Apr 24, 2025
| var workspace: String? | ||
| var duringAeroSpaceStartup: Bool? | ||
|
|
||
| var debugInfo: Json { |
Owner
There was a problem hiding this comment.
Yet another maintenance task: it's probably worth converting this struct to enum
ZimengXiong
pushed a commit
to ZimengXiong/winmux
that referenced
this pull request
Apr 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds matching on-window-detected debug info to the debug-windows command.
I wasn't sure what info you wanted so I included everything. Also, I'm happy to change formatting if you would like something different.
Example Output:
Typical/simple case
Full case