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!
A general programming discussion community.
Another solution would be to have a persistent, live pendrive that boots on all the computers one develops on. Something like NomadBSD comes to mind. From a quick search, it looks like Ubuntu can support persistence as well.
I already have a persistent USB drive with Puppy Linux and I really like it, but my uses for it are obviously different
I mostly use it at school to have a system that I like better than Windows, is more secure because only I have access to the file system, and I have all my files with me… but, no, absolutely not doable to boot into the thing every time I want to code.
Learn about hibernation. Cuts time from a full power-off state to replicating your last known state completely from several minutes to 30 seconds even on my fairly old, slow machine.
I already use hibernation on my desktop, actually - but I have to close some of my programs before hibernating or I will find the system is a super slow. Linux handles RAM and swap management, from my experience, a less well than what the current NT (the Windows kernel) does.
You encrypted your file system, didn’t you?
Hm yeah, does that make a difference with a decent CPU? On my current PC I’ve never noticed any difference, with or without drive encryption.
The way drive encryption is implemented on Linux makes it really gross for hibernation. A whole lot of time is wasted.
I code this site mostly from an android tablet nowadays, remote to a linux server.
Once you learn vim, then you can use any ssh client ( or termux ) and code over the terminal. Also you get to say bye-bye to the mouse.
I already use Termux and SSH to administrate my server, sometimes I use nano to edit small scripts, but as I said, I don’t really like it… and vim for me would be even worse :c
As far as a terminal text editor goes, there are some which I would like to try but haven’t already. One of them if mcedit (included in Midnight Commander). I probably should try to use it as my main editor for a while…
Another problem of using just the terminal is that multitasking is not easy. Either you use the tab feature of your terminal emulator, which when using SSH is not really a good idea, or you’re pretty much screwed. I don’t know of any terminal multiplexer/wm that is not too focused on having so many keyboard shortcuts, I would like something with maybe a taskbar at the bottom and that’s it, you switch between consoles by clicking that (or using one simple shortcut).
But, yes, the idea itself of keeping stuff onto one server and just remoting into it seems good. I just need to find a software stack for that that I really like.
You might try micro; it has similar keybindings to Gedit, and is in the Termux repository.
Personally, I use emacs, which runs on everything from server to laptop to netbook to phone.
Thanks for the tip, I will probably try it, I like that some of its shortcuts are similar to what GUI text editors use
tmux is the best multiplexer, and it runs everywhere. Also I wouldn’t discard the keyboard, keyboard-based editors, keyboard-based shortcuts so easily. They’re much faster and more powerful than the mouse. I’m sure you could find a few “why I use vim” videos on youtube where people have calculated how many thousands of hours they’ve saved by never having to take their hands off the keyboard.
Update: well, I just now discovered that tmux can actually be configured to more or less be what I like. Still missing a clickable new-tab button, but being able to click to switch between open tabs and having tab ribbons with a custom color is good enough for me. I’ll try to finish setting up my config then
Maybe, that’s true on a desktop PC… but on mobile, oh well. Even with a physical full-qwerty keypad, it’s a lot harder to use what in this situation I wouldn’t call “shortcuts”.
You already have to move fingers around, better moving it to click a single, well visible, distinctly coloured button, than to aim at a specific modifier key that has the same color and is close to others, and then click another key to do the action.
I’ve been looking for some terminal multiplexer between yesterday and today but I can’t really find something that works as I like: something like GNOME terminal or Konsole, with simple clickable tabs, but it’s a TTY app instead of a GTK/Qt app, so it can run in any other terminal emulator.
I found Zellij which, if customized to only keep the tabs bar, could be a good solution.
It works on my PC, but it’s source is too heavy to compile on my server or even my smartphone…
I also found out about the amazing vtm, basically a full window manager that works in the terminal.
At the moment, it’s too mouse-focused to be fully used in a terminal emulator with only partial mouse emulation, like Termux, but, [un]maximizing windows and opening the side taskbar to navigate between windows works, so it’s at least usable. It’s included in the Termux repos, so I hope it will be easy to compile even on my server.
It has some things I don’t like, such as the fact that it forces is own dark theme - not ideal if you find yourself working on an LCD smartphone in an higly-lit environment, where light theme is basically a requirement to see anything. I will try forking it, to make it work with the standard terminal theme if possible, or a custom light theme. I will also try making some mobile improvements, like making the windows be maximized by default and the taskbar more easily accessible.
Unless someone knows of a TTY terminal multiplexer like I said I need it… just a clickable bar with open tabs, an open button, and close buttons… like any GTK/Qt terminal app, but with TTY rendering…
They’ve calculated, but never measured. There’s a problem with that: calculations come with assumptions that don’t always bear out in the real world: whole time sinks get missed because we don’t perceive them happening.
I know of only one formal study that actually measured and the results of any gains were inconclusive. I’d like to see more, but there are none that I’ve found. I’m putting the “thousands of hours gained because no mouse” thing into the firm camp of religion.
Did they also calculate the thousands of hours they spent customising their vim config?
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)
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.
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.