Open lexicalunit opened 3 years ago
I attempted to also run brave-cli info
and that actually does cause a crash. Here's what I get in zoomwatcher.err
:
2021-06-15 12:44:52.202 chrome-cli[62428:9448538] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[SBProxyByCode activeTab]: object has not been added to a container yet; selector not recognized [self = 0x7fd787934720]'
*** First throw call stack:
(
0 CoreFoundation 0x00007fff2051698b __exceptionPreprocess + 242
1 libobjc.A.dylib 0x00007fff2024ed92 objc_exception_throw + 48
2 CoreFoundation 0x00007fff205167ef +[NSException raise:format:] + 189
3 CoreFoundation 0x00007fff2047e9bb ___forwarding___ + 1448
4 CoreFoundation 0x00007fff2047e388 _CF_forwarding_prep_0 + 120
5 chrome-cli 0x0000000101ff684b -[App activeTab] + 48
6 chrome-cli 0x0000000101ff50f4 -[App printActiveTabInfo:] + 30
7 chrome-cli 0x0000000101ff7ca2 -[Handler call:] + 364
8 chrome-cli 0x0000000101ff7350 -[Argonaut run] + 85
9 chrome-cli 0x0000000101ff83f0 main + 1577
10 libdyld.dylib 0x00007fff203bef3d start + 1
)
libc++abi: terminating with uncaught exception of type NSException
/usr/local/bin/brave-cli: line 4: 62428 Abort trap: 6 chrome-cli "$@"
When I run it from a terminal window I get:
Id: 352
Title: Doesn't work from LaunchAgents · Issue #60 · prasmussen/chrome-cli
Url: https://github.com/prasmussen/chrome-cli/issues/60
Loading: No
@lexicalunit have you managed to fix this? experiencing the same issue
No solution using chrome-cli
, but I was able to do it using osascript
:
BRAVE="osascript -e 'tell application \"System Events\" to (name of processes) contains \"Brave Browser\"'"
if test "$(eval "$BRAVE")" = "true"; then
osascript <<EOF
set titleString to ""
tell application "Brave Browser"
set window_list to every window # get the windows
repeat with the_window in window_list # for every window
set tab_list to every tab in the_window # get the tabs
repeat with the_tab in tab_list # for every tab
set the_url to the URL of the_tab # grab the URL
set titleString to titleString & the_url & "\n"
end repeat
end repeat
end tell
EOF
fi
And this seems to work fine within the context of a launch agent.
I have a LaunchAgent that attempts to look for
meet.google.com
in my browser tabs so that I can turn on a red "in-meeting" light.Within my
zoomwatcher
script I do:And if I watch
/tmp/zoomwatcher.out
I see the "########" output, I see "my_user_name" as output by thewhoami
command, and I see "1.7.0" output as the version. But that's it. No links are listed. There are also no errors in/tmp/zoomwatcher.err
. The command seems to be working... it's just not finding any tabs/links.However If I just run
brave-cli list links
in a terminal window, it works: