如何获取Linux / Mac / Windows上的节点/电子应用程序中的浏览器活动标签URL?

我正在寻找一个聪明的方式来获得一个跨平台的电子应用程序的活动浏览器的url。 我发现了一个使用AppleScript的Mac OS Safari和Chrome的解决scheme,但仍然没有Firefox,Windows和Linux的解决scheme:(

使用AppleScript的MacOS上的Chrome和Safari解决scheme:

使用节点 – 苹果脚本我能够获得Safari浏览器和Chromeurl。 不幸的是,Firefox不支持AppleScript,并且获取URL的方式很糟糕,并且在生产中不可用。 另外,我仍然不知道如何获取Linux和Windows上的URL。

const scripts = { 'chrome': `tell application "Google Chrome" to get URL of active tab of front window as string`, 'vivaldi': `tell application "Vivaldi" to return URL of active tab of front window`, 'safari': `tell application "Safari" to return URL of front document as string`, 'firefox': `tell application "Firefox" to activate tell application "System Events" keystroke "l" using command down keystroke "c" using command down end tell delay 0.5 return the clipboard`, }