Ever found yourself on the run, needing a multiple-monitor setup but only have your *nix machine and an Android device handy? Following is a few commands to run applications on the Android device.
Additionally, this method uses the Android development tool
adb with the option to use a USB cable instead of WiFi for a little extra speed.
The steps are as follows:
- Install an X server on your Android device. I’m using XSDL.
- Run and customise the server e.g. choose the desired resolution etc.
adbon your *nix machine, like:
# Arch-based distros yay -S android-platform-tools
# Debian-based distros sudo apt-get install android-tools-adb
# Fedora/SUSE-based distros sudo yum install android-tools
# Macos/OSX-based brew cask install android-platform-tools
- Connect your Android device to your machine via USB.
- Enable USB debugging on the device under “Developer Settings” within the Android “Settings”. If you don’t have the “Developer Settings” menu item you need to enable¹ it.
- Then, in on your favourite CLI forward from your local TCP port
6100to the remote
adb forward tcp:6100 tcp:6000
- Next, set up the environment variable to point to the new monitor like so:
x2xvia your package manager if it is present, or from Github.
# Arch-based distros yay -S x2x
x2xin the background with the following:
x2x -east -to :100 -from :0 &
- Install the
# Arch-based distros yay -S xfwm4
# Debian-based distros sudo apt-get install xfwm4
# Fedora/SUSE-based distros sudo yum install xfwm4 # presumably?
- And lastly run
xfwm4and the application you need in a separate terminal editor or via a launcher, script etc. DO REMEMBER though to set the
DISPLAYvariable before running said applications.
# With xfwm4 DISPLAY=:100 && xfwm4 & terminator # Without xfwm4, such as would be the case on Mac DISPLAY=:100 && terminator
- If you end up using this a lot or find the steps tedious, run the following script:
#!/usr/bin/env bash export DISPLAY=:100 adb forward tcp:6100 tcp:6000 x2x -east -to :100 -from :0
- and use
dmenuor similar launcher to to prefix the environment variable to and executable.
May the force be with you.
- Tap on the “Build number” label seven times (or until you’re notified that “Developer Settings” has been enabled)