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
-
Systemd Fixes Bug While Facing New Challenger in GNU Shepherd
The systemd developers have fixed a really nasty bug amid the release of the new GNU Shepherd init system.
-
AlmaLinux 10.0 Beta Released
The AlmaLinux OS Foundation has announced the availability of AlmaLinux 10.0 Beta ("Purple Lion") for all supported devices with significant changes.
-
Gnome 47.2 Now Available
Gnome 47.2 is now available for general use but don't expect much in the way of newness, as this is all about improvements and bug fixes.
-
Latest Cinnamon Desktop Releases with a Bold New Look
Just in time for the holidays, the developer of the Cinnamon desktop has shipped a new release to help spice up your eggnog with new features and a new look.
-
Armbian 24.11 Released with Expanded Hardware Support
If you've been waiting for Armbian to support OrangePi 5 Max and Radxa ROCK 5B+, the wait is over.
-
SUSE Renames Several Products for Better Name Recognition
SUSE has been a very powerful player in the European market, but it knows it must branch out to gain serious traction. Will a name change do the trick?
-
ESET Discovers New Linux Malware
WolfsBane is an all-in-one malware that has hit the Linux operating system and includes a dropper, a launcher, and a backdoor.
-
New Linux Kernel Patch Allows Forcing a CPU Mitigation
Even when CPU mitigations can consume precious CPU cycles, it might not be a bad idea to allow users to enable them, even if your machine isn't vulnerable.
-
Red Hat Enterprise Linux 9.5 Released
Notify your friends, loved ones, and colleagues that the latest version of RHEL is available with plenty of enhancements.
-
Linux Sees Massive Performance Increase from a Single Line of Code
With one line of code, Intel was able to increase the performance of the Linux kernel by 4,000 percent.