Developing on Android Devices with Samsung DeX and Termux: A Complete Guide
In recent times, mobile devices have evolved into powerful machines that are capable of more than mere media consumption and casual usage. With Samsung’s DeX Mode, devices like the Galaxy Tab S7+, S9, or Galaxy S24 Ultra can be turned into near-desktop environments, enabling productivity tasks like software development.
A popular method for harnessing this potential is to use the Termux terminal emulator alongside the right set of tools to create a robust development environment directly on your Android device.
In this post, we’ll dive into setting up a professional development environment using Termux on a Samsung device in DeX mode. We’ll go over installing ZSH, theming it with Oh-My-Zsh and Powerlevel10k, using Neovim as a text editor, installing a Nerd Font for better visuals, setting up Code-Server for a cloud-like development experience, and even renting a virtual server for remote development via SSH.
Setting Up Termux with ZSH and Oh-My-Zsh
The first step in turning your Android into a powerful development machine is installing Termux. You can download Termux directly from F-Droid or from the official website. Once installed, it opens the door to a Linux-like environment on Android. After launching Termux, you’ll want to install ZSH, a more interactive and user-friendly shell, and Oh-My-Zsh, a framework for managing your ZSH configuration.
Here’s how to get started:
|
|
To enhance the look and feel, you can install Oh-My-Zsh with the following:
|
|
Now, to make your terminal not only functional but also visually stunning, we’ll install the Powerlevel10k theme for Oh-My-Zsh. This will add a beautiful prompt with useful features like Git status and time.
|
|
Now set Powerlevel10k as the default theme by editing your .zshrc
:
|
|
Installing Programming Languages and Neovim with LazyVim
Termux supports a variety of programming languages like Python, Node.js, and Elixir, allowing you to develop directly on your device. To install some of the most common ones:
|
|
For coding, we recommend using Neovim with the LazyVim configuration, a modern and user-friendly Vim experience:
|
|
To configure Neovim with LazyVim, follow these steps:
|
|
Adding a Nerd Font for Enhanced Icons
Neovim configurations like LazyVim take full advantage of Nerd Fonts, which provide additional icons for a better developer experience. To install a Nerd Font:
Download the font using
wget
:1 2
pkg install wget //if not already installed wget https://github.com/ryanoasis/nerd-fonts/releases/download/v3.2.1/JetBrainsMono.zip
Unzip and move the
.ttf
file into the Termux fonts directory:1 2 3
unzip JetBrainsMono.zip mv JetBrainsMonoNerdFont-Regular.ttf ~/.termux/font.ttf termux-reload-settings
Restart Termux to apply the new font.
Using Code-Server: VS Code in the Browser
If you prefer a Visual Studio Code experience, you can install Code-Server. Code-Server allows you to run VS Code on a remote server and access it via a web browser, even on your Android device.
To install Code-Server in Termux:
|
|
You can start the server with:
|
|
Then, open your browser and navigate to localhost:8080
to start coding in VS Code from your device.
Remote Development with SSH and a Virtual Linux Server
A more scalable solution is to develop on a virtual Linux server (VPS) rented from providers like DigitalOcean or Linode. For this, we can use SSH to securely connect to the server from Termux.
Here’s how to generate an SSH key and upload it to the server:
Generate an elliptic-curve key for SSH:
1
ssh-keygen -t ecdsa -b 521
Upload the public key to your remote server:
1
ssh-copy-id user@server-ip
You can now connect to your server:
|
|
Configuring SSH for Automatic Port Forwarding
To simplify repeated SSH connections and configure port forwarding for Code-Server access, we can create an SSH config file.
Create a new SSH config file at ~/.ssh/config
:
|
|
Add the following content:
|
|
Now, you can simply type ssh myserver
, and your Code-Server running on the remote server will be available at localhost:8080
in your browser.
Arch Linux and Code-Server Marketplace Extensions
For those who prefer Arch Linux, which is known for its rolling release model and up-to-date packages, you can set up a VPS with Arch Linux and install Code-Server.
Arch users can benefit from the AUR (Arch User Repository) to install the code-marketplace
package. This allows you to install extensions from the Microsoft Marketplace in Code-Server, including Copilot:
|
|
This opens up the entire VS Code extension ecosystem, providing powerful tools like Copilot for AI-powered coding.
Tips and Considerations
- Samsung DeX: Make sure to activate Samsung DeX for a desktop-like environment that enhances productivity.
- External Keyboard and Mouse: These are highly recommended for a comfortable coding experience.
- Battery Life: Coding can be demanding on battery life. Keep your tablet charged or connected to a power source.
Conclusion
With Samsung DeX, Termux, and the right setup, your Android device can be transformed into a portable coding powerhouse. Whether you’re coding locally with Neovim, setting up a remote development server with SSH, or using Code-Server to leverage Visual Studio Code in your browser, the possibilities are endless. Whether you’re a seasoned developer or just starting your coding journey, this setup offers flexibility and convenience for coding on the go. By harnessing the power of modern tools like Powerlevel10k, LazyVim, and Code-Server, you can make mobile development not just feasible, but enjoyable. This setup can be a game-changer for developers looking to push the boundaries of mobile productivity.
So why not give it a try? Fire up Termux, unleash your creativity, and start building amazing things right from your Android device!