implemented exact-only matching, corner-case cleanup, and reduced logging noise.
Code:
+ if str == nil then
+ return nil
+ end
+
+ if not stringStartsWith(str, "L:") then
+
+-- Debug llog.info("WindowManager", "bad-client-name", "winName=" .. tostring(str), "report-untidy")
+
+-- exact matches only, Ditch the system stuff, this prevents thing like "Gtkboard" matching "kb"
+
+ if (str == "kb") or (str == "webreader") or (str == "pillowd") then
+ return nil
+
+ else
+
+-- we made it this far - let tidy up likely corner cases
+-- tidy up spaces and other potentially magic characters
+ str = string.gsub(str, "%s+", "-")
+ str = string.gsub(str, "%%+", "-")
+ str = string.gsub(str, "%^+", "-")
+ str = string.gsub(str, "%$+", "-")
+ str = string.gsub(str, "%(+", "-")
+ str = string.gsub(str, "%)+", "-")
+ str = string.gsub(str, "%[+", "-")
+ str = string.gsub(str, "%]+", "-")
+ str = string.gsub(str, "%*+", "-")
+ str = string.gsub(str, "%?+", "-")
+ str = string.gsub(str, "%++", "-")
+ str = string.gsub(str, "%_+", "-")
+ str = string.gsub(str, "%/+", "-")
+ str = string.gsub(str, "%:+", "-")
+
+-- Debug llog.info("WindowManager", "good-client-name", "winName=" .. tostring(str), "post-tidy")
+ str = "L:A_N:application_ID:" .. tostring(str) .. "_O:R_PC:N"
+-- Debug llog.info("WindowManager", "title", tostring(str) , " ✔")
end
+end