Open darman96 opened 1 month ago
Oh! I'm glad you're taking me up on that :D
I only have two ideas here off the top of my head:
wongus
process or else for IPC methods an exception should be raised. Could you/did you check the console? I think all calls to wongus
methods from the javascript should raise exceptions rather than log to stderr. If not maybe add a try {} except
around it and console log the error although I'm not sure that would change anything.run_command
thing was actually intended for managed commands, where you want wongus
to watch them until they exit and return the stdout/exit code (like if you want to run a script to get the current cpu temperature, or switch desktops or something). There's a 10s timeout after which it kills the program. Alacritty should be pretty fast to start but just wondering if maybe it took 10s to start and then timed out?To elaborate on the second point, I was originally thinking if you wanted to spawn a detached program you'd use something like systemd-run
to do it, but I think that's probably excessive (and it messes with environment variables). I'll try to add a spawn_detached
method or something that which handles this use case better tomorrow.
I can't remember if you found it already, but right clicking on the panel you should be able to open the developer tools and view the console that way.
hmm, it just worked now.. although I'm pretty sure I ran the exact same code when it didn't.
The spawn_detached
sounds like a good idea though.
Yeah okay, I'll get on that asap - let's leave this issue open for that maybe? Let me know if it happens again though or if you come across any other issues too.
Btw. what do you think about adding a url
option to the config so you could run a node app locally?
Could you still inject the wongus api into something like this?
I moved that to a new issue https://github.com/andrewbaxter/wongus/issues/3 - I'm not sure if you wanted it or were just curious but just in case.
Okay, I added wongus.run_independent
which takes roughly the same arguments as run_command
here: https://github.com/andrewbaxter/wongus/commit/1345633f5855a3814f3fcc0f869191f06f96a9f5
I haven't tried it but it was a small change so I'm hopeful there's no issues. Just FYI though, if you run a command that way and it exits with an error (after starting, I think) you won't get any notification. You can always try with run_command
, then once that's working switch to run_independent
to avoid it getting killed after a timeout.
I'm not sure if run_detached
would be a better name than run_independent
...
I already got another problem :D When I call wongus.run_command nothing seems to happen. I don't get any errors either.
index.html
script.js
I also tried
window.wongus.run_command