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.
Requirements#
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.
- Install
adb
on your *nix machine, like:
Arch-based distros#
1
| yay -S android-platform-tools
|
Debian-based distros#
1
| sudo apt-get install android-tools-adb
|
Fedora/SUSE-based distros#
1
| sudo yum install android-tools
|
Macos/OSX-based#
1
| 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
6100
to the remote 6000
.
1
| adb forward tcp:6100 tcp:6000
|
- Next, set up the environment variable to point to the new monitor like so:
- Install
x2x
via your package manager if it is present, or from Github.
Arch-based distros#
- Run
x2x
in the background with the following:
1
| x2x -east -to :100 -from :0 &
|
- Install the
xfwm4
package thusly:
Arch-based distros#
Debian-based distros#
1
| sudo apt-get install xfwm4
|
Fedora/SUSE-based distros#
1
| sudo yum install xfwm4 # presumably?
|
- And lastly run
xfwm4
and the application you need in a separate terminal editor or via a launcher, script etc. DO REMEMBER though to set the DISPLAY
variable before running said applications.
With xfwm4#
1
| DISPLAY=:100 && xfwm4 & terminator
|
Without xfwm4, such as would be the case on Mac#
1
| DISPLAY=:100 && terminator
|
Notes#
- If you end up using this a lot or find the steps tedious, run the following script:
1
2
3
4
5
| #!/usr/bin/env bash
export DISPLAY=:100
adb forward tcp:6100 tcp:6000
x2x -east -to :100 -from :0
|
- and use
dmenu
or 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)