Hi, Just wanted to report an issue due to which error above error is being thrown. I am using this great library for my Electron app. When my currently opened window is browser either chrome or Mozilla and I simple do:
let currentWindow = await activeWindow({});
I get following error in case of some titles:
(node:85881) UnhandledPromiseRejectionWarning: SyntaxError: Bad escaped character in JSON at position 12
at JSON.parse (<anonymous>)
at parseLinux (/node_modules/active-win/lib/linux.js:49:15)
at getWindowInformation (/node_modules/active-win/lib/linux.js:93:15)
I suspect that it is due to title containing some special characters that are not being parsed by JSON.parse on line 49 in /node_modules/active-win/lib/linux.js
Following are the title that are returned in the result object when I log them:
"New Issue \302\267 sindresorhus/active-win - Google Chrome"
" TEAMTRACKER \342\200\224 Mozilla Firefox"
Hi, Just wanted to report an issue due to which error above error is being thrown. I am using this great library for my Electron app. When my currently opened window is browser either chrome or Mozilla and I simple do:
let currentWindow = await activeWindow({});
I get following error in case of some titles:
I suspect that it is due to title containing some special characters that are not being parsed by JSON.parse on line 49 in /node_modules/active-win/lib/linux.js
Following are the title that are returned in the result object when I log them:
I had to return :
title: (result['_NET_WM_NAME(UTF8_STRING)'] || result['WM_NAME(STRING)'])
Instead of :
title: JSON.parse(result['_NET_WM_NAME(UTF8_STRING)'] || result['WM_NAME(STRING)']) || null,
Then, had to escape characters in my code before saving title to the DB.
Platform is : Ubuntu 20.04
I hope above issue makes sense.
Thanks