this post was submitted on 15 Aug 2022
0 points (50.0% liked)

General Programming Discussion

7806 readers
1 users here now

A general programming discussion community.

Rules:

  1. Be civil.
  2. Please start discussions that spark conversation

Other communities

Systems

Functional Programming

Also related

founded 5 years ago
MODERATORS
 

Hi! I've been thinking about this for a while. I realize it's a first-world-problem, but it still haunts me 😅

I often develop software, of different kinds: HTML5 stuff, Python programs, and sometimes even C things.

My main development machine is my desktop GNU+Linux PC. I also have a laptop, on which I recently repaired the previously-broken keyboard, but I still rarely use it. I will now get to why.

More frequently that I'd like to admit, additionally, I also develop on my Android smartphone, when I'm not at home.
I don't bring my laptop anywhere, because it's a 2KG 15" beast. The best I can do is to use it around the house, moving it from my desk.
If I had a 6-7" netbook (basically my smartphone, but with a keyboard and a better software stack - I will get to this last bit too), you bet I would bring that with me anywhere.

Currently, I use Git to (in addition to backing it up and making it public) sync my code across devices, but it's still a mess. Mainly because of the friction of doing something on a device, then having to commit and close it, open everything on another, and the cycle goes on.
Because yes, I need to open and close stuff.

I use my PC for stuff that's other than just programming, and can't just leave stuff open, I need to turn it off when not in use because it wastes a lot of energy. At the same time, turning it off means wasting time because on HDD - unless I want to reinstall Alpine Linux, where everything was blazing fast but the need of configuring every system thing by hand killed me - everything takes ages to load.

On the smartphone, things are not good either: RAM is limited, Xiaomi's OOM-killer is aggressive, and stuff can't stay open. Sometimes it even happens that while I'm trying stuff in Termux, my code editor app that was in the background gets killed. At least, flash memory means everything reopens quick.

Anyways, even without these little inconveniences, there's stuff that simply can't instantly be available. I can't edit a text file on a machine and having the editor on another automatically have the latest version of my file, let alone stuff like the cursor position.. At least with my current development tools.

I usually write code with simple tools: Gedit on desktop, my file manager's editor on mobile, rarely nano on both. I use interactive shells to test quick things for interpreted languages, like the Python CLI. Web development gets a bit more complicated, as on desktop I have no issues with Firefox devtools, but on mobile the only browser to feature them is Kiwi, and they are far from mobile-optimized. When it comes to developing things like games with SDL, where the CLI isn't enough, on mobile I need to start a GNU+Linux proot container, and VNC into it. Finally, I use Git CLI to push/pull code.

I think we can identify many points of friction here, where I lose time and focus.
Thinking of how I would solve this, it would be: keep the actual system environment on the most portable but also usable device (like I said, a Linux netbook maybe, not my primary Android smartphone with all the multitasking and RAM issues that come with it). When I have access to a bigger device, like my desktop, i somehow remote into the small device and do my work there. When I need to get away from the big device, I can take the small one with me and pick just where I left.

Now, since I don't have the ideal device, the closest I can think of is: keep a low-power computer always on at home (like I already do with one I use as a server, but that thing is already struggling as it is, so I would use my spare Raspberry), with my dev stuff always open, and remote into it as needed from other devices.

But, here come another issue: how do I actually remote into it?
VNC is not really an option. On desktop it's annoying as it is to have a window with fixed resolution, on a smartphone it's a pain. Not to mention, the lag. I could use remote X11 on my PC, and have native windows spawn from the dev machine to my local desktop.. not on Android though. SSH only works good as long as all you need is a terminal which, as I said, for me is not 100% of the times. There aren't even terminal code editors that I really like.


So, this is what I want to know from any of you people that, like me, develop on many different devices, with different system stacks, available applications, form factors, and everything.

Is there any solution more optimal than VNC? Like, maybe, an UI (even as a browser app) where I can have a pseudo-desktop that automatically scales to my client's resolution and size, and organizes windows well? Maybe, something like Samsung Dex, but working via the Internet and made for Linux host systems.

Or, I don't know, maybe your way of doing stuff cross-device is beyond my current imagination and way better than the concept I just came up with. Tell me that too!

you are viewing a single comment's thread
view the rest of the comments
[–] bri@lemmy.ml 0 points 2 years ago (2 children)

For me this is absolutely a solved problem.

For editing code, etc., I use VS Code Remoting. https://code.visualstudio.com/docs/remote/ssh if you’re willing to use VSCode instead of something like Gedit, you can just give it an ssh login and it will download and run a headless version of itself on the remote machine.

Between that and syncing my config and extensions (which I was very reluctant to do but am glad I did), I have the same coding environment everywhere with the same file system, so long as I can ssh.

You mentioned you need graphical app support too, though. I recommend xRDP. I just installed it on a VPS, and it’s easily 2-3x as fast as the fastest VNC I could set up. Chromium and Firefox run so smoothly I was almost able to watch a YouTube video (though my CPU was pegged, of course…). It’s super simple to use, too.

The default config is pretty good, though you’ll want to edit the default pam.d file if you rely on automatically unlocking the login keychain, and I connect through ssh port tunneling because I don’t feel super comfortable leaving a graphical login screen open. (It’s its own login prompt, not something like XDMCP)

[–] octt@feddit.it 0 points 2 years ago* (last edited 2 years ago) (1 children)

Thanks for the suggestions!

I've looked a bit into it and if I understand, I can just install the VSCode server on the machine I will keep all my code on, and then use the VSCode client on a client device.

Seems OK to me, except for.. do you know if VSCode being broken on mobile web browsers is a common issue? I've sometimes tried the online VSCode editor (github.dev, or the GitLab code editor, which are simply VSCode without a server) on Kiwi Browser (Chromium-based) and with OpenBoard (my preferred virtual keyboard) I have issues. Sometimes I can't type anymore, some other times I can type but not delete with backspace, and a long-press to bring up the copy-paste menu stops working. I should try Firefox..


Update: well, I tried it, with code-server and it has many problems on mobile browsers. It's Monaco Editor's (the editor used by VSCode) fault, see https://github.com/Microsoft/monaco-editor/issues/246.

Hovewer, I found this project, a web IDE that's not VSCode but uses a patched version of Monaco Editor, that should work well with mobile: BLACKICEcoder.
If I can't get a satisfying workflow with TUI text editors, I might try using this to edit code, and SSH to run it and have access to a terminal (which this does not include, unlike VSCode).

I found out that things like Replit (a SaaS-only, proprietary and not selfhostable, cloud IDE) use another editor, CodeMirror.
Unfortunately, I can't find any ready-to-use selfhostable solution that has the text editor web client connect to a server, like code-server does for VSCode.

[–] bri@lemmy.ml 1 points 2 years ago

I don’t code on mobile often, but when I do I tend to just use (neo)vim over ssh, on an ssh client that has control and escape keys. I wouldn’t suggest anyone learn vim these days unless they really want to, but it does work very well with a limited keyboard and screen.

I suppose it’s very different from vscode, but it definitely is more compatible.