Make Android devices part of your Linux environment

Symbiotic Combo

Article from Issue 175/2015
Author(s):

An Android smartphone or tablet is a versatile device on its own, but with a bit of work and few apps, you can make it an organic part of your Linux-based working environment.

Although an Android device can function autonomously, integrating it into your Linux-based environment can make your daily computing more efficient. Several apps and tools are available to help you to make an Android-based smartphone or tablet fit your workflow.

Mirroring Notifications with LinConnect

Viewing Android notifications on your Linux desktop is less distracting and time-consuming than checking your device every time it vibrates or blinks. The LinConnect [1] tool lets you add this functionality easily to any Linux desktop machine, as long as it's on the same wireless network as the Android device (Figure 1).

Figure 1: LinConnect offers a simple way to mirror Android notifications.

LinConnect comprises the service that runs on the Linux desktop and the Android client app. The server component is written in Python and has only a few dependencies. If you happen to use Ubuntu, you can deploy and run the LinConnect server using the following commands:

wget --quiet https://raw.github.com/hauckwill/linconnect-server\
  /master/LinConnectServer/install.sh
chmod +x install.sh
./install.sh

On other Linux distributions, you can deploy the LinConnect server by installing the required dependencies and cloning the project's GitHub repository with:

git clone https://github.com/hauckwill/linconnect-server.git

Now, switch to the ~/.linconnect-server/LinConnectServer/main directory and start the server using python linconnect_server.py. Next, install the LinConnect app [2] on the Android device. Launch the app and pick the machine running the LinConnect server from the list of available servers. This step connects the app to the machine and sends a test notification to the desktop.

KDE Connect

If KDE is your preferred graphical desktop environment, KDE Connect [3] is the best tool for linking it to your Android device. Similar to LinConnect, KDE Connect comes in two parts: a desktop application and an Android app. The binary packages of the desktop component are available for various Linux distributions like openSUSE and Ubuntu (and all its variants). If you use the latter, you can install the latest version of KDE Connect from a PPA [4] using:

sudo apt-add-repository ppa:vikoadi/ppa
sudo apt-get update
sudo apt-get install kdeconnect

KDE Connect for Android is available on both the Google Play Store and F-Droid, so you can install the app from your preferred source. Once you've done that, launch the KDE Connect application on the KDE desktop and the app on your Android device. Then, pair the desktop client with the detected Android device, and you are good to go.

All functionality in KDE Connect is implemented via plugins, and you can enable and disable individual modules as well as configure their options using the KDE Connect desktop application (Figure 2). In addition to plugins for mirroring and syncing notifications, KDE Connect offers several other useful modules.

Figure 2: The KDE Connect desktop application.

The Battery monitor plugin, for example, allows you to keep an eye on the Android battery status from the convenience of the KDE desktop. To make use of this plugin, you need to add the KDE Connect widget to the desktop. The Clipboard plugin enables the functionality that syncs the contents of the desktop and Android clipboards. With the Remote filesystem browser plugin enabled, you can use the Dolphin file manager to access storage on the Android device.

The Share and Receive module makes it possible to exchange files between the desktop and the Android device. You can push any file on your desktop machine by right-clicking on it in Dolphin and choosing Send to <DEVICE> via KDE Connect. You can send files in the opposite direction, too. The KDE Connect app adds a dedicated command to Android's sharing feature, so you can push a file from practically any app. KDE Connect's sharing functionality is not limited to files: You can send URLs from the Android device to the default browser on the KDE desktop (Figure 3).

Figure 3: You can use KDE Connect to push URLs to the default desktop browser.

If you want to use your Android device to control the media player on the KDE desktop, enable the Multimedia Control Receiver plugin to start, stop, pause, and navigate between tracks using a remote control interface in the KDE Connect app (Figure 4). Finally, the Touchpad plugin turns the Android device into a glorified touchpad for controlling the desktop cursor.

Figure 4: KDE Connect features a simple media remote control.

SSH Button and Mercury-SSH Commander

When you are on the move, an Android device can come in rather handy for accessing and managing remote Linux machines via SSH. Several excellent SSH client apps can help you with that, including ConnectBot, VX ConnectBot, and JuiceSSH. However, pecking commands on a tiny virtual keyboard can quickly become a nuisance – especially if you usually run only a handful of specific actions (e.g., perform a system update, restart a service, reboot the remote machine, etc.).

In this case, you might want to opt for an app like SSH button [5], which lets you define multiple buttons with commands attached to them (Figure 5). As you would expect, defining buttons in SSH button is as easy as it gets: choose Add entry from the main menu, give the new button a name in the Label field, specify the desired command in the Command field, and provide the required SSH connection info. The Command field can contain practically any Linux command – from a simple sudo reboot to more complex commands like

sudo apt-get update && sudo apt-get dist-upgrade -y
Figure 5: SSH button lets you define multiple command buttons.

Although SSH button is available free of charge, it's not open source. If you prefer to stick to pure open source software, Mercury-SSH Commander [6] is right up your alley. This application also allows you to define an unlimited number of entries with specific commands assigned to them. Instead of using the app itself, however, you need to create a configuration file manually in JSON format containing definitions. Fortunately, this is easy to do, and you can use the example shown in Listing 1 as a starting point:

Listing 1

Configuration File for Mercury-SSH Commander

 

As you can see, the configuration file is relatively simple. The name, host, port, user, and password server properties are used to specify the SSH connection info. All commands are specified in the commands array, and each command has three properties: name, sudo (specifies whether the command should be run as root), and cmd.

The configuration file must be saved as a UTF-8, UTF-16, or UTF-32-encoded text file with the .json extension in the Mercury-SSH directory on the Android device. Mercury-SSH Commander supports multiple configuration files, so you can create individual profiles for several remote machines (Figure 6).

Figure 6: Mercury-SSH Commander.

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

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