Control your Android smartphone from your desktop

Remote Control

© Lead Image © victor kuznetsov, 123RF.com

© Lead Image © victor kuznetsov, 123RF.com

Article from Issue 231/2020
Author(s):

With guiscrcpy graphical user interface and the scrcpy command-line tool, you can control your smartphone from the comfort of your Linux desktop and even record what you're doing onscreen.

Smartphones and the Linux desktop complement each other quite well thanks to cloud services. If you're not afraid of Google services or providers like Dropbox, WhatsApp, and the like, you never again have to connect your mobile phone to your computer to synchronize data or copy photos and videos. Even messengers like WhatsApp or Google's Messages now offer a web interface so that your mobile phone can stay in your pocket.

However, there are also situations in which you might want to be able to use your PC to operate your mobile phone. Ideally, you would want to transfer the content of the mobile phone display to the PC desktop. This is exactly what the duo of the scrcpy command-line program and the guiscrcpy graphical user interface (GUI) offers. These open source programs available for Linux, macOS X, and Windows even let you record what is happening on the mobile phone display.

Screen Copy

scrcpy comes from the Genymobile [1] treasure trove. Among other things, Genymobile specializes in virtualizing Android, which means that developers can test their applications on a variety of smartphones or tablets without having to own the devices themselves. As a command-line tool, Genymotion provides the scrcpy [2] program's source code on GitHub for download under the very liberal Apache license.

Developed independently of scrcpy, the guiscrcpy GUI [3] adds some convenience. The program integrates all the scrcpy functions and lets users open the connection with a single click. Freely placeable toolbars with buttons on the desktop help to transmit typical actions, such as the Home, Back, and Menu buttons, as well as, for example, rotating the smartphone's display.

Installation

Both guiscrcpy and scrcpy are still so new that they are not available in the major distributions' package sources. Only Arch Linux allows you to install the two programs from the Arch User Repository (AUR). Listing 1 shows you how to import guiscrcpy from the AUR; alternatively you can use another AUR helper or graphical package manager like Manjaro's Pamac. When installing from the AUR, the system automatically fetches scrcpy and the other dependencies to your machine.

Listing 1

Importing from the AUR

 

For other distributions (like Ubuntu 19.04, which we use in our lab), the developer offers precompiled binary packages together with an installation script. To install, download the current version (1.10.1 when this issue went to press) in the form of a tar.gz archive, unpack the file as shown in Listing 2, and execute the installation script. It saves the program as guiscrcpy and also creates an entry in the Application menu. (To uninstall guiscrcpy, see the "Deinstallation" box.)

Listing 2

Installing guiscrcpy

 

Deinstallation

Guiscrcpy's developer currently provides an installation script, but there is no option to delete the program from the system. Use the commands from Listing 3 to remove the application and the configuration file from the home directory, if needed.

Listing 3

Removing guiscrcpy

 

Guiscrcpy functions as the interface for the scrcpy command-line tool. scrcpy is also missing from popular distributions' package sources, but the developers do offer the program as a Snap package [4] – many distributions now support this format out the box. On Ubuntu 19.04, you can import the tool with Snapcraft using a single command. In the same step, you also install the Android Debug Bridge (adb) via the Android Software Development Kit provided by Google (Listing 4).

Listing 4

Installing scrcpy and adb

 

Developer Mode

For guiscrcpy to access your smartphone, developer mode and USB debugging must be enabled on the mobile device. Google has hidden the settings you need for this. To unlock them, open Settings on your smartphone, then in General | About Phone | Software Information tap the Build Number seven times. Depending on the smartphone manufacturer, the menu path may vary.

You now should find a new Developer Options menu item in the settings, where you can enable both the developer options en bloc and USB Debugging as an additional option (Figure 1). Later, the smartphone will ask you if you want to allow USB debugging when you connect via guiscrcpy for the first time. You can use a fingerprint to identify the connected computer later on and save the connection using the Always allow from this computer option.

Figure 1: To allow guiscrcpy to access the screen of an Android smartphone connected via USB, you need to enable developer mode and USB debugging.

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

comments powered by Disqus
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters

Support Our Work

Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.

Learn More

News