get-windows
get-windows copied to clipboard
UnhandledPromiseRejectionWarning: SyntaxError: Unexpected number in JSON at position 10
Hi team
The module is working fine, but I am getting errors on some specific sites and applications. I am getting below error on https://gitlab.com/users/sign_in Open above link on the browser and try to get activeWindow(), you can find this error
(node:16684) UnhandledPromiseRejectionWarning: SyntaxError: Unexpected number in JSON at position 10
at JSON.parse (<anonymous>)
at parseLinux (/var/www/html/focusro-electron-app-apptrack/focusro-app/node_modules/active-win/lib/linux.js:49:15)
at getWindowInformation (/var/www/html/focusro-electron-app-apptrack/focusro-app/node_modules/active-win/lib/linux.js:92:15)
at async Timeout._onTimeout (/var/www/html/focusro-electron-app-apptrack/focusro-app/electron-main.js:455:28)
(node:16684) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 3)
Why is this happening ? any solutions ? I am using 8.0.2 version. thanks in advance
+1
+1
+1
i am also facing this issue
+1
+1
+1
https://github.com/sindresorhus/active-win/blob/27221e5da0a64025bdec8759605694ea84ff9f68/lib/linux.js#L47-L54
I meet the same problem, after some debug, I change to
return {
platform: 'linux',
title: result['_NET_WM_NAME(UTF8_STRING)'] || result['WM_NAME(STRING)'] || null,
id: windowId,
owner: {
name: result['WM_CLASS(STRING)'].split(',').pop(),
processId
},
well, at least it kind of works.
{
platform: 'linux',
title: '"apptimer : apptimer \\342\\200\\224 Konsole"',
id: 150994959,
owner: { name: ' "konsole"', processId: 169925, path: '/usr/bin/konsole' },
bounds: { x: 0, y: 42, width: 1920, height: 994 },
memoryUsage: 217608192
}
about windowId
, I found that it will have some problems when listening to a browser or a wine app. For example: become undefined
.
and doesn't support CJK