Allow for (better) remote script editing on a desktop/laptop #1067
Comments
|
From the initial discussion we have the following suggestions:
I'll try out these suggestions this week and report back how well it works. |
(summarizing from linked forum topic) this is easy in any scripting environment that supports websocket subprotocols. nodejs:
python3:
tools like should we add some language bindings to the norns repo? |
|
Some initial findings after a bit of experimentation:
TODO:
Screenshot of the current state in Atom using atom-build and the Python script running in a terminal showing the websocket output: |
|
fyi i believe just running |
|
Did a quick testrun using I did have to run it using So how I'm using it now:
Runing scripts programmatically works as well:
And if the other REPL is still running you'll get the output there. |
|
So I think I've found a decent setup to start with:
rlwrap websocat -0 --protocol bus.sp.nanomsg.org ws://norns:5555This shows the output from matron and can be used for interactive/REPL like execution of commands, similar to how the matron tab works in maiden.
This is my current atomCommandName: "Norns: Run script"
name: 'Norns: Run script'
cmd: 'PROJECT_NAME=$(basename {PROJECT_PATH}) && sshpass -p sleep rsync -a --delete --exclude=".*" --delete-excluded {PROJECT_PATH} we@norns:/home/we/dust/code/ && echo "norns.script.load(\"code/${PROJECT_NAME}/${PROJECT_NAME}.lua\")" | websocat --one-message --protocol bus.sp.nanomsg.org ws://norns:5555'
sh: trueIt's been working without issues this whole evening and is pretty much what I was looking for. I do see some room for improvements, but those can come later/after some more experience as well. One obvious thing would be to write a proper Atom-build provider so no per project config is necessary. Screenshot to prove that it really works ;) |
|
@justmat @markwheeler I noticed you +1'd this issue. I don't know which editor you're using but if you're using Atom it would be nice if you could give the setup as described above a try and let us know what you think. |
|
I am kind of a caveman when it comes to editors and will pretty much just type into any window that happens to show up and do all file management 100% manually. But then I got jealous seeing the screenshot at the top! Never used Atom, I'll check it out, Sublime is the only editor I have any familiarity with (but still, not much). |
|
I use Sublime mostly, and vim most other times. If needed, I am happy to download Atom and try to set this up! |
|
@markwheeler @justmat The idea of this approach would be that you can use it with any editor/the editor of your choice. For Sublime it should be possible to achieve +- the same result using for example https://packagecontrol.io/packages/Terminus to run @justmat I only know the basics about vim, but since pretty much anything is possible there I assume it should be possible to integrate the REPL and sync+run script in there as well. I don't really have any suggestions for how to do so though. P.S. @markwheeler
I'm really surprised by this given the awesome things you have created |
|
@simonvanderveldt curious about the advantage of running which got me thinking--- it'd probably be somewhat trivial to modify my dumb editor opinions: i liked sublime a lot before i went full-in on vim. atom (at the time) felt bloated and slow (maybe it's better now). vscode is the first thing that makes me consider going back to a big IDE, so i'm curious to see how people push forward in this domain. thanks for the investigation! |
but, what are those? the maiden-repl is my janky ncurses code. ncurses is weird and crusty and some things i tried to do did not work right (scrolling and switching between REPLs.) simon doesn't like some of the visual decisions (white lines) which is legit. so... the only real enhancement i see is adding readline? (and, i guess, the abliity to keep your input field separate from output window, which is important with lots of output.) you know, we could just add readline to |
|
readline, yes. up-arrow alone is worth it for me. |
|
@tehn The main reason is that this way I only need to run some programs on my local machine. Otherwise I'd first need to SSH to norns before I can run maiden-repl. Not a big difference, but running everything locally is a little bit simpler, especially when i want to automatically open a terminal in my editor that shows the websocket stream. Note that you don't lose any readline functionality vs maiden-repl, that's what I think the only functionality I'm missing this way is having both the websocket stream for matron as well as crone available and being able to switch between them using I also had some issues with maiden-repl. For example the white bars @catfact mentioned. It's not that I don't like them, it's that they had some issues. It gave me a big white bar when used inside a small terminal window in my editor and probably some unicode glitch when used in a regular terminal. See images below P.S. I agree that something like druid that mimics the current maiden-repl functionality might be useful, because it could offer a REPL for both matron and crone and it would be relatively easy to add tab completion for supported matron commands. But to get started I think the current setup is good enough. |
|
I had a play around setting up vscode using @simonvanderveldt's approach for Atom above. FWIW, here are a few notes from a novice:
Overall it feels promising! |
Tbh for me connecting to just
I'm not sure why rsync would act differently. You don't have an
Thanks for the suggestion. I've updated the command I posted above to include these.
Yeah, it's available at port 5556, you can run a separate rlwrap websocat --protocol bus.sp.nanomsg.org ws://norns:5556This is one of the areas where depending on what you want it might be nicer to use
I think these "magic" commands are some niceties that are only available in maiden (@ngwese can probably confirm if this is correct). It would be nice if we had these available in every REPL.
I think for working on engines/SC code |
No, nothing norns related in there. I can ping
Yes, sorry being vague there, my personal involvement is only working on the lua layer of norns – libs or menus etc.
Restarting SC has always been somewhat unreliable for me, but it seems particularly failure-prone when using audio:restart() which often causes SC to fail with this jack error #806 we've discussed a bit in the past. |
The |
|
Hey guys |
|
Additionally since this ticket was opened I hacked up a tool which can be used to trigger a script load or reload when files change. https://github.com/ngwese/maiden-run It hasn't been polished but the intention was to include it on device and provide binaries for people to run from editors running off device. |
|
this is a pretty nebulous "issue" at this point. lots of great information is contained, and this would better exist as a wiki page or forum thread. if there are concrete code changes to be made, let's identify them as specific issues. |




Whilst we have the options to work on scripts in Maiden in the browser and by using something like Vim via SSH on norns it would be nice if it would be easily possible to work on scripts using my editor of choice running on my own desktop/laptop computer.
There have been some questions about this on lines as well (for example this topic and this post).
The goal would be to allow users to configure/build something like @ngwese's VS Code setup (screenshot below) using their editor of choice.

I think the following things are required:
Note that I don't expect us to write complete integrations/plugins for specific editors. It's more about making the tools/hooks available so users can configure/build this functionality in their editors themselves.
The text was updated successfully, but these errors were encountered: