使用 GSConnect 将 Android 手机连接到 Fedora 系统
手机
![](/data/attachment/album/202002/15/222716tmdmd7g66g5r7pok.jpg)


苹果和微软公司都不同程度的提供了桌面产品与移动设备集成。Fedora 提供了类似甚至更高集成度的工具——GSConnect。它可以让你将安卓手机和你的 Fedora 桌面配对并使用。请继续阅读，以了解更多关于它的情况以及它是如何工作的信息。


### GSConnect 是什么?


GSConnect 是针对 GNOME 桌面定制的 KDE Connect 程序。KDE Connect 可以使你的设备能够互相通信。但是，在 Fedora 默认的 GNOME 桌面上安装它需要安装大量的 KDE 依赖。


GSConnect 是一个 KDE Connect 的完整实现，其以 GNOME shell 的拓展形式出现。安装后，GSConnect 允许你执行以下操作及更多：


* 在计算机上接收电话通知并回复信息
* 用手机操纵你的桌面
* 在不同设备之间分享文件与链接
* 在计算机上查看手机电量
* 让手机响铃以便你能找到它


### 设置 GSConnect 扩展


设置 GSConnect 需要安装两个组件：计算机上的 GSConnect 扩展和 Android 设备上的 KDE Connect 应用。


首先，从 GNOME Shell 扩展网站上安装 [GSConnect](https://extensions.gnome.org/extension/1319/gsconnect/) 扩展。（Fedora Magazine 有一篇关于[如何安装 GNOME Shell 扩展](https://fedoramagazine.org/install-gnome-shell-extension/)的文章，可以帮助你完成这一步。）


KDE Connect 应用程序可以在 Google 的 [Play 商店](https://play.google.com/store/apps/details?id=org.kde.kdeconnect_tp)上找到。它也可以在 FOSS Android 应用程序库 [F-Droid](https://f-droid.org/en/packages/org.kde.kdeconnect_tp/) 上找到。


一旦安装了这两个组件，就可以配对两个设备。安装扩展后它在你的系统菜单中显示为“<ruby> 移动设备 <rt>  Mobile Devices </rt></ruby>”。单击它会出现一个下拉菜单，你可以从中访问“<ruby> 移动设置 <rt>  Mobile Settings </rt></ruby>”。


![](/data/attachment/album/202002/15/222718dv41g3gtata44191.png)


你可以在这里用 GSConnect 查看并管理已配对的设备。进入此界面后，需要在 Android 设备上启动应用程序。


你可以在任意一台设备上进行配对初始化，在这里我们从 Android 设备连接到计算机。点击应用程序上的“刷新”，只要两个设备都在同一个无线网络环境中，你的 Android 设备便可以搜索到你的计算机。现在可以向桌面发送配对请求，并在桌面上接受配对请求以完成配对。


![](/data/attachment/album/202002/15/222719c5vurcc56qdsj2qo.png)


### 使用 GSConnect


配对后，你将需要在 Android 设备授予权限，才能使用 GSConnect 上提供的许多功能。单击设备列表中的已配对设备，便可以查看所有可用功能，并根据你的偏好和需要启用或禁用它们。


![](/data/attachment/album/202002/15/222720pc1mm24ei4mpbmqe.png)


请记住，你还需要在这个 Android 应用程序中授予相应的权限才能使用这些功能。启用权限后，你现在可以访问桌面上的移动联系人，获得消息通知并回复消息，甚至同步桌面和 Android 设备的剪贴板。


### 将你的浏览器与“文件”应用集成


GSConnect 允许你直接从计算机上的文件资源管理器的关联菜单向 Android 设备发送文件。


在 Fedora 的默认 GNOME 桌面上，你需要安装 `nautilus-python` 依赖包，以便在关联菜单中显示配对的设备。安装此命令非常简单，只需要在你的首选终端运行以下命令：



```
$ sudo dnf install nautilus-python
```

完成后，将在“<ruby> 文件 <rt>  Files </rt></ruby>”应用的关联菜单中显示“<ruby> 发送到移动设备 <rt>  Send to Mobile Device </rt></ruby>”选项。


![](/data/attachment/album/202002/15/222721fui3fsqvrgg06fqr.png)


同样，为你的浏览器安装相应的 WebExtension，无论是 [Firefox](https://addons.mozilla.org/en-US/firefox/addon/gsconnect/) 还是 [Chrome](https://chrome.google.com/webstore/detail/gsconnect/jfnifeihccihocjbfcfhicmmgpjicaec) 浏览器，都可以将链接发送到你的 Android 设备。你可以选择直接发送链接以在浏览器中直接打开，或将其作为短信息发送。


### 运行命令


GSConnect 允许你定义命令，然后可以从远程设备在计算机上运行这些命令。这使得你可以远程截屏，或者从你的 Android 设备锁定和解锁你的桌面。


![](/data/attachment/album/202002/15/222722fi8oyva9doiy8x0z.png)


要使用此功能，可以使用标准的 shell 命令和 GSConnect 提供的 CLI。该项目的 GitHub 存储库（CLI Scripting）中提供了有关此操作的文档。


[KDE UserBase Wiki](https://userbase.kde.org/KDE_Connect/Tutorials/Useful_commands) 有一个命令示例列表。这些例子包括控制桌面的亮度和音量、锁定鼠标和键盘，甚至更改桌面主题。其中一些命令是针对 KDE Plasma 设计的，需要进行修改才能在 GNOME 桌面上运行。


### 探索并享受乐趣


GSConnect 使我们能够享受到极大的便利和舒适。深入研究首选项，查看你可以做的所有事情，灵活的使用这些命令功能发挥创意，并在下面的评论中自由分享你解锁的新方式。




---


via: <https://fedoramagazine.org/connect-fedora-to-your-android-phone-with-gsconnect/>


作者：[Lokesh Krishna](https://fedoramagazine.org/author/lowkeyskywalker/) 选题：[lujun9972](https://github.com/lujun9972) 译者：[chai-yuan](https://github.com/chai-yuan) 校对：[wxy](https://github.com/wxy)


本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译，[Linux中国](https://linux.cn/) 荣誉推出


OK
Both Apple and Microsoft offer varying levels of integration of their desktop offerings with your mobile devices. Fedora offers a similar if not greater degree of integration with **GSConnect**. It lets you pair your Android phone with your Fedora desktop and opens up a lot of possibilities. Keep reading to discover more about what it is and how it works.

### What is GSConnect?

GSConnect is an implementation of the KDE Connect project tailored for the GNOME desktop. KDE Connect makes it possible for your devices to communicate with each other. However, installing it on Fedora’s default GNOME desktop requires pulling in a large number of KDE dependencies.

GSConnect is a complete implementation of KDE Connect, but in the form of a GNOME shell extension. Once installed, GSConnect lets you do the following and a lot more:

- Receive phone notifications on your desktop and reply to messages
- Use your phone as a remote control for your desktop
- Share files and links between devices
- Check your phone’s battery level from the desktop
- Ring your phone to help find it

### Setting up the GSConnect extension

Setting up GSConnect requires installing two components: the GSConnect extension on your desktop and the KDE Connect app on your Android device.

First, install the GSConnect extension from the GNOME Shell extensions website: [GSConnect](https://extensions.gnome.org/extension/1319/gsconnect/). (Fedora Magazine has a handy article on [How to install a GNOME Shell extension](https://fedoramagazine.org/install-gnome-shell-extension/) to help you with this step.)

The KDE Connect app is available on Google’s [Play Store](https://play.google.com/store/apps/details?id=org.kde.kdeconnect_tp). It’s also available on the FOSS Android apps repository, [F-Droid](https://f-droid.org/en/packages/org.kde.kdeconnect_tp/).

Once you have installed both these components, you can pair your two devices. Installing the extension makes it show up in your system menu as *Mobile Devices*. Clicking on it displays a drop down menu, from which you can access *Mobile Settings*.

![GSConnect menu within system menu](https://fedoramagazine.org/wp-content/uploads/2020/01/within-the-menu-1024x576.png)

Here’s where you can view your paired devices and manage the features offered by GSConnect. Once you are on this screen, launch the app on your Android device.

You can initiate pairing from either device, but here you’ll be connecting to your desktop from the Android device. Simply hit refresh on the app, and as long as both devices are on the same wireless network, your desktop shows up in your Android device. You can now send a pair request to the desktop. Accept the pair request on your desktop to complete the pairing.

![Pair request from Android app to desktop](https://fedoramagazine.org/wp-content/uploads/2020/01/pair-request-1024x576.png)

### Using GSConnect

Once paired, you’ll need to grant permissions on your Android device to make use of the many features available on GSConnect. Click on the paired device in the list of devices to see all available functions and enable or disable them according to your preferences.

![GSConnect device preferences](https://fedoramagazine.org/wp-content/uploads/2020/01/permissions-1024x576.png)

Remember that you’ll also need to grant corresponding permissions in the Android app to be able to use these functions. Depending upon the features you’ve enabled and the permissions you’ve granted, you can now access your mobile contacts on your desktop, get notified of messages and reply to them, and even sync the desktop and Android device clipboards.

### Integration with Files and your web browsers

GSConnect allows you to directly send files to your Android device from your desktop file explorer’s context menu.

On Fedora’s default GNOME desktop, you will need to install the *nautilus-python* package in order to make your paired devices show up in the context menu. Installing this is as straightforward as running the following command from your preferred terminal:

$ sudo dnf install nautilus-python

Once done, the *Send to Mobile Device* entry appears in the context menu of the Files app.

![Context menu entry to send file to mobile device](https://fedoramagazine.org/wp-content/uploads/2020/01/send-to-mobile-2-1024x576.png)

Similarly, install the corresponding WebExtension for your browser, be it [Firefox](https://addons.mozilla.org/en-US/firefox/addon/gsconnect/) or [Chrome](https://chrome.google.com/webstore/detail/gsconnect/jfnifeihccihocjbfcfhicmmgpjicaec), to send links to your Android device. You have the option to send the link to launch directly in your browser or to deliver it as SMS.

### Running Commands

GSConnect lets you define commands which you can then run on your desktop, from your remote device. This allows you to do things such as take a screenshot of your desktop, or lock and unlock your desktop from your Android device, remotely.

![Define commands to be run from the mobile device, on the desktop](https://fedoramagazine.org/wp-content/uploads/2020/01/commands-1024x576.png)

To make use of this feature, you can use standard shell commands and the CLI exposed by GSConnect. Documentation on this is provided in the project’s GitHub repository: *CLI Scripting*.

The [KDE UserBase Wiki ](https://userbase.kde.org/KDE_Connect/Tutorials/Useful_commands)has a list of example commands. These examples cover controlling the brightness and volume on your desktop, locking the mouse and keyboard, and even changing the desktop theme. Some of the commands are specific for KDE Plasma, and modifications are necessary to make it run on the GNOME desktop.

### Explore and have fun

GSConnect makes it possible to enjoy a great degree of convenience and comfort. Dive into the preferences to see all that you can do and get creative with the commands function. Feel free to share all the possibilities this utility unlocked in your workflow in the comments below.

*Photo by Pathum Danthanarayana on Unsplash.*

## Hans

Got a bug where the MPRIS media player controls don’t work with Celluloid/gnome-mpv.

Connecting to the phone after starting celluloid works, starting celluloid with the phone already connected doesn’t. Other media players such as Spotify control fine.

## svsv sarma

As it is, I can access the Android device for sharing files, photos and images etc from the device storage. Certainly GSConnect can’t make or receive calls from desk top. I strongly feel that any thing more is injurious to the Android device.

## Lokesh Krishna

Not sure about what you mean by injurious but GSConnect goes beyond just mounting your filesystem. You also get the view notifications and control media and also use it to remotely control your desktop, from using the phone as a remote keyboard or mouse and also using the commands.

## Morvan

A native Plasma user needs exactly what, to use GSConnect?

## ondrej

You can freely use the original KDE Connect! No need to use GS Connect

## Sinan

It should be natively available on plasma. Else just dnf install kde-connect, and kde-connect client on your phone.

It appears in the system settings and you also have a plasmoid to go with it.

The best thing since sliced bread.

## Markus S.

kdeconnect-kde

## Guilherme

What about KDEConnect? 😀

You should try this: https://github.com/guinuxbr/KDEConnect-commands

## johanh

@Morvan You don’t, you use KDE Connect.

## Pedro Fleck

GSConnect is an implementation of KDE Connect on Gnome Shell, in Plasma you could just use KDE Connect (I think it even comes preinstalled these days).

## Ivan

KDE Connect, of course! That is what GSConnect is based on.

## Morvan

I thought it, but it need stay clear, for me too. Thanks.

## Euan

The KDE Connect app only pairs with the Gnome desktop when the phone is unlocked. I am running the KDE Connect app on an Android 10 device (Huawei Mate P20 Pro)

Is there a special setting to enable it to run in the background. I have tried all the

setting on the phone, and have disabled auto-management of the app, and allowed it to run in the background.

## Karlis K.

I think this is a Huawei specific problem related to background app and power optimization settings – I experience this same problem on my Mate 10 Lite

## psychoslave

Seemed interesting, but after 10 minutes trying to monkey click every option possible, and even typing the IP of the laptop directly on the phone, my devices still don’t see each other. :-/

## Karlis K.

Did you rule out Firewall blocking? You can temporarily stop the firewall to check that it’s not blocking.

## Maxi

Neat article but maybe cut the screenshots to what is really relevant? I cannot even click on them to see them bigger but have to manually load their URL and the tiny embed is nearly unreadable even on my 4K HiDPI monitor.

Btw: My first comment was discarded yesterday.

## Wojciech

Nice, remember to open the ports for KDE connect. Also works with MATE.

## Andrew

Works fine though on Silverblue you need to reboot before attempting to pair.

I’d like to see persistent desktop notifications. Right now notifications flash on the screen for less than five seconds so if you’re away from your desk you’ll miss them.

## Karlis K.

I use the “Grown-up notifications” extension by yupi from but that’s because I like to keep all my notifs until I’ve ackowleged them myself.

## FeRD (Frank Dana)

@Andrew Unacknowledged notifications will usually stick around in the notification shade/drawer. (At least until they’re dismissed on the Android device — the dismissal should also be mirrored, so it’ll clear the desktop notification as well.) So you should be able to click on the GNOME Shell top-bar clock to see the ones you missed (though they don’t offer the same interaction options as the popup versions do).

If anything, the problem I tend to have is notifications being TOO persistent — my phone is a source of pretty active app-spam. If I go a bunch of hours without picking it up, and it’s connected to my desktop the whole time, I can end up with a backlog of mirrored notifications that stretches all the way to the bottom of the screen.

## Chris Cowley

Important step that has been left out is that you need to add a firewall service by running

.

Also, if you want to have available to all users, do not install it though the extensions website. It is packaged up, so you can simply install it with

.

## FeRD (Frank Dana)

@Chris

webextension-gsconnect is actually the browser extension, it probably pulls in GSConnect itself as a dependency but it’s usually a better idea to install browser extensions from their official app “store”s.

To install GSConnect itself system-wide, you’d want to use

(Not

superrecommended because it can interfere with users trying to install the extension locally in their home directory, say to get the latest version. But, it is an option for those who want a central install.)## Christian

Hmmm… Given that connectivity would be via WiFi and the default on Fedora 31 is to not allow any incoming services and port 1716 is required for connectivity a brief reference to allowing services would be useful. I can’t find any obvious, menu based approach in Gnome to manage firewall!

## Frank Dana

The optional

tool (which is installable from the standard repos using

) is a GUI for managing firewalld. IMHO it’s

more usable and friendly than the weird, verbose, annoyingmuchsyntax.

The .desktop file just lists it as “Firewall”, and for some reason it ends up in the Other group (if you use a categorized application launcher).

## sver

Off topic: Which theme, icons, fonts and other extensions are used on the screenshots? Looks awesome!

## Lokesh Krishna

Thanks!

The GTK theme is Nordic and the icon theme is Zafiro. The font in the terminal is Hack.

## Matthew Bunt

This is a really cool project. Thanks for sharing. The articles posted here just keep getting better and better. That being said…

The images in most articles are less than helpful due to small size and low resolution. A solution would be to show full size high resolution images when they are clicked on. Many websites do this so it is a pretty familiar design and I think it would be a fairly easy way to make a big improvement to Fedora Magazine.

## Brian

If I had a smart phone, could I then access the internet through the phone from my desktop, without another ISP?

## FeRD (Frank Dana)

@Brian

Most likely, but GSConnect won’t help with that. It’s strictly for local communication between devices.

There ARE various ways to get a Linux PC online using a mobile device (either by tethering over a USB cable, having the phone act as a WiFi hotspot, or using a Bluetooth connection between the two devices), but they don’t require GSConnect. It’s all handled by the OS networking and/or hardware interface layers — e.g., bluez handles Bluetooth network sharing.

Some methods also require subscription or authorization from your phone carrier. (Like, WiFi hotspot mode is usually an added-cost feature in most US cellular plans, and may have separate monthly data limits even on an unlimited-data phone plan.)

## Brian

Thankyou. I might just look into this.

## หวยออนไลน์ บาทละเท่าไหร่

Thanks a bunch for sharing this with all people you really recognize what

you are talking about! Bookmarked. Kindly additionally visit my website =).

We may have a hyperlink trade contract between us