Closed shassard closed 3 years ago
You might be able to do something like this (mind that I don't have xcode available at the moment to test this):
diff --git a/SwiftBar/MenuBar/MenuLineParameters.swift b/SwiftBar/MenuBar/MenuLineParameters.swift
index b1ecfda..b87d145 100644
--- a/SwiftBar/MenuBar/MenuLineParameters.swift
+++ b/SwiftBar/MenuBar/MenuLineParameters.swift
@@ -53,7 +53,8 @@ struct MenuLineParameters {
var bashParams: [String] {
var out: [String] = []
- for i in 0 ... 10 {
+ let sortedParams = Array(params.keys).sorted {(s1, s2) -> Bool in return s1.localizedStandardCompare(s2) == .orderedAscending}
+ for i in sortedParams {
guard let param = params["param\(i)"] else { continue }
out.append(param.escaped())
}
@shassard thank you both for suggestion and the code snippet!
SwiftBar is currently limited to processing a maximum of 10 parameters for a shell call:
https://github.com/swiftbar/SwiftBar/blob/4e6f77e176f42745a56047013bf0bc7d0d4f56a3/SwiftBar/MenuBar/MenuLineParameters.swift#L56
xbar will process an unlimited number scanning for keys prefixed with param: https://github.com/matryer/xbar/blob/3e6f4a0b9a3a526a86779f4080beb5cacb3c9d0f/pkg/plugins/item_params.go#L255-L269
This results in some compatibility issues with xbar when using > 10 arguments for a shell call.
It seems easy enough to change 10 to 20 to increase this limit and make this less common, but that doesn't seem like a great solution.