Seamlessly Connect Your Android Phone and Linux Using GSConnect

Let's improve the 'relation' between your Linux computer and the Android smartphone.
Warp Terminal

Smartphones are an inseparable part of our technical life these days. The thing is that you'll spend part of your time on the smartphone and part of it on the computer.

And that also creates some inconvenience. When you keep on switching between the two devices, you'll feel the need to connect the two.

Transfer files between the devices, share clipboards, see some phone notifications on the phone etc.

Apple has an excellent ecosystem that connects an iPhone with Mac. Windows also provides features to connect your Android smartphone with the PC.

For Linux, KDE has developed a solution called KDE Connect. It works better in the KDE environment and hence we have the GSConnect extension for GNOME desktop users.

GSConnect is an implementation of KDE Connect itself. While KDE Connect may already work on GNOME, GSConnect gives a better experience for GNOME users in my opinion.

βœ‹
Please check which desktop environment you are using and ensure that it is GNOME. It would be better if you are familiar with the concept of GNOME Extensions.

Setting Up GSConnect on your Linux system

🚧
Even though GSConnect is based on KDE Connect, you MUST NOT have KDE Connect installed on your laptop/desktop system, if you want to use GSConnect. If it is installed already, remove it please.

As said earlier, GSConnect is a GNOME extension. So, you need to install this extension first.

Install GSConnect extension

To install, either use the GNOME Shell Extension Manager app or use the extensions' website.

GSConnect extension install page in GNOME Shell Extension Manager Application. Click on the install button to install this to your system.
GSConnect in Extension Manager

Once you install the extension, you can see the extension active in the System tray quick buttons.

GSConnect extension is enabled. It is accessible from the GNOME system tray quick toggle items.
GSConnect Extension in system tray
πŸ’‘
If you want to use the GSConnect inside a guest in VirtualBox, change the guest network settings from NAT to Bridged Adapter.

Allow KDE Connect over the firewall

🚧
Never turn off or disable firewall, if the service you need can be run with Firewall enabled. Just configure the firewall accordingly so that the program works.

Many distributions come with a firewall setup. But KDE Connect, on which GSConnect is based, needs to communicate with the other system over the firewall. This is because there are many features like remote input, notification sharing, etc., that need incoming and outgoing communication. The default policy for the Firewall in most system is to block incoming communications entirely.

So, you need to allow KDE Connect to communicate over Firewall.

The KDE Connect protocol uses ports 1714-1764 for UDP and TCP. We need to open these ports. The steps for UFW and Firewalld are mentioned here, since these are the most popular Firewall solution on desktop Linux systems.

βœ‹
Check if you have a firewall set up and which one it is. Use the appropriate commands to enable the required port.

Open necessary ports in UFW (Ubuntu)

On Ubuntu, the default Firewall provider is UFW. So, open a terminal and run the command below:

sudo ufw allow 1714:1764/udp
sudo ufw allow 1714:1764/tcp
sudo ufw reload
Firewall rules are added in Ubuntu, so that KDE Connect protocol can work properly.
UFW Firewall Settings

Open necessary ports in Firewalld (Fedora)

Fedora comes with Firewalld as the Firewall provider. In this case, use the command:

sudo firewall-cmd --permanent --zone=public --add-service=kdeconnect
sudo firewall-cmd --reload

That's it. You have configured the firewall settings needed for GSConnect.

Install KDE Connect on Android smartphone

Once you have Linux system ready, install KDE Connect on your Android phone. This app is available on Google Play.

After installation, open KDE Connect on your phone.

πŸ“‹
If you didn't set up the firewall properly in the previous step, the devices won't be detected.

Identify the device name

If you are not sure about the name of the mobile device, you can click on the top-left hamburger menu and select settings.

Get the name of Mobile Device in KDE Connect mobile application.
Get Mobile Device Name

Here, you can see the name of your device under β€œDevice name” field.

πŸ“‹
For Linux, the name of the device will be shown in the title of GSConnect window.

Pair the devices

Once you set up GSConnect on Linux and KDE Connect on Android, let's connect them.

Click on the system tray button on your GNOME panel. From the dropdown menu adjacent to GSConnect, select the Mobile Settings option as shown in the screenshot below.

Click on "Mobile Settings" option in GSConnect extension. You can see the extension in GNOME Shell system tray buttons.
Click on Mobile Settings

In the GSConnect settings window, you can see that the mobile is detected. Click on it.

In the GSConnect settings window, you can see the device has been detected. Click on the correct device name.
Mobile device detected

Alternatively, you can see the Linux system detected in the KDE Connect mobile app. Click on the computer name to start connecting to it.

Here, I clicked the detected PC on mobile. Then click on β€œRequest Pairing”. This will ask me to accept the pairing request on the GNOME desktop.

Click on the Accept button to pair the phone and PC.
Accept Pairing Request from Phone

Click on Accept, and your devices will be paired.

🚧
You should verify the key displayed on both devices. If it does not match, do not connect. The phone will only show the first 8 characters of the verification key.

To start a pairing request from Linux, you can click on the detected mobile device in GSConnect desktop app and click on the Pair button.

Click on Pair button in GSConnect window in GNOME Desktop
Click on Pair

Now, you need to accept the request inside KDE Connect Mobile app to pair the devices.

🚧
You may not get a pairing request in Phone notifications. So, it is advised to open the KDE Connect app while sending request to accept it before timeout.

That's it. The devices are now connected.

Most of the settings are available from the system tray.

Mobile settings, accessible from System tray button.
Mobile Settings in Tray

Permission settings

Now that the devices are connected, you can do basic things like Send files, remote input, send clipboard, etc.

You can see the what you can do by going to the Advanced tab in the GSConnect window.

Advanced tab in GS Connect settings window.
GSConnect Advanced Tab
πŸ’‘
In mobile, this advanced settings can be found at Top-right menu β†’ Plugin Settings.

Here, you can enable and disable things.

On the phone, you can give more permissions like Notification Sync, Telephony Notification, contacts sync, etc. Do this from the KDE Connect home page and on your mobile device.

Using GSConnect

Now, let's see some use cases of GSConnect.

Send files between devices

To send a file from PC to your mobile device, expand the GSConnect button in the system tray and select Share.

Select Share option from System Tray
Select Share from GSConnect Tray

This will open the File Chooser from where you can select the files.

πŸ’‘
On phone, select the Send Files option in the KDE Connect home page to select the files and send selected items.

Mount an Android folder

Sometimes, it would be better if you could mount a local Android folder in the system for better file transfer and sync.

To do that, first, give filesystem permission for the KDE Connect app on your phone.

Click on the Filesystem Expose button and then allow KDE Connect to access in system settings.

Allow access and provide folder location.
Select Folder Location

Depending on the Android version, you may need to give KDE Connect some permissions when asked. Just follow the onscreen instructions, and it will land you automatically on all needed settings pages.

πŸ“‹
Newer Android versions won't allow you to share the home directory or some other directories like Downloads to be shared.

Once the location is selected in Android device, you can click on the Mount option in GSConnect System Tray button.

Click on Mount option to mount the selected location to your system.
Click on Mount

When you go to the File Manager, you can see that the directory you selected has been mounted using the SFTP protocol.

Android File system is mounted in GNOME using SFTP protocol.
Android File system is mounted in GNOME

Lock or shutdown the remote system

With the KDE Connect mobile app, you can lock the computer system or shutdown from the mobile. To do this, click on the Run Command option and then select the required action.

Click on the run command and select the required action.
Run Command
🚧
Save all important works before shutting down or restarting the system.

Use phone as a mouse

You can use your phone display as a trackpad instead of mouse. This helps in a few cases. For example, you have connected the computer to TV to play a movie and then you can use the phone to play/pause the movie.

Use the Remote Input option in KDE Connect.

It supports all the useful functions and some are mentioned in the table below.

Function Action
Move the mouse Swipe across the screen with one finger
Scroll Swipe with two fingers
Left-click Either tap the screen or use the left-click button
Right-click Either tap with two fingers or use the right-click button
Middle-click Either tap with three fingers or use the middle-click button

Some other notable remote input functions are:

  • Use the keyboard button on the topbar to use mobile keyboard with the system.
  • Use the Compose Send button on the top bar to type a text and then send it to the system instead of live typing.
  • On the settings, you can enable the gyroscope mouse

Conclusion

I would like to list a few more KDE Connect use cases that I didn't cover in detail:

  • Notification Sync to get phone notification in PC.
  • Telephony notification to get phone call notification in desktop.
  • Get phone battery charge details from system tray.

I let you explore it and enjoy a seamless connection between your Linux computer and Android smartphone.

I also invite you to share your views and experience in the comment system.

With inputs from Abhishek Prakash.

About the author
Sreenath

Sreenath

Linux tinkerer by day, Lord of the Rings fanatic by night. When I'm not busy conquering the command line, you can find me kicking back and watching some football while quoting JRR Tolkien

Become a Better Linux User

With the FOSS Weekly Newsletter, you learn useful Linux tips, discover applications, explore new distros and stay updated with the latest from Linux world

itsfoss happy penguin

Great! You’ve successfully signed up.

Welcome back! You've successfully signed in.

You've successfully subscribed to It's FOSS.

Success! Check your email for magic link to sign-in.

Success! Your billing info has been updated.

Your billing was not updated.