Control your Android smartphone from your desktop
Remote Control
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.
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
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.
News
-
Canonical Releases Ubuntu 24.04
After a brief pause because of the XZ vulnerability, Ubuntu 24.04 is now available for install.
-
Linux Servers Targeted by Akira Ransomware
A group of bad actors who have already extorted $42 million have their sights set on the Linux platform.
-
TUXEDO Computers Unveils Linux Laptop Featuring AMD Ryzen CPU
This latest release is the first laptop to include the new CPU from Ryzen and Linux preinstalled.
-
XZ Gets the All-Clear
The back door xz vulnerability has been officially reverted for Fedora 40 and versions 38 and 39 were never affected.
-
Canonical Collaborates with Qualcomm on New Venture
This new joint effort is geared toward bringing Ubuntu and Ubuntu Core to Qualcomm-powered devices.
-
Kodi 21.0 Open-Source Entertainment Hub Released
After a year of development, the award-winning Kodi cross-platform, media center software is now available with many new additions and improvements.
-
Linux Usage Increases in Two Key Areas
If market share is your thing, you'll be happy to know that Linux is on the rise in two areas that, if they keep climbing, could have serious meaning for Linux's future.
-
Vulnerability Discovered in xz Libraries
An urgent alert for Fedora 40 has been posted and users should pay attention.
-
Canonical Bumps LTS Support to 12 years
If you're worried that your Ubuntu LTS release won't be supported long enough to last, Canonical has a surprise for you in the form of 12 years of security coverage.
-
Fedora 40 Beta Released Soon
With the official release of Fedora 40 coming in April, it's almost time to download the beta and see what's new.